From 162b42d9b013ee1193dd0f4232ef437f334448da Mon Sep 17 00:00:00 2001 From: JeDaYoshi Date: Wed, 7 Jul 2021 22:12:28 +0000 Subject: [PATCH] Apply changes to getCommands/search --- client/js/autocompletion.js | 4 ++-- client/js/commands/search.js | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/js/autocompletion.js b/client/js/autocompletion.js index 6a468eb7..1acc0057 100644 --- a/client/js/autocompletion.js +++ b/client/js/autocompletion.js @@ -312,7 +312,7 @@ function completeNicks(word, isFuzzy) { } function getCommands() { - const cmds = constants.commands; + const cmds = constants.commands.slice(); if (store.state.settings.searchEnabled === false) { const search = cmds.indexOf("/search"); @@ -326,7 +326,7 @@ function getCommands() { } function completeCommands(word) { - const words = getCommands().slice(); + const words = getCommands(); return fuzzyGrep(word, words); } diff --git a/client/js/commands/search.js b/client/js/commands/search.js index 9ae928e4..62a868cf 100644 --- a/client/js/commands/search.js +++ b/client/js/commands/search.js @@ -5,7 +5,14 @@ import {router} from "../router"; function input(args) { if (!store.state.settings.searchEnabled) { - store.commit("currentUserVisibleError", "Search is currently not enabled."); + const disabled = "Search is currently not enabled."; + store.commit("currentUserVisibleError", disabled); + setTimeout( + () => + store.state.currentUserVisibleError === disabled && + store.commit("currentUserVisibleError", null), + 5000 + ); } else { router.push({ name: "SearchResults",