core: always keep remote attachment if it is newer

This commit is contained in:
Abdullah Atta
2023-09-06 11:16:53 +05:00
parent 89189d52ae
commit 6abb6207c5

View File

@@ -39,6 +39,9 @@ export default class Attachments extends Collection {
merge(localAttachment, remoteAttachment) {
if (remoteAttachment.deleted) return remoteAttachment;
if (remoteAttachment.dateModified > localAttachment.dateModified)
return remoteAttachment;
if (localAttachment && localAttachment.noteIds) {
remoteAttachment.noteIds = setManipulator.union(
remoteAttachment.noteIds,