crmMailingAB - Remove updateUrl calls
authorTim Otten <totten@civicrm.org>
Sat, 14 Feb 2015 01:50:12 +0000 (17:50 -0800)
committerTim Otten <totten@civicrm.org>
Sat, 14 Feb 2015 03:53:49 +0000 (19:53 -0800)
These should have been removed when we switched to create-on-open/auto-save
behavior.  dgg reported some sporadic issues with redirects (in CRM-15856)
which I haven't reproduced, but spurious updateUrl is a plausible cause.

js/angular-crmMailingAB.js

index 1c8e8338593a99cc295cc1b4923c0fd10eb1e412..227b7c57208a226a939a268a4c6b6ce9019032ab 100644 (file)
 
     // @return Promise
     $scope.save = function save() {
-      return block(crmStatus({start: ts('Saving...'), success: ts('Saved')}, abtest.save().then(updateUrl)));
+      return block(crmStatus({start: ts('Saving...'), success: ts('Saved')}, abtest.save()));
     };
 
     // @return Promise
 
     // @return Promise
     $scope.sendTest = function sendTest(mailingName, recipient) {
-      return block(crmStatus({start: ts('Saving...'), success: ''}, abtest.save().then(updateUrl))
+      return block(crmStatus({start: ts('Saving...'), success: ''}, abtest.save())
         .then(function () {
           crmMailingPreviewMgr.sendTest(abtest.mailings[mailingName], recipient);
         }));
       $scope.criteriaName = criteria ? criteria.name : null;
     }
 
-    // Transition URL "/abtest/new" => "/abtest/123"
-    function updateUrl() {
-      var parts = $location.path().split('/'); // e.g. "/abtest/new" or "/abtest/123/wizard"
-      if (parts[2] != $scope.abtest.ab.id) {
-        parts[2] = $scope.abtest.ab.id;
-        $location.path(parts.join('/'));
-        $location.replace();
-        // FIXME: Angular unnecessarily refreshes UI
-        // WARNING: Changing the URL triggers a full reload. Any pending AJAX operations
-        // could be inconsistently applied. Run updateUrl() after other changes complete.
-      }
-    }
-
     // initialize
     updateCriteriaName();
     $scope.$watch('abtest.ab.testing_criteria_id', updateCriteriaName);