Block saving of annotations and embedded images in groups
Both should already be disabled via the UI, but just in case there's some way they sneak through
This commit is contained in:
parent
50dae87b07
commit
2d2062a63d
2 changed files with 17 additions and 3 deletions
|
@ -1272,6 +1272,19 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
|
|||
env.sqlValues.push({ int: itemTypeID });
|
||||
}
|
||||
|
||||
// TEMP: Don't allow annotations or embedded images in group libraries
|
||||
// TODO: Enable test in annotations.js after removing
|
||||
if (libraryType != 'user') {
|
||||
if (this._changed.primaryData && this._changed.primaryData.itemTypeID
|
||||
&& Zotero.ItemTypes.getName(itemTypeID) == 'annotation') {
|
||||
throw new Error("Annotations can currently be created only in user libraries");
|
||||
}
|
||||
if (this._changed.attachmentData
|
||||
&& this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_EMBEDDED_IMAGE) {
|
||||
throw new Error("Embedded-image attachments can currently be created only in user libraries");
|
||||
}
|
||||
}
|
||||
|
||||
if (isNew || (this._changed.primaryData && this._changed.primaryData.dateAdded)) {
|
||||
env.sqlColumns.push('dateAdded');
|
||||
env.sqlValues.push(this.dateAdded ? this.dateAdded : Zotero.DB.transactionDateTime);
|
||||
|
|
|
@ -123,13 +123,14 @@ describe("Zotero.Annotations", function() {
|
|||
exampleNote.libraryID = item.libraryID;
|
||||
exampleImage.libraryID = item.libraryID;
|
||||
|
||||
group = await getGroup();
|
||||
// Disabled while group annotations are disabled
|
||||
/*group = await getGroup();
|
||||
exampleGroupHighlight.libraryID = group.libraryID;
|
||||
groupItem = await createDataObject('item', { libraryID: group.libraryID });
|
||||
groupAttachment = await importFileAttachment(
|
||||
'test.pdf',
|
||||
{ libraryID: group.libraryID, parentID: groupItem.id }
|
||||
);
|
||||
);*/
|
||||
});
|
||||
|
||||
describe("#toJSON()", function () {
|
||||
|
@ -232,7 +233,7 @@ describe("Zotero.Annotations", function() {
|
|||
await annotation.eraseTx();
|
||||
});
|
||||
|
||||
it("should generate an object for a highlight by another user in a group library", async function () {
|
||||
it.skip("should generate an object for a highlight by another user in a group library", async function () {
|
||||
await Zotero.Users.setName(12345, 'Kate Smith');
|
||||
|
||||
var annotation = new Zotero.Item('annotation');
|
||||
|
|
Loading…
Add table
Reference in a new issue