www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit ab959cd85865c3fc31baff0996bb54318d10af15
parent cf686c520afee814604fa6102d7ecdec3b4a120c
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 22 Dec 2016 10:00:40 -0500

Fix "Reset File Sync History"

Diffstat:
Mchrome/content/zotero/preferences/preferences_sync.js | 4++--
Mchrome/content/zotero/xpcom/storage/storageLocal.js | 3+--
Mtest/tests/storageLocalTest.js | 4++--
3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js @@ -408,7 +408,7 @@ Zotero_Preferences.Sync = { var newEnabled = document.getElementById('pref-storage-enabled').value; if (oldProtocol != newProtocol) { - yield Zotero.Sync.Storage.Local.resetModeSyncStates(oldProtocol); + yield Zotero.Sync.Storage.Local.resetAllSyncStates(); } if (oldProtocol == 'webdav') { @@ -751,7 +751,7 @@ Zotero_Preferences.Sync = { switch (index) { case 0: - Zotero.Sync.Storage.resetAllSyncStates(); + yield Zotero.Sync.Storage.Local.resetAllSyncStates(); ps.alert( null, "File Sync History Cleared", diff --git a/chrome/content/zotero/xpcom/storage/storageLocal.js b/chrome/content/zotero/xpcom/storage/storageLocal.js @@ -500,7 +500,7 @@ Zotero.Sync.Storage.Local = { * This is used when switching between storage modes in the preferences so that all existing files * are uploaded via the new mode if necessary. */ - resetModeSyncStates: Zotero.Promise.coroutine(function* () { + resetAllSyncStates: Zotero.Promise.coroutine(function* () { var sql = "SELECT itemID FROM items JOIN itemAttachments USING (itemID) " + "WHERE libraryID=? AND itemTypeID=? AND linkMode IN (?, ?)"; var params = [ @@ -514,7 +514,6 @@ Zotero.Sync.Storage.Local = { let item = Zotero.Items.get(itemID); item._attachmentSyncState = this.SYNC_STATE_TO_UPLOAD; } - sql = "UPDATE itemAttachments SET syncState=? WHERE itemID IN (" + sql + ")"; yield Zotero.DB.queryAsync(sql, [this.SYNC_STATE_TO_UPLOAD].concat(params)); }), diff --git a/test/tests/storageLocalTest.js b/test/tests/storageLocalTest.js @@ -102,14 +102,14 @@ describe("Zotero.Sync.Storage.Local", function () { }) }) - describe("#resetModeSyncStates()", function () { + describe("#resetAllSyncStates()", function () { it("should reset attachment sync states to 'to_upload'", function* () { var attachment = yield importFileAttachment('test.png'); attachment.attachmentSyncState = 'in_sync'; yield attachment.saveTx(); var local = Zotero.Sync.Storage.Local; - yield local.resetModeSyncStates() + yield local.resetAllSyncStates() assert.strictEqual(attachment.attachmentSyncState, local.SYNC_STATE_TO_UPLOAD); var state = yield Zotero.DB.valueQueryAsync( "SELECT syncState FROM itemAttachments WHERE itemID=?", attachment.id