summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteEditService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2023-11-02 14:28:23 +0000
committerdakkar <dakkar@thenautilus.net>2023-11-02 14:28:23 +0000
commit219c7fa6ec0abaf8ea12086aab2baf1d82bdc71f (patch)
tree701c86578ca5271793feb7a5fc97148a72651482 /packages/backend/src/core/NoteEditService.ts
parentupd: remove footerspacer from settings (diff)
downloadsharkey-219c7fa6ec0abaf8ea12086aab2baf1d82bdc71f.tar.gz
sharkey-219c7fa6ec0abaf8ea12086aab2baf1d82bdc71f.tar.bz2
sharkey-219c7fa6ec0abaf8ea12086aab2baf1d82bdc71f.zip
always preserve old text when editing a note
before this change: * create a note, with text * `note` has a row with the text * `note_edit` doesn't have any matching row * edit the note, removing all the text * the row in `note` has the new, empty, text * `note_edit` has a matching row, but its `oldText` is NULL so the original text is lost after this change, the row in `note_edit` always keeps the previous text
Diffstat (limited to 'packages/backend/src/core/NoteEditService.ts')
-rw-r--r--packages/backend/src/core/NoteEditService.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts
index 1961fe72ee..3cbf975e56 100644
--- a/packages/backend/src/core/NoteEditService.ts
+++ b/packages/backend/src/core/NoteEditService.ts
@@ -393,7 +393,7 @@ export class NoteEditService implements OnApplicationShutdown {
await this.noteEditRepository.insert({
id: this.idService.gen(),
noteId: oldnote.id,
- oldText: update.text ? oldnote.text : undefined,
+ oldText: oldnote.text || undefined,
newText: update.text || undefined,
cw: update.cw || undefined,
fileIds: undefined,