www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 4de529c03f4f7754d280fb9e33a2ec45e2787d03
parent 1fad45da6322b35111d58f6be8ebb8db3473c314
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 16 Oct 2008 17:12:33 +0000

Fixed a couple tag-related errors (from caching change)


Diffstat:
Mchrome/content/zotero/xpcom/data/tag.js | 6++----
Mchrome/content/zotero/xpcom/data/tags.js | 8++++----
2 files changed, 6 insertions(+), 8 deletions(-)

diff --git 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 @@ -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