[Composition] Use composition.add from link action

This commit is contained in:
Victor Woeltjen
2015-09-02 09:08:47 -07:00
parent 8e995eba8f
commit b9d8b124ff
2 changed files with 9 additions and 15 deletions

View File

@ -63,7 +63,8 @@ define(
*/
CompositionCapability.prototype.add = function (domainObject, index) {
var id = typeof domainObject === 'string' ?
domainObject : domainObject.getId();
domainObject : domainObject.getId(),
$q = this.$q;
function addIdToModel(model) {
var composition = model.composition,
@ -71,9 +72,9 @@ define(
// If no index has been specified already and the id is already
// present, nothing to do. If the id is already at that index,
// also nothing to do.
// also nothing to do, so cancel mutation.
if ((isNaN(index) && oldIndex !== -1) || (index === oldIndex) {
return;
return false;
}
// Pick a specific index if needed.