FIX: `(getURL "")` was not working with the `i18n` helper

FIX: (getURL "") was not working with the i18n helper

diff --git a/app/assets/javascripts/admin/templates/dashboard_general.hbs b/app/assets/javascripts/admin/templates/dashboard_general.hbs
index 8c90890..5d442f8 100644
--- a/app/assets/javascripts/admin/templates/dashboard_general.hbs
+++ b/app/assets/javascripts/admin/templates/dashboard_general.hbs
@@ -147,7 +147,7 @@
           filters=trendingSearchFilters
           isEnabled=logSearchQueriesEnabled
           disabledLabel=trendingSearchDisabledLabel}}
-        {{html-safe (i18n "admin.dashboard.reports.trending_search.more" basePath=(get-url "/"))}}
+        {{html-safe (i18n "admin.dashboard.reports.trending_search.more" basePath=(base-url))}}
       </div>
     {{/if}}
   </div>
diff --git a/app/assets/javascripts/discourse-common/addon/helpers/get-url.js b/app/assets/javascripts/discourse-common/addon/helpers/get-url.js
index e3847c4..f221c20 100644
--- a/app/assets/javascripts/discourse-common/addon/helpers/get-url.js
+++ b/app/assets/javascripts/discourse-common/addon/helpers/get-url.js
@@ -2,3 +2,4 @@ import { registerUnbound } from "discourse-common/lib/helpers";
 import getUrl from "discourse-common/lib/get-url";
 
 registerUnbound("get-url", value => getUrl(value));
+registerUnbound("base-url", () => getUrl(""));
diff --git a/app/assets/javascripts/discourse/app/templates/modal/bookmark.hbs b/app/assets/javascripts/discourse/app/templates/modal/bookmark.hbs
index be9a93d..26679f3 100644
--- a/app/assets/javascripts/discourse/app/templates/modal/bookmark.hbs
+++ b/app/assets/javascripts/discourse/app/templates/modal/bookmark.hbs
@@ -96,7 +96,7 @@
         {{/tap-tile-grid}}
 
       {{else}}
-        <div class="alert alert-info">{{html-safe (i18n "bookmarks.no_timezone" basePath=(get-url "/"))}}</div>
+        <div class="alert alert-info">{{html-safe (i18n "bookmarks.no_timezone" basePath=(base-uri))}}</div>
       {{/if}}
     </div>
 

GitHub sha: a9def011

2 Likes

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/search-logs-points-to-bad-url/153741/6