From 2f5c51c1ca5e9726a590211416796a772beb9511 Mon Sep 17 00:00:00 2001 From: ShittyKopper Date: Mon, 27 Nov 2023 22:12:20 +0300 Subject: [PATCH] fix: don't load text of empty draft this fixes a small ux quirk where blanking a reply and cancelling it results in an empty reply next time you try to reply to that note, accidentally un-tagging everyone --- packages/frontend/src/components/MkPostForm.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index c9784fc40..a209128d5 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -923,12 +923,19 @@ onMounted(() => { if (!props.instant && !props.mention && !props.specified && !props.mock) { const draft = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}')[draftKey.value]; if (draft) { - text.value = draft.data.text; + if (typeof draft.data.text === 'string' && draft.data.text.trim()) { + text.value = draft.data.text; + } + + if (typeof draft.data.cw === 'string' && draft.data.cw.trim()) { + cw.value = draft.data.cw; + } + useCw.value = draft.data.useCw; - cw.value = draft.data.cw; visibility.value = draft.data.visibility; localOnly.value = draft.data.localOnly; files.value = (draft.data.files || []).filter(draftFile => draftFile); + if (draft.data.poll) { poll.value = draft.data.poll; }