chore: formatting
This commit is contained in:
parent
d5508535b9
commit
7a88a0dedd
|
@ -5,17 +5,17 @@ import { toPunyNullable } from "./convert-host.js";
|
||||||
import { IsNull } from "typeorm";
|
import { IsNull } from "typeorm";
|
||||||
|
|
||||||
const legacies = new Map([
|
const legacies = new Map([
|
||||||
['like', '👍'],
|
["like", "👍"],
|
||||||
['love', '❤️'],
|
["love", "❤️"],
|
||||||
['laugh', '😆'],
|
["laugh", "😆"],
|
||||||
['hmm', '🤔'],
|
["hmm", "🤔"],
|
||||||
['surprise', '😮'],
|
["surprise", "😮"],
|
||||||
['congrats', '🎉'],
|
["congrats", "🎉"],
|
||||||
['angry', '💢'],
|
["angry", "💢"],
|
||||||
['confused', '😥'],
|
["confused", "😥"],
|
||||||
['rip', '😇'],
|
["rip", "😇"],
|
||||||
['pudding', '🍮'],
|
["pudding", "🍮"],
|
||||||
['star', '⭐'],
|
["star", "⭐"],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export async function getFallbackReaction() {
|
export async function getFallbackReaction() {
|
||||||
|
@ -42,7 +42,10 @@ export function convertLegacyReactions(reactions: Record<string, number>) {
|
||||||
if (emoji) {
|
if (emoji) {
|
||||||
_reactions.set(emoji, (_reactions.get(emoji) || 0) + reactions[reaction]);
|
_reactions.set(emoji, (_reactions.get(emoji) || 0) + reactions[reaction]);
|
||||||
} else {
|
} else {
|
||||||
_reactions.set(reaction, (_reactions.get(reaction) || 0) + reactions[reaction]);
|
_reactions.set(
|
||||||
|
reaction,
|
||||||
|
(_reactions.get(reaction) || 0) + reactions[reaction],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +130,7 @@ export function decodeReaction(str: string): DecodedReaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertLegacyReaction(reaction: string): string {
|
export function convertLegacyReaction(reaction: string): string {
|
||||||
const decoded = decodeReaction(reaction).reaction;
|
const decoded = decodeReaction(reaction).reaction;
|
||||||
if (legacies.has(decoded)) return legacies.get(decoded)!;
|
if (legacies.has(decoded)) return legacies.get(decoded)!;
|
||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,17 +32,23 @@ export const paramDef = {
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
const query = ChannelFollowings.createQueryBuilder('following').andWhere({ followerId: me.id });
|
const query = ChannelFollowings.createQueryBuilder("following").andWhere({
|
||||||
|
followerId: me.id,
|
||||||
|
});
|
||||||
if (ps.sinceId) {
|
if (ps.sinceId) {
|
||||||
query.andWhere('following."followeeId" > :sinceId', { sinceId: ps.sinceId });
|
query.andWhere('following."followeeId" > :sinceId', {
|
||||||
|
sinceId: ps.sinceId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (ps.untilId) {
|
if (ps.untilId) {
|
||||||
query.andWhere('following."followeeId" < :untilId', { untilId: ps.untilId });
|
query.andWhere('following."followeeId" < :untilId', {
|
||||||
|
untilId: ps.untilId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (ps.sinceId && !ps.untilId) {
|
if (ps.sinceId && !ps.untilId) {
|
||||||
query.orderBy('following."followeeId"', 'ASC');
|
query.orderBy('following."followeeId"', "ASC");
|
||||||
} else {
|
} else {
|
||||||
query.orderBy('following."followeeId"', 'DESC');
|
query.orderBy('following."followeeId"', "DESC");
|
||||||
}
|
}
|
||||||
|
|
||||||
const followings = await query.take(ps.limit).getMany();
|
const followings = await query.take(ps.limit).getMany();
|
||||||
|
|
Loading…
Reference in New Issue