From 0c6f779aab7b8bcf947b1c2e399da832a936b72a Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 8 Jun 2023 15:09:10 +0100 Subject: [PATCH] Desktop: Fixes #8287: Duplicated published notes retain the published note's label's color --- packages/lib/models/Note.ts | 9 ++++++++- packages/lib/models/Resource.ts | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/lib/models/Note.ts b/packages/lib/models/Note.ts index 0a0d33ee3..64f811a87 100644 --- a/packages/lib/models/Note.ts +++ b/packages/lib/models/Note.ts @@ -622,7 +622,14 @@ export default class Note extends BaseItem { if (!originalNote) throw new Error(`Unknown note: ${noteId}`); const newNote = { ...originalNote }; - const fieldsToReset = ['id', 'created_time', 'updated_time', 'user_created_time', 'user_updated_time']; + const fieldsToReset = [ + 'id', + 'created_time', + 'updated_time', + 'user_created_time', + 'user_updated_time', + 'is_shared', + ]; for (const field of fieldsToReset) { delete (newNote as any)[field]; diff --git a/packages/lib/models/Resource.ts b/packages/lib/models/Resource.ts index 6cb8083b3..b3eda097f 100644 --- a/packages/lib/models/Resource.ts +++ b/packages/lib/models/Resource.ts @@ -380,8 +380,9 @@ export default class Resource extends BaseItem { const resource = await Resource.load(resourceId); const localState = await Resource.localState(resource); - let newResource = { ...resource }; + let newResource: ResourceEntity = { ...resource }; delete newResource.id; + delete newResource.is_shared; newResource = await Resource.save(newResource); const newLocalState = { ...localState };