From 0719d9abbcf645d704a79d5decd7381101544ff3 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sat, 30 Sep 2023 17:55:17 +0200 Subject: [PATCH] [client] Clean up note edits --- packages/client/src/components/MkPostForm.vue | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index 60b51051e..017f21ab1 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -727,7 +727,7 @@ async function onPaste(ev: ClipboardEvent) { const paste = ev.clipboardData.getData("text"); - if (!props.renote && !quoteId && paste.startsWith(url + "/notes/")) { + if (!props.renote && !quoteId && paste.startsWith(url + "/notes/") && !props.editId) { ev.preventDefault(); os.yesno({ @@ -828,26 +828,33 @@ function deleteDraft() { async function post() { const processedText = preprocess(text); - let postData = { - editId: props.editId ? props.editId : undefined, - text: processedText === "" ? undefined : processedText, - fileIds: files.length > 0 ? files.map((f) => f.id) : undefined, - replyId: props.reply ? props.reply.id : undefined, - renoteId: props.renote - ? props.renote.id - : quoteId - ? quoteId - : undefined, - channelId: props.channel ? props.channel.id : undefined, - poll: poll, - cw: useCw ? cw || "" : undefined, - localOnly: localOnly, - visibility: visibility, - visibleUserIds: - visibility === "specified" - ? visibleUsers.map((u) => u.id) + let postData = props.editId + ? { + editId: props.editId, + text: processedText === "" ? undefined : processedText, + fileIds: files.length > 0 ? files.map((f) => f.id) : undefined, + poll: poll, + cw: useCw ? cw || "" : undefined, + } + : { + text: processedText === "" ? undefined : processedText, + fileIds: files.length > 0 ? files.map((f) => f.id) : undefined, + replyId: props.reply ? props.reply.id : undefined, + renoteId: props.renote + ? props.renote.id + : quoteId + ? quoteId : undefined, - }; + channelId: props.channel ? props.channel.id : undefined, + poll: poll, + cw: useCw ? cw || "" : undefined, + localOnly: localOnly, + visibility: visibility, + visibleUserIds: + visibility === "specified" + ? visibleUsers.map((u) => u.id) + : undefined, + }; if (withHashtags && hashtags && hashtags.trim() !== "") { const hashtags_ = hashtags