Don't allow trashing items in read-only or "no trash" libraries

This commit is contained in:
Aurimas Vinckevicius 2015-06-11 00:46:02 -05:00
parent e5a5a8d303
commit 6cef123662

View File

@ -503,6 +503,15 @@ Zotero.Items = function() {
Zotero.Notifier.queue('delete', 'item', id);
continue;
}
if (!item.isEditable()) {
throw new Error(item._ObjectType + " (" + item.id + ") is not editable");
}
if (!Zotero.Libraries.hasTrash(item.libraryID)) {
throw new Error(Zotero.Libraries.getName(item.libraryID) + " does not have Trash");
}
item.deleted = true;
yield item.save({
skipDateModifiedUpdate: true