diff options
| author | Amelia Yukii <amelia.yukii@shourai.de> | 2024-02-22 18:23:46 +0000 |
|---|---|---|
| committer | Amelia Yukii <amelia.yukii@shourai.de> | 2024-02-22 18:23:46 +0000 |
| commit | f26eb25a7879bdbd01f0069d0f5d65ff96b520af (patch) | |
| tree | 107d4728af2636734a5705a910f04ba9adf3102b /packages/backend/src/core/NoteEditService.ts | |
| parent | merge: Add fail safe for sponsors endpoint in case of not being able to conne... (diff) | |
| parent | some fixes for note edits (diff) | |
| download | sharkey-f26eb25a7879bdbd01f0069d0f5d65ff96b520af.tar.gz sharkey-f26eb25a7879bdbd01f0069d0f5d65ff96b520af.tar.bz2 sharkey-f26eb25a7879bdbd01f0069d0f5d65ff96b520af.zip | |
merge: some fixes for note edits (!437)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/437
Approved-by: Amelia Yukii <amelia.yukii@shourai.de>
Approved-by: Marie <marie@kaifa.ch>
Diffstat (limited to 'packages/backend/src/core/NoteEditService.ts')
| -rw-r--r-- | packages/backend/src/core/NoteEditService.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index 6a469c9634..e540abfcf0 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -241,6 +241,14 @@ export class NoteEditService implements OnApplicationShutdown { throw new Error('not the author'); } + // we never want to change the replyId, so fetch the original "parent" + if (oldnote.replyId) { + data.reply = await this.notesRepository.findOneBy({ id: oldnote.replyId }); + } + else { + data.reply = undefined; + } + // チャンネル外にリプライしたら対象のスコープに合わせる // (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで) if (data.reply && data.channel && data.reply.channelId !== data.channel.id) { @@ -435,7 +443,7 @@ export class NoteEditService implements OnApplicationShutdown { id: oldnote.id, updatedAt: data.updatedAt ? data.updatedAt : new Date(), fileIds: data.files ? data.files.map(file => file.id) : [], - replyId: data.reply ? data.reply.id : null, + replyId: oldnote.replyId, renoteId: data.renote ? data.renote.id : null, channelId: data.channel ? data.channel.id : null, threadId: data.reply |