From d3710f0872b8a0571bf0321aa98935acdc1c9408 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 21 Sep 2024 18:21:20 +0100 Subject: [PATCH 1/2] maybe fix #510 - try to not edit visibility the frontend part is pretty straightforward, the backend part is ugly but it shouldn't make things worse than they already are --- packages/backend/src/core/NoteEditService.ts | 8 +++++--- packages/frontend/src/components/MkPostForm.vue | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index 5ff0f26e2b..f42d14b466 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -247,6 +247,11 @@ export class NoteEditService implements OnApplicationShutdown { data.reply = undefined; } + // changing visibility on an edit is ill-defined, let's try to + // keep the same visibility as the original note + data.visibility = oldnote.visibility; + data.localOnly = oldnote.localOnly; + // チャンネル外にリプライしたら対象のスコープに合わせる // (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで) if (data.reply && data.channel && data.reply.channelId !== data.channel.id) { @@ -429,9 +434,6 @@ export class NoteEditService implements OnApplicationShutdown { if (data.cw !== oldnote.cw) { update.cw = data.cw; } - if (data.localOnly !== oldnote.localOnly) { - update.localOnly = data.localOnly; - } if (oldnote.hasPoll !== !!data.poll) { update.hasPoll = !!data.poll; } diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 2bc607fbb6..0afe184b90 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
- From 8b7482f9c0234112b1d80af349f389e02debd92e Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 3 Oct 2024 16:49:20 +0100 Subject: [PATCH 2/2] fix linting --- packages/frontend/src/components/MkPostForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 0afe184b90..dc3f3aa94c 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only