diff options
| author | anatawa12 <anatawa12@icloud.com> | 2024-07-30 19:55:18 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-30 19:55:18 +0900 |
| commit | 0bb5ac0fca67be31ba00438fa276df433cc7c42d (patch) | |
| tree | c3c86f3c14f9a2c245efb95a28aa8b0ddefc209a /packages/frontend/src/scripts/get-user-menu.ts | |
| parent | test(#10336): add `components/Mk[D-E].*` stories (#14118) (diff) | |
| download | sharkey-0bb5ac0fca67be31ba00438fa276df433cc7c42d.tar.gz sharkey-0bb5ac0fca67be31ba00438fa276df433cc7c42d.tar.bz2 sharkey-0bb5ac0fca67be31ba00438fa276df433cc7c42d.zip | |
フォロー中のユーザーに関する"TLに他の人への返信を含める"の設定が分かりづらい問題を修正 (#13895)
* chore: improve withReplies toggle for user following
* chore: improve withReplies toggle for list
* docs(changelog): フォロー中のユーザーに関する"TLに他の人への返信を含める"の設定が分かりづらい問題を修正
* Fix CHANGELOG.md
* docs(changelog): update insertion position
---------
Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/scripts/get-user-menu.ts')
| -rw-r--r-- | packages/frontend/src/scripts/get-user-menu.ts | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/packages/frontend/src/scripts/get-user-menu.ts b/packages/frontend/src/scripts/get-user-menu.ts index e9e7ae771d..33f16a68aa 100644 --- a/packages/frontend/src/scripts/get-user-menu.ts +++ b/packages/frontend/src/scripts/get-user-menu.ts @@ -17,6 +17,7 @@ import { notesSearchAvailable, canSearchNonLocalNotes } from '@/scripts/check-pe import { IRouter } from '@/nirax.js'; import { antennasCache, rolesCache, userListsCache } from '@/cache.js'; import { mainRouter } from '@/router/main.js'; +import { MenuItem } from '@/types/menu.js'; export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter = mainRouter) { const meId = $i ? $i.id : null; @@ -82,15 +83,6 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter }); } - async function toggleWithReplies() { - os.apiWithDialog('following/update', { - userId: user.id, - withReplies: !user.withReplies, - }).then(() => { - user.withReplies = !user.withReplies; - }); - } - async function toggleNotify() { os.apiWithDialog('following/update', { userId: user.id, @@ -155,7 +147,7 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter }); } - let menu = [{ + let menu: MenuItem[] = [{ icon: 'ti ti-at', text: i18n.ts.copyUsername, action: () => { @@ -314,15 +306,25 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter // フォローしたとしても user.isFollowing はリアルタイム更新されないので不便なため //if (user.isFollowing) { + const withRepliesRef = ref(user.withReplies); menu = menu.concat([{ - icon: user.withReplies ? 'ti ti-messages-off' : 'ti ti-messages', - text: user.withReplies ? i18n.ts.hideRepliesToOthersInTimeline : i18n.ts.showRepliesToOthersInTimeline, - action: toggleWithReplies, + type: 'switch', + icon: 'ti ti-messages', + text: i18n.ts.showRepliesToOthersInTimeline, + ref: withRepliesRef, }, { icon: user.notify === 'none' ? 'ti ti-bell' : 'ti ti-bell-off', text: user.notify === 'none' ? i18n.ts.notifyNotes : i18n.ts.unnotifyNotes, action: toggleNotify, }]); + watch(withRepliesRef, (withReplies) => { + misskeyApi('following/update', { + userId: user.id, + withReplies, + }).then(() => { + user.withReplies = withReplies; + }); + }); //} menu = menu.concat([{ type: 'divider' }, { |