diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 880e61f5da..6b1723c5d9 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -222,8 +222,7 @@ define([ "policyService", "dialogService", "creationService", - "copyService", - "transactionService" + "copyService" ], "priority": "mandatory" }, diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 4e2c5d870b..03022be049 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -44,7 +44,6 @@ define([ dialogService, creationService, copyService, - transactionService, context ) { this.domainObject = (context || {}).domainObject; @@ -55,7 +54,6 @@ define([ this.dialogService = dialogService; this.creationService = creationService; this.copyService = copyService; - this.transactionService = transactionService; } /** @@ -113,8 +111,6 @@ define([ var self = this, domainObject = this.domainObject, copyService = this.copyService, - transactionService = this.transactionService, - cancelOldTransaction, dialog = new SaveInProgressDialog(this.dialogService); function doWizardSave(parent) { @@ -160,16 +156,6 @@ define([ .then(resolveWith(clonedObject)); } - function restartTransaction(object) { - cancelOldTransaction = transactionService.restartTransaction(); - return object; - } - - function doCancelOldTransaction(object) { - cancelOldTransaction(); - return object; - } - function onFailure() { hideBlockingDialog(); return false; @@ -179,10 +165,8 @@ define([ .then(doWizardSave) .then(showBlockingDialog) .then(getParent) - .then(restartTransaction) .then(cloneIntoParent) .then(commitEditingAfterClone) - .then(doCancelOldTransaction) .then(hideBlockingDialog) .catch(onFailure); }; diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index b5439d4491..0a7f148853 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -140,38 +140,9 @@ define( }); }; - /** - * Clear and restart the active transaction. - * - * This neither cancels nor commits the active transaction; - * instead, it returns a function that can be used to cancel that - * transaction. - * - * @returns {Function} a function to cancel the prior transaction - * @private - */ - TransactionService.prototype.restartTransaction = function () { - var oldOnCancels = this.onCancels; - - this.onCommits = []; - this.onCancels = []; - - return function () { - while (oldOnCancels.length > 0) { - var onCancel = oldOnCancels.pop(); - try { - onCancel(); - } catch (error) { - this.$log.error("Error cancelling transaction."); - } - } - }; - }; - TransactionService.prototype.size = function () { return this.onCommits.length; }; return TransactionService; - } -); + }); diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index ec649571ee..dbdd1f9692 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -34,7 +34,6 @@ define( mockCopyService, mockParent, mockUrlService, - mockTransactionService, actionContext, capabilities = {}, action; @@ -120,26 +119,11 @@ define( ["urlForLocation"] ); - mockTransactionService = jasmine.createSpyObj( - "transactionService", - ["restartTransaction"] - ); - mockTransactionService.restartTransaction - .andReturn(jasmine.createSpy()); - actionContext = { domainObject: mockDomainObject }; - action = new SaveAsAction( - undefined, - undefined, - mockDialogService, - undefined, - mockCopyService, - mockTransactionService, - actionContext - ); + action = new SaveAsAction(undefined, undefined, mockDialogService, undefined, mockCopyService, actionContext); spyOn(action, "getObjectService"); action.getObjectService.andReturn(mockObjectService);