Fixes #598, Renaming selected tag causes library to "disappear"
Addresses #597, Don't iterate Array with for...in
This commit is contained in:
parent
1277e5915f
commit
6594c60797
|
@ -499,18 +499,28 @@
|
||||||
newName, '', {});
|
newName, '', {});
|
||||||
|
|
||||||
if (result && newName.value) {
|
if (result && newName.value) {
|
||||||
Zotero.DB.beginTransaction();
|
|
||||||
|
|
||||||
// Add other ids with same tag
|
// Add other ids with same tag
|
||||||
var ids = Zotero.Tags.getIDs(oldName);
|
var ids = Zotero.Tags.getIDs(oldName);
|
||||||
for each(var id in ids) {
|
|
||||||
if (tagIDs.indexOf(id) == -1) {
|
for (var i=0; i<ids.length; i++) {
|
||||||
tagIDs.push(id);
|
if (tagIDs.indexOf(ids[i]) == -1) {
|
||||||
|
tagIDs.push(ids[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for each(var tagID in tagIDs) {
|
if (this.selection[oldName]) {
|
||||||
Zotero.Tags.rename(tagID, newName.value);
|
var wasSelected = true;
|
||||||
|
delete this.selection[oldName];
|
||||||
|
}
|
||||||
|
|
||||||
|
Zotero.DB.beginTransaction();
|
||||||
|
|
||||||
|
for (var i=0; i<tagIDs.length; i++) {
|
||||||
|
Zotero.Tags.rename(tagIDs[i], newName.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wasSelected) {
|
||||||
|
this.selection[newName.value] = true;
|
||||||
}
|
}
|
||||||
Zotero.DB.commitTransaction();
|
Zotero.DB.commitTransaction();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user