From 8a46b929482f4306b3c7aa79c1ccd790dd888fba Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 5 Jan 2024 14:29:41 +0900 Subject: [PATCH] refactor: replace confusing expressions relevant to accounts $i != null -> isSignedIn $i.isModerator || $i.isAdmin -> isModerator $i.isAdmin -> isAdmin $i.emojiModPerm !== "unauthorized" -> isEmojiMod iAmModerator, iAmAdmin, iAmEmojiMod -> isModerator, isAdmin, isEmojiMod --- packages/client/src/account.ts | 4 --- .../client/src/components/MkFollowButton.vue | 4 +-- packages/client/src/components/MkMention.vue | 5 ++-- packages/client/src/components/MkNote.vue | 6 ++-- packages/client/src/components/MkNoteSub.vue | 4 +-- .../MkPushNotificationAllowButton.vue | 15 ++++++---- .../components/MkReactionsViewer.reaction.vue | 4 +-- .../src/components/MkReactionsViewer.vue | 4 +-- .../client/src/components/MkRenoteButton.vue | 4 +-- packages/client/src/components/MkTimeline.vue | 6 ++-- .../src/components/MkTutorialDialog.vue | 12 +++----- packages/client/src/components/MkUserInfo.vue | 8 ++++-- packages/client/src/init.ts | 8 +++--- packages/client/src/navbar.ts | 16 +++++------ packages/client/src/pages/about.vue | 6 ++-- packages/client/src/pages/admin-file.vue | 8 +++--- packages/client/src/pages/announcements.vue | 8 ++++-- packages/client/src/pages/auth.vue | 8 +++--- packages/client/src/pages/clip.vue | 4 +-- packages/client/src/pages/explore.users.vue | 10 +++---- packages/client/src/pages/gallery/post.vue | 8 +++--- packages/client/src/pages/instance-info.vue | 13 ++++----- packages/client/src/pages/page.vue | 7 +++-- .../src/pages/settings/account-info.vue | 6 ++-- packages/client/src/pages/settings/drive.vue | 6 ++-- .../pages/settings/preferences-backups.vue | 4 +-- packages/client/src/pages/timeline.vue | 8 ++---- packages/client/src/pages/user-info.vue | 27 +++++++++--------- packages/client/src/pages/user/home.vue | 16 +++++------ packages/client/src/pages/user/index.vue | 4 +-- packages/client/src/pizzax.ts | 16 +++++------ packages/client/src/reactiveAccount.ts | 5 ++++ packages/client/src/router.ts | 28 ++++++------------- packages/client/src/scripts/get-note-menu.ts | 27 +++++++++--------- packages/client/src/scripts/get-user-menu.ts | 15 ++++------ packages/client/src/scripts/please-login.ts | 4 +-- .../client/src/scripts/use-note-capture.ts | 8 +++--- packages/client/src/store.ts | 4 +-- packages/client/src/theme-store.ts | 6 ++-- packages/client/src/ui/_common_/common.vue | 4 +-- .../src/ui/_common_/navbar-for-mobile.vue | 6 ++-- packages/client/src/ui/_common_/navbar.vue | 8 +++--- packages/client/src/ui/deck.vue | 2 +- packages/client/src/ui/deck/tl-column.vue | 7 ++--- 44 files changed, 186 insertions(+), 197 deletions(-) diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index 5844c5bd4..5859bdead 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -12,10 +12,6 @@ import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; export type Account = firefish.entities.MeDetailed; -export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator); -export const iAmAdmin = $i?.isAdmin; -export const iAmEmojiMod = iAmModerator || $i?.emojiModPerm !== "unauthorized"; - export async function signout() { waiting(); localStorage.removeItem("account"); diff --git a/packages/client/src/components/MkFollowButton.vue b/packages/client/src/components/MkFollowButton.vue index 50a2cc121..f52a685e6 100644 --- a/packages/client/src/components/MkFollowButton.vue +++ b/packages/client/src/components/MkFollowButton.vue @@ -8,7 +8,7 @@