Update some deprecated function calls

This commit is contained in:
Dan Stillman 2016-10-26 02:27:31 -04:00
parent ff9e822bd3
commit da7da74986
7 changed files with 14 additions and 12 deletions

View file

@ -755,7 +755,7 @@ Zotero.DataObject.prototype._clearFieldChange = function (field) {
Zotero.DataObject.prototype.isEditable = function () {
return Zotero.Libraries.isEditable(this.libraryID);
return Zotero.Libraries.get(this.libraryID).editable;
}
@ -772,7 +772,7 @@ Zotero.DataObject.prototype.editCheck = function () {
if (!this.isEditable()) {
throw new Error("Cannot edit " + this._objectType + " in read-only library "
+ Zotero.Libraries.getName(this.libraryID));
+ Zotero.Libraries.get(this.libraryID).name);
}
}

View file

@ -861,12 +861,12 @@ Zotero.DataObjects.prototype.isEditable = function (obj) {
return true;
}
if (!Zotero.Libraries.isEditable(libraryID)) return false;
if (!Zotero.Libraries.get(libraryID).editable) return false;
if (obj.objectType == 'item' && obj.isAttachment()
&& (obj.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL ||
obj.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE)
&& !Zotero.Libraries.isFilesEditable(libraryID)
&& !Zotero.Libraries.get(libraryID).filesEditable(libraryID)
) {
return false;
}

View file

@ -1211,7 +1211,7 @@ Zotero.Item.prototype.isEditable = function() {
if (this.isAttachment()
&& (this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL ||
this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE)
&& !Zotero.Libraries.isFilesEditable(this.libraryID)
&& !Zotero.Libraries.get(this.libraryID).filesEditable
) {
return false;
}

View file

@ -135,8 +135,10 @@ Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function*
yield this.library.saveTx();
}
var filesEditable = Zotero.Libraries.get(libraryID).filesEditable;
// Check for updated files to upload
if (!Zotero.Libraries.isFilesEditable(libraryID)) {
if (!filesEditable) {
Zotero.debug("No file editing access -- skipping file modification check for "
+ this.library.name);
}
@ -189,7 +191,7 @@ Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function*
}
// Get files to upload
if (Zotero.Libraries.isFilesEditable(libraryID)) {
if (filesEditable) {
let itemIDs = yield this.local.getFilesToUpload(libraryID);
if (itemIDs.length) {
Zotero.debug(itemIDs.length + " file" + (itemIDs.length == 1 ? '' : 's') + " to "

View file

@ -677,7 +677,7 @@ Zotero.Sync.Data.Local = {
var objectsClass = Zotero.DataObjectUtilities.getObjectsClassForObjectType(objectType);
var objectTypePlural = Zotero.DataObjectUtilities.getObjectTypePlural(objectType);
var ObjectType = Zotero.Utilities.capitalize(objectType);
var libraryName = Zotero.Libraries.getName(libraryID);
var libraryName = Zotero.Libraries.get(libraryID).name;
var knownErrors = [
'ZoteroUnknownTypeError',

View file

@ -48,7 +48,7 @@ Zotero.Translate.ItemSaver = function(options) {
this._collections = options.collections || false;
// If group filesEditable==false, don't save attachments
this.attachmentMode = Zotero.Libraries.isFilesEditable(this._libraryID) ? options.attachmentMode :
this.attachmentMode = Zotero.Libraries.get(this._libraryID).filesEditable ? options.attachmentMode :
Zotero.Translate.ItemSaver.ATTACHMENT_MODE_IGNORE;
this._forceTagType = options.forceTagType;
this._cookieSandbox = options.cookieSandbox;

View file

@ -1318,7 +1318,7 @@ var ZoteroPane = new function()
// If a trash is selected, new collection depends on the
// editability of the library
if (collectionTreeRow.isTrash() && command == 'cmd_zotero_newCollection') {
var overrideEditable = Zotero.Libraries.isEditable(collectionTreeRow.ref.libraryID);
var overrideEditable = Zotero.Libraries.get(collectionTreeRow.ref.libraryID).editable;
}
else {
var overrideEditable = false;
@ -3753,7 +3753,7 @@ var ZoteroPane = new function()
}
itemType = Zotero.ItemTypes.getID(itemType);
var item = yield this.newItem(itemType, data, row);
var filesEditable = Zotero.Libraries.isFilesEditable(item.libraryID);
var filesEditable = Zotero.Libraries.get(item.libraryID).filesEditable;
if (saveSnapshot) {
var link = false;
@ -3867,7 +3867,7 @@ var ZoteroPane = new function()
}
var item = yield ZoteroPane_Local.newItem(itemType, {}, row)
var filesEditable = Zotero.Libraries.isFilesEditable(item.libraryID);
var filesEditable = Zotero.Libraries.get(item.libraryID).filesEditable;
// Save snapshot if explicitly enabled or automatically pref is set and not explicitly disabled
if (saveSnapshot || (saveSnapshot !== false && Zotero.Prefs.get('automaticSnapshots'))) {