From e1561bc459d3169d7dd74ba39fa427f08d37ee57 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Tue, 20 Jun 2023 11:59:15 -0500 Subject: [PATCH] FIX: 'in all topics' should search in all topics (#22207) When searching in the context of a topic the in all topics link would not search globally for the given term and instead it would always search within the current topic. This PR fixes the link to properly update the search context and search globally for the given term. This fix reveals some _secretly_ broken tests. Update these as well. --- .../search-menu/results/assistant-item.js | 3 +- .../search-menu/results/initial-options.hbs | 1 + .../tests/acceptance/glimmer-search-test.js | 35 ++++++++++++++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/search-menu/results/assistant-item.js b/app/assets/javascripts/discourse/app/components/search-menu/results/assistant-item.js index 5e98d2a4bc2..1d4797458d0 100644 --- a/app/assets/javascripts/discourse/app/components/search-menu/results/assistant-item.js +++ b/app/assets/javascripts/discourse/app/components/search-menu/results/assistant-item.js @@ -93,7 +93,8 @@ export default class AssistantItem extends Component { const inTopicContext = this.search.searchContext?.type === "topic"; this.args.searchTermChanged(updatedValue, { searchTopics: !inTopicContext || this.search.activeGlobalSearchTerm, - ...(inTopicContext && { setTopicContext: true }), + ...(inTopicContext && + !this.args.searchAllTopics && { setTopicContext: true }), }); focusSearchInput(); } diff --git a/app/assets/javascripts/discourse/app/components/search-menu/results/initial-options.hbs b/app/assets/javascripts/discourse/app/components/search-menu/results/initial-options.hbs index 77f8600fb53..c11db9d02f2 100644 --- a/app/assets/javascripts/discourse/app/components/search-menu/results/initial-options.hbs +++ b/app/assets/javascripts/discourse/app/components/search-menu/results/initial-options.hbs @@ -13,6 +13,7 @@