commit a0d85c0673cf5e513089a4dffe9ccabcdf027af0
parent d0e42a1186d57a01f7533ae00daad64d18c92102
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 27 Apr 2018 18:58:12 -0400
Don't switch libraries when uneditable in /getSelectedCollection
Follow-up to d0e42a1186
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/connector/server_connector.js b/chrome/content/zotero/xpcom/connector/server_connector.js
@@ -27,17 +27,17 @@ const CONNECTOR_API_VERSION = 2;
Zotero.Server.Connector = {
_waitingForSelection: {},
- getSaveTarget: function () {
+ getSaveTarget: function (allowReadOnly) {
var zp = Zotero.getActiveZoteroPane();
var library = null;
var collection = null;
var editable = null;
if (zp && zp.collectionsView) {
- if (zp.collectionsView.editable) {
+ if (zp.collectionsView.editable || allowReadOnly) {
library = Zotero.Libraries.get(zp.getSelectedLibraryID());
collection = zp.getSelectedCollection();
- editable = true;
+ editable = zp.collectionsView.editable;
}
// If not editable, switch to My Library if it exists and is editable
else {
@@ -59,7 +59,7 @@ Zotero.Server.Connector = {
let id = Zotero.Prefs.get('lastViewedFolder');
if (id) {
({ library, collection, editable } = this.resolveTarget(id));
- if (!editable) {
+ if (!editable && !allowReadOnly) {
let userLibrary = Zotero.Libraries.userLibrary;
if (userLibrary && userLibrary.editable) {
Zotero.debug("Save target isn't editable -- switching to My Library");
@@ -1091,7 +1091,7 @@ Zotero.Server.Connector.GetSelectedCollection.prototype = {
* @param {Function} sendResponseCallback function to send HTTP response
*/
init: function(postData, sendResponseCallback) {
- var { library, collection, editable } = Zotero.Server.Connector.getSaveTarget();
+ var { library, collection, editable } = Zotero.Server.Connector.getSaveTarget(true);
var response = {
libraryID: library.libraryID,
libraryName: library.name,