Clear library storage version when resetting file sync history

Fixes #1753
This commit is contained in:
Dan Stillman 2024-12-10 00:59:04 -05:00
parent f3d274afeb
commit 404fc41b88
2 changed files with 9 additions and 3 deletions

View file

@ -291,10 +291,12 @@ Zotero.Library.prototype._set = function(prop, val) {
if (newVal != val) {
throw new Error(`${prop} must be an integer (${typeof val} '${val}' given)`);
}
// Ensure that it is never decreasing, unless it is being set to -1
// by Reset File Sync History
if (val != -1 && val < this._libraryStorageVersion) {
throw new Error(prop + ' cannot decrease');
}
val = newVal;
// Ensure that it is never decreasing
if (val < this._libraryStorageVersion) throw new Error(prop + ' cannot decrease');
break;
case '_libraryLastSync':

View file

@ -550,6 +550,10 @@ Zotero.Sync.Storage.Local = {
}
sql = "UPDATE itemAttachments SET syncState=? WHERE itemID IN (" + sql + ")";
await Zotero.DB.queryAsync(sql, [this.SYNC_STATE_TO_UPLOAD].concat(params));
var library = Zotero.Libraries.get(libraryID);
library.storageVersion = -1;
await library.save();
}.bind(this));
},