Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typeahead: Delete display mode slash commands.
Lalit7aa1763d7347
diff --git a/web/src/composebox_typeahead.js b/web/src/composebox_typeahead.jsindex 8fc65a2fdf6..67268ae744f 100644--- a/web/src/composebox_typeahead.js+++ b/web/src/composebox_typeahead.js@@ -387,27 +387,20 @@ function should_show_custom_query(query, items) {return !matched;}-export const slash_commands = [+export const dev_only_slash_commands = [{text: $t({defaultMessage: "/dark (Switch to the dark theme)"}),name: "dark",aliases: "night",},- {- text: $t({defaultMessage: "/fixed-width (Toggle fixed width mode)"}),- name: "fixed-width",- aliases: "",- },- {- text: $t({defaultMessage: "/fluid-width (Toggle fluid width mode)"}),- name: "fluid-width",- aliases: "",- },{text: $t({defaultMessage: "/light (Switch to light theme)"}),name: "light",aliases: "day",},+];++export const slash_commands = [{text: $t({defaultMessage: "/me is excited (Display action text)"}),name: "me",@@ -426,6 +419,8 @@ export const slash_commands = [},];+export const all_slash_commands = [...dev_only_slash_commands, ...slash_commands];+export function filter_and_sort_mentions(is_silent, query, opts) {opts = {want_broadcast: !is_silent,@@ -667,7 +662,7 @@ export function get_candidates(query) {}function get_slash_commands_data() {- const commands = slash_commands;+ const commands = page_params.development_environment ? all_slash_commands : slash_commands;return commands;}diff --git a/web/src/zcommand.js b/web/src/zcommand.jsindex 872ffdbb16c..b8b3edfde14 100644--- a/web/src/zcommand.js+++ b/web/src/zcommand.js@@ -5,7 +5,6 @@ import * as feedback_widget from "./feedback_widget";import {$t} from "./i18n";import * as markdown from "./markdown";import * as message_lists from "./message_lists";-import * as scroll_bar from "./scroll_bar";/*@@ -98,50 +97,6 @@ export function switch_to_dark_theme() {});}-export function enter_fluid_mode() {- send({- command: "/fluid-width",- on_success(data) {- scroll_bar.set_layout_width();- feedback_widget.show({- populate($container) {- const rendered_msg = markdown.parse_non_message(data.msg);- $container.html(rendered_msg);- },- on_undo() {- send({- command: "/fixed-width",- });- },- title_text: $t({defaultMessage: "Fluid width mode"}),- undo_button_text: $t({defaultMessage: "Fixed width"}),- });- },- });-}--export function enter_fixed_mode() {- send({- command: "/fixed-width",- on_success(data) {- scroll_bar.set_layout_width();- feedback_widget.show({- populate($container) {- const rendered_msg = markdown.parse_non_message(data.msg);- $container.html(rendered_msg);- },- on_undo() {- send({- command: "/fluid-width",- });- },- title_text: $t({defaultMessage: "Fixed width mode"}),- undo_button_text: $t({defaultMessage: "Fluid width"}),- });- },- });-}-export function process(message_content) {const content = message_content.trim();@@ -173,16 +128,6 @@ export function process(message_content) {return true;}- if (content === "/fluid-width") {- enter_fluid_mode();- return true;- }-- if (content === "/fixed-width") {- enter_fixed_mode();- return true;- }-// It is incredibly important here to return false// if we don't see an actual zcommand, so that compose.js// knows this is a normal message.diff --git a/web/tests/composebox_typeahead.test.js b/web/tests/composebox_typeahead.test.jsindex 5c905f637e0..06f5b7950e2 100644--- a/web/tests/composebox_typeahead.test.js+++ b/web/tests/composebox_typeahead.test.js@@ -1580,7 +1580,7 @@ test("typeahead_results", () => {function assert_slash_matches(input, expected) {const returned = compose_typeahead_results("slash",- composebox_typeahead.slash_commands,+ composebox_typeahead.all_slash_commands,input,);assert.deepEqual(returned, expected);