From 9bfb699c4c786c36a2eff4c8824833e2670cf302 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 24 Nov 2023 10:27:54 +0100 Subject: [PATCH] [Glitch] Change search popout to not list unusable search options when logged out Port 6e7081984004accad08042f2391236129059a548 to glitch-soc Signed-off-by: Claire --- .../glitch/features/compose/components/search.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/compose/components/search.jsx b/app/javascript/flavours/glitch/features/compose/components/search.jsx index 64732068ed..2944be798f 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search.jsx @@ -271,6 +271,7 @@ class Search extends PureComponent { } _calculateOptions (value) { + const { signedIn } = this.context.identity; const trimmedValue = value.trim(); const options = []; @@ -295,7 +296,7 @@ class Search extends PureComponent { const couldBeStatusSearch = searchEnabled; - if (couldBeStatusSearch) { + if (couldBeStatusSearch && signedIn) { options.push({ key: 'status-search', label: {trimmedValue} }} />, action: this.handleStatusSearch }); } @@ -372,7 +373,7 @@ class Search extends PureComponent {

- {searchEnabled ? ( + {searchEnabled && signedIn ? (
{this.defaultOptions.map(({ key, label, action }, i) => (
) : (
- + {searchEnabled ? ( + + ) : ( + + )}
)}