www

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

commit b8d9504a4fe991410961d81b6c9a61dfec337d60
parent cc3d81da93e7f7ff0f187ad6250853c328e65bc6
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sun, 31 May 2015 17:07:59 -0400

Missed lines from 420985661

Diffstat:
Mchrome/content/zotero/xpcom/data/dataObject.js | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js @@ -144,10 +144,16 @@ Zotero.DataObject.prototype._set = function (field, value) { Zotero.DataObject.prototype._setIdentifier = function (field, value) { switch (field) { case 'id': + value = Zotero.DataObjectUtilities.checkDataID(value); + if (this._id) { + if (value === this._id) { + return; + } + throw new Error("ID cannot be changed"); + } if (this._key) { throw new Error("Cannot set id if key is already set"); } - value = Zotero.DataObjectUtilities.checkDataID(value); break; case 'libraryID': @@ -158,10 +164,16 @@ Zotero.DataObject.prototype._setIdentifier = function (field, value) { if (this._libraryID === null) { throw new Error("libraryID must be set before key"); } + value = Zotero.DataObjectUtilities.checkKey(value); + if (this._key) { + if (value === this._key) { + return; + } + throw new Error("Key cannot be changed"); + } if (this._id) { throw new Error("Cannot set key if id is already set"); } - value = Zotero.DataObjectUtilities.checkKey(value); } if (value === this['_' + field]) {