www

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

commit 427234917d36f072bbcdd61b6c4518735f1b3fab
parent a8ea8656d267ed641f67c108d0e8d456089f6ab5
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sun, 15 May 2016 04:21:51 -0400

Properly test whether file syncing is enabled for a library

Diffstat:
Mchrome/content/zotero/xpcom/storage/storageEngine.js | 2+-
Mchrome/content/zotero/xpcom/storage/storageLocal.js | 18++++++++++++++++++
Mchrome/content/zotero/zoteroPane.js | 3++-
3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/storage/storageEngine.js b/chrome/content/zotero/xpcom/storage/storageEngine.js @@ -77,7 +77,7 @@ Zotero.Sync.Storage.Engine = function (options) { Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function* () { var libraryID = this.libraryID; - if (!Zotero.Prefs.get("sync.storage.enabled")) { + if (!Zotero.Sync.Storage.Local.getEnabledForLibrary(libraryID)) { Zotero.debug("File sync is not enabled for " + this.library.name); return false; } diff --git a/chrome/content/zotero/xpcom/storage/storageLocal.js b/chrome/content/zotero/xpcom/storage/storageLocal.js @@ -12,6 +12,24 @@ Zotero.Sync.Storage.Local = { lastFullFileCheck: {}, uploadCheckFiles: [], + getEnabledForLibrary: function (libraryID) { + var libraryType = Zotero.Libraries.get(libraryID).libraryType; + switch (libraryType) { + case 'user': + case 'publications': + return Zotero.Prefs.get("sync.storage.enabled"); + + case 'group': + return Zotero.Prefs.get("sync.storage.groups.enabled"); + + case 'feed': + return false; + + default: + throw new Error(`Unexpected library type '${libraryType}'`); + } + }, + getClassForLibrary: function (libraryID) { return Zotero.Sync.Storage.Utilities.getClassForMode(this.getModeForLibrary(libraryID)); }, diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -3936,7 +3936,8 @@ var ZoteroPane = new function() } else { if (!item.isImportedAttachment() - || !Zotero.Sync.Storage.Local.downloadAsNeeded(item.libraryID)) { + || (!Zotero.Sync.Storage.Local.getEnabledForLibrary(item.libraryID) + || !Zotero.Sync.Storage.Local.downloadAsNeeded(item.libraryID))) { this.showAttachmentNotFoundDialog(itemID, noLocateOnMissing); return; }