Don't keep trying to auto-sync if manual sync required

This commit is contained in:
Dan Stillman 2009-12-08 21:08:20 +00:00
parent 5b84dfe6d0
commit afbf22240a
2 changed files with 11 additions and 2 deletions
chrome/content/zotero

View file

@ -388,7 +388,7 @@
</hbox> </hbox>
<toolbarbutton id="zotero-tb-sync-warning" hidden="true"/> <toolbarbutton id="zotero-tb-sync-warning" hidden="true"/>
<toolbarbutton id="zotero-tb-sync" class="zotero-tb-button" tooltip="_child" <toolbarbutton id="zotero-tb-sync" class="zotero-tb-button" tooltip="_child"
oncommand="Zotero.Sync.Server.canAutoResetClient = true; Zotero.Sync.Runner.sync()"> oncommand="Zotero.Sync.Server.canAutoResetClient = true; Zotero.Sync.Server.manualSyncRequired = false; Zotero.Sync.Runner.sync()">
<tooltip <tooltip
id="zotero-tb-sync-tooltip" id="zotero-tb-sync-tooltip"
onpopupshowing="Zotero.Sync.Runner.registerSyncStatusLabel(this.firstChild.nextSibling)" onpopupshowing="Zotero.Sync.Runner.registerSyncStatusLabel(this.firstChild.nextSibling)"

View file

@ -668,6 +668,12 @@ Zotero.Sync.Runner = new function () {
Zotero.debug('Sync already in progress -- skipping auto-sync', 4); Zotero.debug('Sync already in progress -- skipping auto-sync', 4);
return; return;
} }
if (Zotero.Sync.Server.manualSyncRequired) {
Zotero.debug('Manual sync required -- skipping auto-sync', 4);
return;
}
Zotero.Sync.Runner.sync(background); Zotero.Sync.Runner.sync(background);
} }
} }
@ -1097,6 +1103,8 @@ Zotero.Sync.Server = new function () {
}); });
this.canAutoResetClient = true;
this.manualSyncRequired = false;
this.nextLocalSyncDate = false; this.nextLocalSyncDate = false;
this.apiVersion = 6; this.apiVersion = 6;
@ -1113,7 +1121,6 @@ Zotero.Sync.Server = new function () {
var _sessionID; var _sessionID;
var _throttleTimeout; var _throttleTimeout;
var _checkTimer; var _checkTimer;
var _canAutoResetClient = true;
var _callbacks = { var _callbacks = {
onSuccess: function () { onSuccess: function () {
@ -2690,6 +2697,8 @@ Zotero.Sync.Server.Data = new function() {
// //
if (toReconcile.length) { if (toReconcile.length) {
if (Zotero.Sync.Runner.background) { if (Zotero.Sync.Runner.background) {
Zotero.Sync.Server.manualSyncRequired = true;
// TODO: localize // TODO: localize
throw ("An automatic sync resulted in a conflict that requires manual intervention.\n\nClick the sync icon to sync manually."); throw ("An automatic sync resulted in a conflict that requires manual intervention.\n\nClick the sync icon to sync manually.");
} }