Properly test whether file syncing is enabled for a library
This commit is contained in:
parent
a8ea8656d2
commit
427234917d
3 changed files with 21 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue