Skip to content

Commit

Permalink
Connector server: respond with collection editability status
Browse files Browse the repository at this point in the history
  • Loading branch information
adomasven committed Jul 19, 2017
1 parent cd35962 commit ece3491
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions chrome/content/zotero/xpcom/server_connector.js
Expand Up @@ -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
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit ece3491

Please sign in to comment.