From 058b3155d04ce24009f6903688ec935a32a7d6b0 Mon Sep 17 00:00:00 2001 From: JeDaYoshi Date: Sat, 3 Jul 2021 22:53:45 +0000 Subject: [PATCH] Display error when /search is not enabled Fixes thelounge/thelounge#4273 --- client/js/commands/search.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/client/js/commands/search.js b/client/js/commands/search.js index 31e8c49b..9ae928e4 100644 --- a/client/js/commands/search.js +++ b/client/js/commands/search.js @@ -4,15 +4,19 @@ import store from "../store"; import {router} from "../router"; function input(args) { - router.push({ - name: "SearchResults", - params: { - id: store.state.activeChannel.channel.id, - }, - query: { - q: args.join(" "), - }, - }); + if (!store.state.settings.searchEnabled) { + store.commit("currentUserVisibleError", "Search is currently not enabled."); + } else { + router.push({ + name: "SearchResults", + params: { + id: store.state.activeChannel.channel.id, + }, + query: { + q: args.join(" "), + }, + }); + } return true; }