Disallow unowned group annotation edits, but allow deletions
Update `DataObject::isEditable()` to take an optional `op` argument to test individual operations as opposed to general library editing. Erasing objects now tests `erase`, and `Item::isEditable()` allows `erase` for unowned group annotations while disallowing the default `edit`. It's still up to the reader to handle this appropriately in the UI and not allow operations it shouldn't, but this enforces it in the data layer.
This commit is contained in:
parent
9de86a3db8
commit
df64a16b55
4 changed files with 113 additions and 38 deletions
|
@ -343,7 +343,7 @@ describe("Zotero.DataObject", function() {
|
|||
let item = createUnsavedDataObject('item', { libraryID: group.libraryID });
|
||||
var e = yield getPromiseError(item.saveTx());
|
||||
assert.ok(e);
|
||||
assert.include(e.message, "read-only");
|
||||
assert.include(e.message, "Cannot edit item");
|
||||
});
|
||||
|
||||
it("should allow saving if skipEditCheck is passed", function* () {
|
||||
|
@ -362,14 +362,6 @@ describe("Zotero.DataObject", function() {
|
|||
assert.isFalse(e);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Options", function () {
|
||||
describe("#skipAll", function () {
|
||||
it("should include edit check", function* () {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
describe("#erase()", function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue