From 10e0acddb397eda4289f2beea66042a7272d40e2 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 10 Feb 2016 16:34:00 -0800 Subject: [PATCH] [New Edit Mode] #659 Fix to prevent multi-composition with same object, fix to prevent composition of object with self --- platform/containment/src/ComposeActionPolicy.js | 11 ++++++----- .../timeline/src/directives/MCTSwimlaneDrop.js | 1 + .../timeline/test/directives/MCTSwimlaneDropSpec.js | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/platform/containment/src/ComposeActionPolicy.js b/platform/containment/src/ComposeActionPolicy.js index 3468cd3107..fa91cfb0e7 100644 --- a/platform/containment/src/ComposeActionPolicy.js +++ b/platform/containment/src/ComposeActionPolicy.js @@ -55,11 +55,12 @@ define( this.policyService = this.policyService || this.getPolicyService(); // ...and delegate to the composition policy - return this.policyService.allow( - 'composition', - containerType, - selectedType - ); + return containerObject.getId() !== selectedObject.getId() && + this.policyService.allow( + 'composition', + containerType, + selectedType + ); }; /** diff --git a/platform/features/timeline/src/directives/MCTSwimlaneDrop.js b/platform/features/timeline/src/directives/MCTSwimlaneDrop.js index d64f1a7831..cf21ac3105 100644 --- a/platform/features/timeline/src/directives/MCTSwimlaneDrop.js +++ b/platform/features/timeline/src/directives/MCTSwimlaneDrop.js @@ -85,6 +85,7 @@ define( ); if (id) { + event.stopPropagation(); // Delegate the drop to the swimlane itself swimlane.drop(id, (draggedSwimlane || {}).domainObject); } diff --git a/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js b/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js index 80eeb43a74..7a550b32e8 100644 --- a/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js +++ b/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js @@ -87,7 +87,8 @@ define( testEvent = { pageY: TEST_TOP + TEST_HEIGHT / 10, dataTransfer: { getData: jasmine.createSpy() }, - preventDefault: jasmine.createSpy() + preventDefault: jasmine.createSpy(), + stopPropagation: jasmine.createSpy() }; testEvent.dataTransfer.getData.andReturn('abc');