From 0bb5ac0fca67be31ba00438fa276df433cc7c42d Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Tue, 30 Jul 2024 19:55:18 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AD=E3=83=BC=E4=B8=AD?= =?UTF-8?q?=E3=81=AE=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AB=E9=96=A2?= =?UTF-8?q?=E3=81=99=E3=82=8B"TL=E3=81=AB=E4=BB=96=E3=81=AE=E4=BA=BA?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E8=BF=94=E4=BF=A1=E3=82=92=E5=90=AB=E3=82=81?= =?UTF-8?q?=E3=82=8B"=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=8C=E5=88=86?= =?UTF-8?q?=E3=81=8B=E3=82=8A=E3=81=A5=E3=82=89=E3=81=84=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=20(#13895)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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> --- CHANGELOG.md | 1 + packages/frontend/src/pages/my-lists/list.vue | 31 ++++++++++--------- .../frontend/src/scripts/get-user-menu.ts | 28 +++++++++-------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27308cb8bc..89d5ac214d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ - Fix: 照会に `#` から始まる文字列を入力してそのハッシュタグのページを表示する際、入力が `#` のみの場合に「指定されたURLに該当するページはありませんでした。」が表示されてしまう問題を修正 - Fix: 照会に `@` から始まる文字列を入力してユーザーを照会する際、入力が `@` のみの場合に「問題が発生しました」が表示されてしまう問題を修正 - Fix: 投稿フォームにノートのURLを貼り付けて"引用として添付"した場合、投稿文を空にすることによるRenote化が出来なかった問題を修正 +- Fix: フォロー中のユーザーに関する"TLに他の人への返信を含める"の設定が分かりづらい問題を修正 ### Server - Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949) diff --git a/packages/frontend/src/pages/my-lists/list.vue b/packages/frontend/src/pages/my-lists/list.vue index 7492b099ea..a2ceb222fe 100644 --- a/packages/frontend/src/pages/my-lists/list.vue +++ b/packages/frontend/src/pages/my-lists/list.vue @@ -133,22 +133,25 @@ async function removeUser(item, ev) { } async function showMembershipMenu(item, ev) { + const withRepliesRef = ref(item.withReplies); os.popupMenu([{ - text: item.withReplies ? i18n.ts.hideRepliesToOthersInTimeline : i18n.ts.showRepliesToOthersInTimeline, - icon: item.withReplies ? 'ti ti-messages-off' : 'ti ti-messages', - action: async () => { - misskeyApi('users/lists/update-membership', { - listId: list.value.id, - userId: item.userId, - withReplies: !item.withReplies, - }).then(() => { - paginationEl.value.updateItem(item.id, (old) => ({ - ...old, - withReplies: !item.withReplies, - })); - }); - }, + type: 'switch', + text: i18n.ts.showRepliesToOthersInTimeline, + icon: 'ti ti-messages', + ref: withRepliesRef, }], ev.currentTarget ?? ev.target); + watch(withRepliesRef, withReplies => { + misskeyApi('users/lists/update-membership', { + listId: list.value!.id, + userId: item.userId, + withReplies, + }).then(() => { + paginationEl.value!.updateItem(item.id, (old) => ({ + ...old, + withReplies, + })); + }); + }); } async function deleteList() { 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' }, {