From ece3491e2114807364d3270467db06c0a5665eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Tue, 18 Jul 2017 17:13:22 +0300 Subject: [PATCH] Connector server: respond with collection editability status --- .../content/zotero/xpcom/server_connector.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js index c4ff74f718..8fd018ac78 100644 --- a/chrome/content/zotero/xpcom/server_connector.js +++ b/chrome/content/zotero/xpcom/server_connector.js @@ -348,16 +348,8 @@ Zotero.Server.Connector.SaveItem.prototype = { // My Library if present and editable, and otherwise fail var library = Zotero.Libraries.get(libraryID); if (!library.editable || library.libraryType == 'publications') { - let userLibrary = Zotero.Libraries.userLibrary; - if (userLibrary && userLibrary.editable) { - yield zp.collectionsView.selectLibrary(userLibrary.id); - libraryID = userLibrary.id; - collection = null; - } - else { - Zotero.logError("Can't add item to read-only library " + library.name); - return 500; - } + Zotero.logError("Can't add item to read-only library " + library.name); + return [500, "application/json", JSON.stringify({libraryEditable: false})]; } var cookieSandbox = data.uri @@ -729,8 +721,10 @@ Zotero.Server.Connector.GetSelectedCollection.prototype = { libraryID: libraryID }; - if(libraryID) { - response.libraryName = Zotero.Libraries.getName(libraryID); + if (libraryID) { + let library = Zotero.Libraries.get(libraryID); + response.libraryName = library.name; + response.libraryEditable = library.editable; } else { response.libraryName = Zotero.getString("pane.collections.library"); }