From 26892e7104063a8428e0dfa98fe8cfa551eec295 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 19 Aug 2015 11:49:45 -0700 Subject: [PATCH] [Location] isLink/isOriginal are antonyms Simplify implementation of isLink/isOriginal for better maintainability. --- .../src/capabilities/LocationCapability.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/platform/entanglement/src/capabilities/LocationCapability.js b/platform/entanglement/src/capabilities/LocationCapability.js index 1bc2f8b931..17d678f57e 100644 --- a/platform/entanglement/src/capabilities/LocationCapability.js +++ b/platform/entanglement/src/capabilities/LocationCapability.js @@ -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) {