diff --git a/chrome/content/zotero/xpcom/data/tag.js b/chrome/content/zotero/xpcom/data/tag.js index 8a946443e..4d95065d4 100644 --- a/chrome/content/zotero/xpcom/data/tag.js +++ b/chrome/content/zotero/xpcom/data/tag.js @@ -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()'); } diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js index adb21fe6f..391291003 100644 --- a/chrome/content/zotero/xpcom/data/tags.js +++ b/chrome/content/zotero/xpcom/data/tags.js @@ -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