Skip to content

Commit

Permalink
chore: improve withReplies toggle for list
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed May 27, 2024
1 parent 171a18e commit 401416e
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions packages/frontend/src/pages/my-lists/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 401416e

Please sign in to comment.