Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: allow overwriting date edited of note content

thecodrrbbf05064e410
diff --git a/packages/core/api/sync/merger.js b/packages/core/api/sync/merger.js
index 10d837667..323fb9642 100644
--- a/packages/core/api/sync/merger.js
+++ b/packages/core/api/sync/merger.js
@@ -53,10 +53,8 @@ class Merger {
remoteItem = await this._deserialize(remoteItem);
if (!localItem) {
await add(remoteItem);
- } else if (!localItem.resolved && localItem.dateEdited > this._lastSynced) {
+ } else if (localItem.dateEdited > this._lastSynced) {
await resolve(localItem, remoteItem);
- } else if (localItem.resolved) {
- await add({ ...localItem, resolved: false });
} else {
await add(remoteItem);
}
diff --git a/packages/core/collections/content.js b/packages/core/collections/content.js
index e174c2a46..e5489a73d 100644
--- a/packages/core/collections/content.js
+++ b/packages/core/collections/content.js
@@ -21,12 +21,11 @@ export default class Content extends Collection {
id,
type: content.type,
data: content.data || content,
- conflicted: content.conflicted || false,
- resolved: !!content.resolved,
dateEdited: content.dateEdited,
dateCreated: content.dateCreated,
remote: content.remote,
localOnly: !!content.localOnly,
+ conflicted: content.conflicted,
});
return id;
}
diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js
index 6dd824781..3d5538607 100644
--- a/packages/core/collections/notes.js
+++ b/packages/core/collections/notes.js
@@ -55,7 +55,7 @@ export default class Notes extends Collection {
if (!oldNote && !noteArg.content && !noteArg.contentId) return;
if (noteArg.content && noteArg.content.data && noteArg.content.type) {
- const { type, data, conflicted, resolved } = noteArg.content;
+ const { type, data, conflicted, dateEdited, remote } = noteArg.content;
let content = getContentFromData(type, data);
if (!content) throw new Error("Invalid content type.");
@@ -75,9 +75,10 @@ export default class Notes extends Collection {
id: note.contentId,
type,
data,
- conflicted,
- resolved,
+ remote,
localOnly: !!note.localOnly,
+ dateEdited,
+ conflicted,
});
}
@@ -93,9 +94,8 @@ export default class Notes extends Collection {
color: note.color,
tags: note.tags || [],
favorite: !!note.favorite,
- dateCreated: note.dateCreated,
- conflicted: !!note.conflicted,
localOnly: !!note.localOnly,
+ conflicted: !!note.conflicted,
};
if (!oldNote || oldNote.deleted) {