www

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

commit 85c0c086d5f3d8ae5ecfd9594c46a2c71427a4b3
parent c9c5e40e952b36f0f79828edff9186a22cddaa29
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sun, 10 Apr 2016 05:19:01 -0400

Disable Restore to/from Zotero Server and add back Full Sync

Restore to/from will need to be reimplemented for API syncing (#914)

Closes #916

Diffstat:
Mchrome/content/zotero/preferences/preferences_sync.js | 43+++++++++++++++++++++++++++++++++++++++----
Mchrome/content/zotero/preferences/preferences_sync.xul | 9+++++++++
Mchrome/content/zotero/xpcom/sync/syncEngine.js | 4++--
Mchrome/locale/en-US/zotero/preferences.dtd | 4++--
4 files changed, 52 insertions(+), 8 deletions(-)

diff --git 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 @@ -282,6 +282,7 @@ </columns> <rows> + <!-- <row id="zotero-restore-from-server" selected="true"> <radio/> <vbox onclick="this.previousSibling.click()"> @@ -297,6 +298,14 @@ <description>&zotero.preferences.sync.reset.restoreToServer.desc;</description> </vbox> </row> + --> + <row id="zotero-full-sync"> + <radio/> + <vbox onclick="this.previousSibling.click()"> + <label value="&zotero.preferences.sync.reset.fullSync;"/> + <description>&zotero.preferences.sync.reset.fullSync.desc;</description> + </vbox> + </row> </rows> </grid> diff --git 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 @@ -77,8 +77,8 @@ <!ENTITY zotero.preferences.sync.reset.warning1 "The following operations are for use only in rare, specific situations and should not be used for general troubleshooting. In many cases, resetting will cause additional problems. See "> <!ENTITY zotero.preferences.sync.reset.warning2 "Sync Reset Options"> <!ENTITY zotero.preferences.sync.reset.warning3 " for more information."> -<!ENTITY zotero.preferences.sync.reset.fullSync "Full Sync with Zotero Server"> -<!ENTITY zotero.preferences.sync.reset.fullSync.desc "Merge local Zotero data with data from the sync server, ignoring sync history."> +<!ENTITY zotero.preferences.sync.reset.fullSync "Full Sync"> +<!ENTITY zotero.preferences.sync.reset.fullSync.desc "Merge local data with data from server, ignoring sync history."> <!ENTITY zotero.preferences.sync.reset.restoreFromServer "Restore from Zotero Server"> <!ENTITY zotero.preferences.sync.reset.restoreFromServer.desc "Erase all local Zotero data and restore from the sync server."> <!ENTITY zotero.preferences.sync.reset.restoreToServer "Restore to Zotero Server">