Some libraryID follow-ups
This commit is contained in:
parent
d50b6667f0
commit
417335baf2
2 changed files with 14 additions and 30 deletions
|
@ -146,9 +146,16 @@ Zotero.API = {
|
|||
|
||||
|
||||
getLibraryPrefix: function (libraryID) {
|
||||
return libraryID
|
||||
? 'groups/' + Zotero.Groups.getGroupIDFromLibraryID(libraryID)
|
||||
: 'library';
|
||||
switch (Zotero.Libraries.getType(libraryID)) {
|
||||
case 'user':
|
||||
return 'library';
|
||||
|
||||
case 'publications':
|
||||
return 'publications';
|
||||
|
||||
case 'groups':
|
||||
return 'groups/' + Zotero.Groups.getGroupIDFromLibraryID(libraryID);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1155,13 +1155,7 @@ var ZoteroPane = new function()
|
|||
// editability of the library
|
||||
if (collectionTreeRow.isTrash() &&
|
||||
disableIfNoEdit[i] == 'cmd_zotero_newCollection') {
|
||||
if (collectionTreeRow.ref.libraryID) {
|
||||
var overrideEditable =
|
||||
Zotero.Libraries.isEditable(collectionTreeRow.ref.libraryID);
|
||||
}
|
||||
else {
|
||||
var overrideEditable = true;
|
||||
}
|
||||
var overrideEditable = Zotero.Libraries.isEditable(collectionTreeRow.ref.libraryID);
|
||||
}
|
||||
else {
|
||||
var overrideEditable = false;
|
||||
|
@ -3360,14 +3354,7 @@ var ZoteroPane = new function()
|
|||
}
|
||||
itemType = Zotero.ItemTypes.getID(itemType);
|
||||
var item = yield this.newItem(itemType, data, row);
|
||||
|
||||
if (item.libraryID) {
|
||||
var group = Zotero.Groups.getByLibraryID(item.libraryID);
|
||||
var filesEditable = group.filesEditable;
|
||||
}
|
||||
else {
|
||||
var filesEditable = true;
|
||||
}
|
||||
var filesEditable = Zotero.Libraries.isFilesEditable(item.libraryID);
|
||||
|
||||
if (saveSnapshot) {
|
||||
var link = false;
|
||||
|
@ -3481,13 +3468,7 @@ var ZoteroPane = new function()
|
|||
}
|
||||
|
||||
var item = yield ZoteroPane_Local.newItem(itemType, {}, row)
|
||||
if (item.libraryID) {
|
||||
var group = Zotero.Groups.getByLibraryID(item.libraryID);
|
||||
filesEditable = group.filesEditable;
|
||||
}
|
||||
else {
|
||||
filesEditable = true;
|
||||
}
|
||||
var filesEditable = Zotero.Libraries.isFilesEditable(item.libraryID);
|
||||
|
||||
// Save snapshot if explicitly enabled or automatically pref is set and not explicitly disabled
|
||||
if (saveSnapshot || (saveSnapshot !== false && Zotero.Prefs.get('automaticSnapshots'))) {
|
||||
|
@ -3816,12 +3797,8 @@ var ZoteroPane = new function()
|
|||
}
|
||||
|
||||
var collectionTreeRow = this.collectionsView.getRow(row);
|
||||
// TODO: isEditable for user library should just return true
|
||||
if (collectionTreeRow.ref.libraryID) {
|
||||
return Zotero.Libraries.isEditable(collectionTreeRow.ref.libraryID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue