mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
core: fix restored attachments not syncing
This commit is contained in:
committed by
Abdullah Atta
parent
9e30ee50b8
commit
2eded71de3
@@ -269,10 +269,6 @@ export default class Backup {
|
||||
? "color"
|
||||
: item.itemType || item.type;
|
||||
|
||||
// items should sync immediately after getting restored
|
||||
item.dateModified = Date.now();
|
||||
item.synced = false;
|
||||
|
||||
if (itemType === "attachment" && item.metadata && item.metadata.hash) {
|
||||
const attachment = this._db.attachments.attachment(item.metadata.hash);
|
||||
if (attachment) {
|
||||
@@ -280,21 +276,6 @@ export default class Backup {
|
||||
item.metadata.type === "application/octet-stream";
|
||||
const isOldGeneric =
|
||||
attachment.metadata.type === "application/octet-stream";
|
||||
console.log(
|
||||
"[before restore] attachment hash:",
|
||||
item.metadata.hash,
|
||||
"incoming mime type:",
|
||||
item.metadata.type,
|
||||
"current mime type:",
|
||||
attachment.metadata.type
|
||||
);
|
||||
this.logger.debug("[before restore]", {
|
||||
hash: item.metadata.hash,
|
||||
incomingType: item.metadata.type,
|
||||
currentType: attachment.metadata.type,
|
||||
isOldGeneric,
|
||||
isNewGeneric
|
||||
});
|
||||
item = {
|
||||
...attachment,
|
||||
metadata: {
|
||||
@@ -312,22 +293,16 @@ export default class Backup {
|
||||
},
|
||||
noteIds: setManipulator.union(attachment.noteIds, item.noteIds)
|
||||
};
|
||||
console.log(
|
||||
"[after restore] attachment hash:",
|
||||
item.metadata.hash,
|
||||
"mime type:",
|
||||
item.metadata.type
|
||||
);
|
||||
this.logger.debug("[after restore]", {
|
||||
hash: item.metadata.hash,
|
||||
type: item.metadata.type
|
||||
});
|
||||
} else {
|
||||
item.dateUploaded = undefined;
|
||||
item.failed = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// items should sync immediately after getting restored
|
||||
item.dateModified = Date.now();
|
||||
item.synced = false;
|
||||
|
||||
const collectionKey = itemTypeToCollectionKey[itemType];
|
||||
if (collectionKey) {
|
||||
toAdd[collectionKey] = toAdd[collectionKey] || [];
|
||||
|
||||
Reference in New Issue
Block a user