From e9e877f64e83bf34f90373a366567b852d3cce18 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Tue, 16 Apr 2024 13:37:14 +0900 Subject: fix: ダイレクト投稿の宛先が保存されない (#13717) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: ダイレクト投稿の宛先が保存されない * fix: 同じユーザーが複数回宛先に追加できる問題 * fix: 関係ないユーザーが宛先に追加される可能性がある --- packages/frontend/src/components/MkPostForm.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'packages/frontend/src/components/MkPostForm.vue') diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 014b866fbd..d7efca9de9 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -388,7 +388,7 @@ function addMissingMention() { for (const x of extractMentions(ast)) { if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) { misskeyApi('users/show', { username: x.username, host: x.host }).then(user => { - visibleUsers.value.push(user); + pushVisibleUser(user); }); } } @@ -679,6 +679,7 @@ function saveDraft() { localOnly: localOnly.value, files: files.value, poll: poll.value, + visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(x => x.id) : undefined, }, }; @@ -960,6 +961,15 @@ onMounted(() => { if (draft.data.poll) { poll.value = draft.data.poll; } + if (draft.data.visibleUserIds) { + misskeyApi('users/show', { userIds: draft.data.visibleUserIds }).then(users => { + for (let i = 0; i < users.length; i++) { + if (users[i].id === draft.data.visibleUserIds[i]) { + pushVisibleUser(users[i]); + } + } + }); + } } } -- cgit v1.2.3-freya