Use a more unique placeholder url path for CiviCRM AJAX requests
authorMatthew Wire <mjw@mjwconsult.co.uk>
Tue, 10 May 2022 15:41:20 +0000 (16:41 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 13 May 2022 14:48:53 +0000 (15:48 +0100)
js/crm.ajax.js
templates/CRM/common/l10n.js.tpl
tests/karma/unit/crmMailingSpec.js

index 1a4983cc3a5030d502b2428b07bf02122ccdd0de..4cb20cd03ee7b65c3fea57749294e07d8577166a 100644 (file)
     // Remove basepage as it can be changed on some CMS eg. WordPress frontend.
     frag[0] = frag[0].replace('civicrm/', '/');
     // Encode url path only if slashes in placeholder were also encoded
-    if (tplURL[mode].indexOf('/placeholder-url-path') >= 0) {
-      url = tplURL[mode].replace('/placeholder-url-path', frag[0]);
+    if (tplURL[mode].indexOf('/crmajax-placeholder-url-path') >= 0) {
+      url = tplURL[mode].replace('/crmajax-placeholder-url-path', frag[0]);
     } else {
-      url = tplURL[mode].replace('%2Fplaceholder-url-path', encodeURIComponent(frag[0]));
+      url = tplURL[mode].replace('%2Fcrmajax-placeholder-url-path', encodeURIComponent(frag[0]));
     }
 
     if (_.isEmpty(query)) {
index 7e804f5568b938db00a2e406537aa8ccdf88d146..67f69ada05885bd537d3c64e5e5c4d627dfe5aac 100644 (file)
@@ -29,7 +29,7 @@
   CRM.config.entityRef = $.extend({ldelim}{rdelim}, {$entityRef|@json_encode}, CRM.config.entityRef || {ldelim}{rdelim});
 
   // Initialize CRM.url and CRM.formatMoney
-  CRM.url({ldelim}back: '{crmURL p="civicrm/placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fb=1}', front: '{crmURL p="civicrm/placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fe=1}'{rdelim});
+  CRM.url({ldelim}back: '{crmURL p="civicrm/crmajax-placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fb=1}', front: '{crmURL p="civicrm/crmajax-placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fe=1}'{rdelim});
   CRM.formatMoney('init', false, {$moneyFormat|@json_encode});
 
   // Localize select2
index 6c0929118259fdb69a1c715a742e84f44695c92a..97a9f08acebbdd1b5f089962d6ffd627b81fdbef 100644 (file)
@@ -17,7 +17,7 @@ describe('crmMailing', function() {
         $provide.value('crmNavigator', navigator);
       });
       inject(['crmLegacy', function(crmLegacy) {
-        crmLegacy.url({back: '/civicrm/placeholder-url-path?civicrm-placeholder-url-query=1', front: '/civicrm/placeholder-url-path?civicrm-placeholder-url-query=1'});
+        crmLegacy.url({back: '/civicrm/crmajax-placeholder-url-path?civicrm-placeholder-url-query=1', front: '/civicrm/crmajax-placeholder-url-path?civicrm-placeholder-url-query=1'});
       }]);
       inject(['$controller', function($controller) {
         ctrl = $controller('ListMailingsCtrl', {});