From a1daf9fe53a66e2d2cdf9757ab4812fb9a2b2787 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Tue, 19 Oct 2021 13:01:42 -0400 Subject: [PATCH] FIX: Do not query backend when searching "in this topic" (#14649) --- app/assets/javascripts/discourse/app/widgets/search-menu.js | 5 +++-- app/assets/stylesheets/common/base/search-menu.scss | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/widgets/search-menu.js b/app/assets/javascripts/discourse/app/widgets/search-menu.js index ef0426f3a7c..9977794ddd7 100644 --- a/app/assets/javascripts/discourse/app/widgets/search-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/search-menu.js @@ -428,7 +428,6 @@ export default createWidget("search-menu", { triggerSearch() { searchData.noResults = false; - if (SearchHelper.includesTopics()) { if (this.state.inTopicContext) { this.searchService().set("highlightTerm", searchData.term); @@ -438,7 +437,9 @@ export default createWidget("search-menu", { SearchHelper.perform(this); } else { searchData.loading = false; - discourseDebounce(SearchHelper, SearchHelper.perform, this, 400); + if (!this.state.inTopicContext) { + discourseDebounce(SearchHelper, SearchHelper.perform, this, 400); + } } }, diff --git a/app/assets/stylesheets/common/base/search-menu.scss b/app/assets/stylesheets/common/base/search-menu.scss index 9b9a60928a1..8d678dba475 100644 --- a/app/assets/stylesheets/common/base/search-menu.scss +++ b/app/assets/stylesheets/common/base/search-menu.scss @@ -36,8 +36,9 @@ $search-pad-horizontal: 0.5em; } } - .btn { + .btn.search-context { margin: 2px; + margin-right: 0; } &:focus-within { @include default-focus;