chore: formatting

This commit is contained in:
ThatOneCalculator 2023-02-17 00:19:29 -08:00
parent d5508535b9
commit cdf9a03604
No known key found for this signature in database
GPG key ID: 8703CACD01000000
3 changed files with 61 additions and 51 deletions

View file

@ -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],
);
} }
} }

View file

@ -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();

View file

@ -1,33 +1,34 @@
<template> <template>
<div v-if="show" ref="el" class="fdidabkb" :class="{ slim: narrow, thin: thin_ }" :style="{ background: bg }" @click="onClick"> <div ref="el" class="fdidabkb" :class="classes" :style="{ background: bg }" @click="onClick">
<div v-if="narrow" class="buttons left" @click="openAccountMenu"> <div v-show="narrow" class="buttons left" @click="openAccountMenu">
<MkAvatar v-if="props.displayMyAvatar && $i" class="avatar" :user="$i" :disable-preview="true"/> <MkAvatar v-if="displayMyAvatar && user" class="avatar" :user="user" :disable-preview="true"/>
</div> </div>
<template v-if="metadata"> <template v-if="hasTabs">
<div v-if="!hideTitle" class="titleContainer" @click="showTabsPopup"> <div v-show="!hideTitle" class="titleContainer" @click="showTabsPopup">
<MkAvatar v-if="metadata.avatar" class="avatar" :user="metadata.avatar" :disable-preview="true" :show-indicator="true"/> <MkAvatar v-if="metadata.avatar" class="avatar" :user="metadata.avatar" :disable-preview="true" :show-indicator="true"/>
<i v-else-if="metadata.icon && !narrow" class="icon" :class="metadata.icon"></i> <i v-else-if="metadata.icon && !narrow" class="icon" :class="metadata.icon"></i>
<div class="title"> <div class="title">
<MkUserName v-if="metadata.userName" :user="metadata.userName" :nowrap="true" class="title"/> <MkUserName v-if="metadata.userName" :user="metadata.userName" :nowrap="true" class="title"/>
<div v-else-if="metadata.title && !(tabs != null && tabs.length > 0 && narrow)" class="title">{{ metadata.title }}</div> <div v-else-if="metadata.title && !hasTabs && !narrow" class="title">{{ metadata.title }}</div>
<div v-if="!narrow && metadata.subtitle" class="subtitle"> <div v-show="!narrow && metadata.subtitle" class="subtitle">{{ metadata.subtitle }}</div>
{{ metadata.subtitle }}
</div> </div>
</div> </div>
</div> <div ref="tabsEl" class="tabs" v-show="hasTabs">
<div ref="tabsEl" v-if="hasTabs" class="tabs"> <button v-for="tab in tabs" :key="tab.key" ref="tabRefs[tab.key]" v-tooltip.noDelay="tab.title"
<button v-for="tab in tabs" :ref="(el) => tabRefs[tab.key] = el" v-tooltip.noDelay="tab.title" class="tab _button" :class="{ active: tab.key != null && tab.key === props.tab }" @mousedown="(ev) => onTabMousedown(tab, ev)" @click="(ev) => onTabClick(tab, ev)"> class="tab _button" :class="{ active: isActiveTab(tab) }" @mousedown="onTabMousedown(tab)"
<i v-if="tab.icon" class="icon" :class="tab.icon"></i> @click="onTabClick(tab)">
<i v-if="tab.icon && !tab.iconOnly" class="icon" :class="tab.icon"></i>
<span class="title">{{ tab.title }}</span> <span class="title">{{ tab.title }}</span>
</button> </button>
<div ref="tabHighlightEl" class="highlight"></div> <div ref="tabHighlightEl" class="highlight"></div>
</div> </div>
</template> </template>
<div class="buttons right"> <div v-show="hasActions" class="buttons right">
<template v-for="action in actions"> <button v-for="(action, index) in actions" :key="index" v-tooltip.noDelay="action.text"
<button v-tooltip.noDelay="action.text" class="_button button" :class="{ highlighted: action.highlighted }" @click.stop="action.handler" @touchstart="preventDrag"><i :class="action.icon"></i></button> class="_button button" :class="{ highlighted: action.highlighted }" @click.stop="action.handler"
</template> @touchstart="preventDrag">
<i :class="action.icon"></i>
</button>
</div> </div>
</div> </div>
</template> </template>