From 5a67c8f0cad0ace65192b3fae998877c29ef278d Mon Sep 17 00:00:00 2001
From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com>
Date: Thu, 15 Feb 2024 13:25:50 -0700
Subject: [PATCH] UX: Show search history for more contexts (#25705)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add search history to 👇 contexts:
- "topic",
- "category",
- "tag",
- "tagIntersection",
- "user",
We display the search history when no search term is present.
# Demo
https://github.com/discourse/discourse/assets/50783505/c720f70e-0c4c-4dbd-9f28-8b046deef674
## Topic
## Category
## Tag
## Tag Intersection
## User
---
.../search-menu/results/initial-options.hbs | 13 +++++
.../search-menu/results/initial-options.js | 17 ++++++
.../discourse/tests/acceptance/search-test.js | 56 ++++++++++++++++++-
3 files changed, 85 insertions(+), 1 deletion(-)
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 e149ab71931..b4e611b2e06 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
@@ -46,6 +46,19 @@
@closeSearchMenu={{@closeSearchMenu}}
@searchTermChanged={{@searchTermChanged}}
/>
+
+ {{#if
+ (and
+ this.currentUser
+ this.siteSettings.log_search_queries
+ this.displayInitialOptions
+ )
+ }}
+
+ {{/if}}
{{/if}}
{{else}}