diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js index de50bcc38..759a5b8e2 100644 --- a/chrome/content/zotero/preferences/preferences_sync.js +++ b/chrome/content/zotero/preferences/preferences_sync.js @@ -494,7 +494,7 @@ Zotero_Preferences.Sync = { }, - handleSyncReset: function (action) { + handleSyncReset: Zotero.Promise.coroutine(function* (action) { var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); @@ -509,9 +509,44 @@ Zotero_Preferences.Sync = { return; } - var account = Zotero.Sync.Server.username; - switch (action) { + case 'full-sync': + var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) + + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL) + + ps.BUTTON_POS_1_DEFAULT; + var index = ps.confirmEx( + null, + // TODO: localize + Zotero.getString('general.warning'), + "Zotero will compare all local and remote data and merge any data that does not " + + "exist in both locations.\n\n" + + "This option is not necessary during normal usage and should " + + "generally be used only to troubleshoot specific issues as recommended " + + "by Zotero support staff.", + buttonFlags, + "Sync", + null, null, null, {} + ); + + switch (index) { + case 0: + let libraries = Zotero.Libraries.getAll().filter(library => library.syncable); + yield Zotero.DB.executeTransaction(function* () { + for (let library of libraries) { + library.libraryVersion = -1; + yield library.save(); + } + }); + yield Zotero.Sync.Runner.sync(); + break; + + // Cancel + case 1: + return; + } + + break; + case 'restore-from-server': var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING) + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL) @@ -659,5 +694,5 @@ Zotero_Preferences.Sync = { default: throw ("Invalid action '" + action + "' in handleSyncReset()"); } - } + }) }; diff --git a/chrome/content/zotero/preferences/preferences_sync.xul b/chrome/content/zotero/preferences/preferences_sync.xul index 57b5b6987..88b2f426a 100644 --- a/chrome/content/zotero/preferences/preferences_sync.xul +++ b/chrome/content/zotero/preferences/preferences_sync.xul @@ -282,6 +282,7 @@ + + + + + + diff --git a/chrome/content/zotero/xpcom/sync/syncEngine.js b/chrome/content/zotero/xpcom/sync/syncEngine.js index da0fb18fb..82306cc8d 100644 --- a/chrome/content/zotero/xpcom/sync/syncEngine.js +++ b/chrome/content/zotero/xpcom/sync/syncEngine.js @@ -1160,8 +1160,8 @@ Zotero.Sync.Data.Engine.prototype._upgradeCheck = Zotero.Promise.coroutine(funct * Perform a full sync * * Get all object versions from the API and compare to the local database. If any objects are - * missing or outdated and not up-to-date in the sync cache, download them. If any local objects - * are marked as synced but aren't available remotely, mark them as unsynced for later uploading. + * missing or outdated, download them. If any local objects are marked as synced but aren't available + * remotely, mark them as unsynced for later uploading. * * (Technically this isn't a full sync on its own, because local objects are only flagged for later * upload.) diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd index 2e386e96d..df99093f8 100644 --- a/chrome/locale/en-US/zotero/preferences.dtd +++ b/chrome/locale/en-US/zotero/preferences.dtd @@ -77,8 +77,8 @@ - - + +