www

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

commit b09daebbde01fc2a0d36500eeb8e6e0ea6fc6a00
parent cb7070cc4eee31fa076cf927d5b929db63301073
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 30 Apr 2013 17:48:01 -0400

Don't try to upload files if no file editing access for library

This should fix https://forums.zotero.org/discussion/29149/ and probably
some other things.

Diffstat:
Mchrome/content/zotero/xpcom/data/libraries.js | 24++++++++++++++++++++++++
Mchrome/content/zotero/xpcom/storage.js | 11++++++++---
2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/libraries.js b/chrome/content/zotero/xpcom/data/libraries.js @@ -78,6 +78,9 @@ Zotero.Libraries = new function () { this.isEditable = function (libraryID) { var type = this.getType(libraryID); switch (type) { + case 'user': + return true; + case 'group': var groupID = Zotero.Groups.getGroupIDFromLibraryID(libraryID); var group = Zotero.Groups.get(groupID); @@ -87,4 +90,25 @@ Zotero.Libraries = new function () { throw ("Unsupported library type '" + type + "' in Zotero.Libraries.getName()"); } } + + + this.isFilesEditable = function (libraryID) { + if (!this.isEditable(libraryID)) { + return false; + } + + var type = this.getType(libraryID); + switch (type) { + case 'user': + return true; + + case 'group': + var groupID = Zotero.Groups.getGroupIDFromLibraryID(libraryID); + var group = Zotero.Groups.get(groupID); + return group.filesEditable; + + default: + throw ("Unsupported library type '" + type + "' in Zotero.Libraries.getName()"); + } + } } diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js @@ -263,9 +263,14 @@ Zotero.Sync.Storage = new function () { } // Get files to upload - for each(var itemID in _getFilesToUpload(libraryID)) { - var item = Zotero.Items.get(itemID); - self.queueItem(item); + if (Zotero.Libraries.isFilesEditable(libraryID)) { + for each(var itemID in _getFilesToUpload(libraryID)) { + var item = Zotero.Items.get(itemID); + self.queueItem(item); + } + } + else { + Zotero.debug("No file editing access -- skipping file uploads for library " + libraryID); } }