Add "Delete Automatic Tags in This Library…" option to tag selector menu
I think it might be worth having a tag management window that lets you view tags as a grid, sort by column (e.g., type), select ranges, delete, consolidate, etc., but until then, this fulfills a popular request.
This commit is contained in:
parent
941ae5499c
commit
de3b47fd78
5 changed files with 216 additions and 57 deletions
|
@ -39,6 +39,36 @@ describe("Zotero.Tags", function () {
|
|||
});
|
||||
|
||||
describe("#removeFromLibrary()", function () {
|
||||
it("should remove tags in given library", function* () {
|
||||
var libraryID = Zotero.Libraries.userLibraryID;
|
||||
var groupLibraryID = (yield getGroup()).libraryID;
|
||||
|
||||
var tags = [];
|
||||
var items = [];
|
||||
yield Zotero.DB.executeTransaction(function* () {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
let tagName = Zotero.Utilities.randomString();
|
||||
tags.push(tagName);
|
||||
let item = createUnsavedDataObject('item');
|
||||
item.addTag(tagName);
|
||||
yield item.save();
|
||||
items.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
var groupTagName = Zotero.Utilities.randomString();
|
||||
var groupItem = createUnsavedDataObject('item', { libraryID: groupLibraryID });
|
||||
groupItem.addTag(groupTagName);
|
||||
yield groupItem.saveTx();
|
||||
|
||||
var tagIDs = tags.map(tag => Zotero.Tags.getID(tag));
|
||||
yield Zotero.Tags.removeFromLibrary(libraryID, tagIDs);
|
||||
items.forEach(item => assert.lengthOf(item.getTags(), 0));
|
||||
|
||||
// Group item should still have the tag
|
||||
assert.lengthOf(groupItem.getTags(), 1);
|
||||
})
|
||||
|
||||
it("should reload tags of associated items", function* () {
|
||||
var libraryID = Zotero.Libraries.userLibraryID;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue