From 0a6c33af5787c0f5c76a6e6c7f76146976878726 Mon Sep 17 00:00:00 2001 From: JeDaYoshi Date: Wed, 7 Jul 2021 23:00:44 +0000 Subject: [PATCH] Create a message for search disabled error --- client/js/commands/search.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/js/commands/search.js b/client/js/commands/search.js index 62a868cf..1df3701a 100644 --- a/client/js/commands/search.js +++ b/client/js/commands/search.js @@ -2,22 +2,22 @@ import store from "../store"; import {router} from "../router"; +const Msg = require("../../../src/models/msg"); function input(args) { + const {channel} = store.state.activeChannel; + if (!store.state.settings.searchEnabled) { - const disabled = "Search is currently not enabled."; - store.commit("currentUserVisibleError", disabled); - setTimeout( - () => - store.state.currentUserVisibleError === disabled && - store.commit("currentUserVisibleError", null), - 5000 - ); + const message = new Msg({ + type: Msg.Type.ERROR, + text: "Search is currently not enabled.", + }); + channel.messages.push(message); } else { router.push({ name: "SearchResults", params: { - id: store.state.activeChannel.channel.id, + id: channel.id, }, query: { q: args.join(" "),