From 308823a253dc58346041c2497082fb58f1f481e2 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Wed, 13 Oct 2021 00:44:45 -0400 Subject: [PATCH] FIX: Use absolute URLs in search shortcut (#14585) --- app/assets/javascripts/discourse/app/widgets/search-menu.js | 2 +- .../javascripts/discourse/tests/acceptance/search-test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/widgets/search-menu.js b/app/assets/javascripts/discourse/app/widgets/search-menu.js index b62a4ae6451..47dc7870808 100644 --- a/app/assets/javascripts/discourse/app/widgets/search-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/search-menu.js @@ -299,7 +299,7 @@ export default createWidget("search-menu", { this.appEvents.trigger( "composer:insert-text", - document.activeElement.getAttribute("href"), + document.activeElement.href, { ensureSpace: true, } diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-test.js index 47ec79c9458..912c94992f0 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-test.js @@ -350,7 +350,7 @@ acceptance("Search - Authenticated", function (needs) { assert.equal( query("#reply-control textarea").value, - firstLink, + `${window.location.origin}${firstLink}`, "hitting A when focused on a search result copies link to composer" ); });