Fixed a couple tag-related errors (from caching change)
This commit is contained in:
parent
1fad45da63
commit
4de529c03f
2 changed files with 6 additions and 8 deletions
|
@ -127,12 +127,10 @@ Zotero.Tag.prototype.load = function() {
|
|||
|
||||
Zotero.Tag.prototype.loadFromRow = function (row) {
|
||||
this._init();
|
||||
|
||||
for (var col in row) {
|
||||
//Zotero.debug("Setting field '" + col + "' to '" + row[col] + "' for tag " + this.id);
|
||||
this['_' + col] = row[col] ? row[col] : '';
|
||||
this['_' + col] = (!row[col] && row[col] !== 0) ? '' : row[col];
|
||||
}
|
||||
|
||||
this._loaded = true;
|
||||
}
|
||||
|
||||
|
@ -215,7 +213,7 @@ Zotero.Tag.prototype.save = function () {
|
|||
this.type = 0;
|
||||
}
|
||||
|
||||
if (this.type != 0 && this.type != 1) {
|
||||
if (this.type !== 0 && this.type !== 1) {
|
||||
throw ('Invalid tag type ' + this.type + ' in Zotero.Tag.save()');
|
||||
}
|
||||
|
||||
|
|
|
@ -60,14 +60,14 @@ Zotero.Tags = new function() {
|
|||
* Returns a tag for a given tagID
|
||||
*/
|
||||
function getName(tagID) {
|
||||
if (_tagsByID[tagID]) {
|
||||
return _tagsByID[tagID].name;
|
||||
if (this._objectCache[tagID]) {
|
||||
return this._objectCache[tagID].name;
|
||||
}
|
||||
|
||||
// Populate cache
|
||||
var tag = this.get(tagID);
|
||||
|
||||
return _tagsByID[tagID] ? _tagsByID[tagID].name : false;
|
||||
return this._objectCache[tagID] ? this._objectCache[tagID].name : false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,7 +278,7 @@ Zotero.Tags = new function() {
|
|||
if (_tags[oldType]) {
|
||||
delete _tags[oldType]['_' + oldName];
|
||||
}
|
||||
delete _tagsByID[tagID];
|
||||
delete this._objectCache[tagID];
|
||||
Zotero.Notifier.trigger('delete', 'tag', tagID, notifierData);
|
||||
|
||||
// Simulate tag removal on items that used old tag
|
||||
|
|
Loading…
Add table
Reference in a new issue