commit 6cef1236628f5c0b7d6f9f5d9cbcda20e5f60c49 parent e5a5a8d303ead5f0df8b6372054083da92587d6e Author: Aurimas Vinckevicius <aurimas.dev@gmail.com> Date: Thu, 11 Jun 2015 00:46:02 -0500 Don't allow trashing items in read-only or "no trash" libraries Diffstat:
| M | chrome/content/zotero/xpcom/data/items.js | | | 9 | +++++++++ |
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/items.js b/chrome/content/zotero/xpcom/data/items.js @@ -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