From 821cc65d6fa7917a6786baddc1490b94ac100cff Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 Mar 2015 10:41:56 -0700 Subject: [PATCH] [Edit] Remove unused code Remove unused and/or excessive code related to Save in Edit mode. WTD-1033. --- platform/commonUI/edit/src/actions/SaveAction.js | 16 +++++----------- .../edit/src/capabilities/EditorCapability.js | 14 +------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 3b79f74614..22da4b0751 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -13,24 +13,18 @@ define( function SaveAction($location, context) { var domainObject = context.domainObject; - // Look up the object's "editor.completion" capability; + // Invoke any save behavior introduced by the editor capability; // this is introduced by EditableDomainObject which is // used to insulate underlying objects from changes made // during editing. - function getEditorCapability() { - return domainObject.getCapability("editor"); - } - - // Invoke any save behavior introduced by the editor.completion - // capability. - function doSave(editor) { - return editor.save(); + function doSave() { + return domainObject.getCapability("editor").save(); } // Discard the current root view (which will be the editing // UI, which will have been pushed atop the Browise UI.) function returnToBrowse() { - $location.path("/browse"); + return $location.path("/browse"); } return { @@ -41,7 +35,7 @@ define( * cancellation has completed */ perform: function () { - return doSave(getEditorCapability()).then(returnToBrowse); + return doSave().then(returnToBrowse); } }; } diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 2c68afd0f4..6c1407aa17 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -33,7 +33,7 @@ define( // removed from the layer which gets dependency // injection. function resolvePromise(value) { - return value && value.then ? value : { + return (value && value.then) ? value : { then: function (callback) { return resolvePromise(callback(value)); } @@ -53,18 +53,6 @@ define( return persistenceCapability.persist(); } - // Save any other objects that have been modified in the cache. - // IMPORTANT: This must not be called until after this object - // has been marked as clean. - function saveOthers() { - return cache.saveAll(); - } - - // Indicate that this object has been saved. - function markClean() { - return cache.markClean(editableObject); - } - return { /** * Save any changes that have been made to this domain object