[Location] isLink/isOriginal are antonyms

Simplify implementation of isLink/isOriginal for better maintainability.
This commit is contained in:
Pete Richards 2015-08-19 11:49:45 -07:00
parent 5c74365f4b
commit 26892e7104

View File

@ -59,11 +59,10 @@ define(
/**
* Returns true if the domainObject is a link, false if it's an
* original.
*
* @returns {Boolean}
*/
LocationCapability.prototype.isLink = function () {
if (this.domainObject.getId() === "mine") {
return false;
}
var model = this.domainObject.getModel();
return model.location !== this.getContextualLocation();
@ -72,14 +71,11 @@ define(
/**
* Returns true if the domainObject is an original, false if it's a
* link.
*
* @returns {Boolean}
*/
LocationCapability.prototype.isOriginal = function () {
if (this.domainObject.getId() === "mine") {
return true;
}
var model = this.domainObject.getModel();
return model.location === this.getContextualLocation();
return !this.isLink();
};
function createLocationCapability(domainObject) {