From 8e995eba8f5af52a0aabd34c39ade61fdc539749 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 1 Sep 2015 17:11:09 -0700 Subject: [PATCH] [Composition] Use composition.add during creation --- .../browse/src/creation/CreationService.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/platform/commonUI/browse/src/creation/CreationService.js b/platform/commonUI/browse/src/creation/CreationService.js index 3dd96d289e..188c384c1a 100644 --- a/platform/commonUI/browse/src/creation/CreationService.js +++ b/platform/commonUI/browse/src/creation/CreationService.js @@ -86,18 +86,9 @@ define( // composition, so that it will subsequently appear // as a child contained by that parent. function addToComposition(id, parent, parentPersistence) { - var mutatationResult = parent.useCapability("mutation", function (model) { - if (Array.isArray(model.composition)) { - // Don't add if the id is already there - if (model.composition.indexOf(id) === -1) { - model.composition.push(id); - } - } else { - // This is abnormal; composition should be an array - self.$log.warn(NO_COMPOSITION_WARNING + parent.getId()); - return false; // Cancel mutation - } - }); + var compositionCapability = parent.getCapability('composition'), + mutationResult = compositionCapability && + compositionCapability.add(id); return self.$q.when(mutatationResult).then(function (result) { if (!result) {