From 836b5db8cf7056742c049d5ee99945ebfa28d6c1 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Apr 2016 13:11:07 -0700 Subject: [PATCH] Reviewed edit mode checking --- platform/commonUI/edit/src/actions/EditAction.js | 5 ++--- platform/commonUI/edit/src/policies/EditableViewPolicy.js | 2 +- .../timeline/src/controllers/TimelineZoomController.js | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 5931a02a52..229861d1d9 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -87,11 +87,10 @@ define( */ EditAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject, - type = domainObject && domainObject.getCapability('type'), - isEditMode = domainObject && domainObject.getDomainObject ? true : false; + type = domainObject && domainObject.getCapability('type'); // Only allow creatable types to be edited - return type && type.hasFeature('creation') && !isEditMode; + return type && type.hasFeature('creation') && !domainObject.getCapability('status').get('editing'); }; return EditAction; diff --git a/platform/commonUI/edit/src/policies/EditableViewPolicy.js b/platform/commonUI/edit/src/policies/EditableViewPolicy.js index 23de491def..312bafff05 100644 --- a/platform/commonUI/edit/src/policies/EditableViewPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableViewPolicy.js @@ -37,7 +37,7 @@ define( // If a view is flagged as non-editable, only allow it // while we're not in Edit mode. if ((view || {}).editable === false) { - return !(domainObject.hasCapability('editor') && domainObject.getCapability('status').get('editing')); + return !(domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()); } // Like all policies, allow by default. diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 1488d44aeb..43abb8419c 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -57,7 +57,8 @@ define( function storeZoom() { var isEditMode = $scope.commit && $scope.domainObject && - $scope.domainObject.hasCapability('editor'); + $scope.domainObject.hasCapability('editor') && + $scope.domainObject.getCapability('editor').inEditContext(); if (isEditMode) { $scope.configuration = $scope.configuration || {}; $scope.configuration.zoomLevel = zoomIndex;