Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
search_suggestion: Change suggestion string for has: operator.
Pratik Chandaf7c3f1414df4
diff --git a/web/src/filter.ts b/web/src/filter.tsindex 001e9a85d90..7945d59e80b 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -665,7 +665,7 @@ export class Filter {// Note: We hack around using this in "describe" below.case "has":- return verb + "messages with one or more";+ return verb + "messages with";case "id":return verb + "message ID";diff --git a/web/src/search_suggestion.ts b/web/src/search_suggestion.tsindex 45e4df1bfec..cd385dfe0a0 100644--- a/web/src/search_suggestion.ts+++ b/web/src/search_suggestion.ts@@ -720,25 +720,25 @@ function get_has_filter_suggestions(last: NarrowTerm, terms: NarrowTerm[]): Suggconst suggestions: SuggestionAndIncompatiblePatterns[] = [{search_string: "has:link",- description_html: "messages that contain links",+ description_html: "messages with links",is_people: false,incompatible_patterns: [{operator: "has", operand: "link"}],},{search_string: "has:image",- description_html: "messages that contain images",+ description_html: "messages with images",is_people: false,incompatible_patterns: [{operator: "has", operand: "image"}],},{search_string: "has:attachment",- description_html: "messages that contain attachments",+ description_html: "messages with attachments",is_people: false,incompatible_patterns: [{operator: "has", operand: "attachment"}],},{search_string: "has:reaction",- description_html: "messages that contain reactions",+ description_html: "messages with reactions",is_people: false,incompatible_patterns: [{operator: "has", operand: "reaction"}],},diff --git a/web/templates/search_description.hbs b/web/templates/search_description.hbsindex b6d9f6d4ebe..81bdefeef99 100644--- a/web/templates/search_description.hbs+++ b/web/templates/search_description.hbs@@ -12,7 +12,7 @@{{~!-- squash whitespace --~}}{{else if (eq this.type "prefix_for_operator")}}{{~!-- squash whitespace --~}}- {{this.prefix_for_operator}} {{this.operand}}+ {{this.prefix_for_operator}} {{this.operand}}{{#if (or (eq this.operand "link") (eq this.operand "image") (eq this.operand "attachment") (eq this.operand "reaction"))}}s{{/if}}{{~!-- squash whitespace --~}}{{else if (eq this.type "user_pill")}}{{~!-- squash whitespace --~}}diff --git a/web/tests/filter.test.js b/web/tests/filter.test.jsindex 8eb2dd73fd2..b8479b837d2 100644--- a/web/tests/filter.test.js+++ b/web/tests/filter.test.js@@ -1500,7 +1500,7 @@ test("describe", ({mock_template}) => {{operator: "channel", operand: "devel"},{operator: "has", operand: "image", negated: true},];- string = "channel devel, exclude messages with one or more image";+ string = "channel devel, exclude messages with images";assert.equal(Filter.search_description_as_html(narrow), string);narrow = [@@ -1514,7 +1514,7 @@ test("describe", ({mock_template}) => {{operator: "has", operand: "image", negated: true},{operator: "channel", operand: "devel"},];- string = "exclude messages with one or more image, channel devel";+ string = "exclude messages with images, channel devel";assert.equal(Filter.search_description_as_html(narrow), string);narrow = [];diff --git a/web/tests/search_suggestion.test.js b/web/tests/search_suggestion.test.jsindex ad2783a19e8..29d360126af 100644--- a/web/tests/search_suggestion.test.js+++ b/web/tests/search_suggestion.test.js@@ -381,9 +381,9 @@ test("empty_query_suggestions", () => {assert.equal(describe("is:resolved"), "Topics marked as resolved");assert.equal(describe("is:followed"), "Followed topics");assert.equal(describe("sender:[email protected]"), "Sent by me");- assert.equal(describe("has:link"), "Messages that contain links");- assert.equal(describe("has:image"), "Messages that contain images");- assert.equal(describe("has:attachment"), "Messages that contain attachments");+ assert.equal(describe("has:link"), "Messages with links");+ assert.equal(describe("has:image"), "Messages with images");+ assert.equal(describe("has:attachment"), "Messages with attachments");});test("has_suggestions", ({override, mock_template}) => {@@ -404,17 +404,17 @@ test("has_suggestions", ({override, mock_template}) => {return suggestions.lookup_table.get(q).description_html;}- assert.equal(describe("has:link"), "Messages that contain links");- assert.equal(describe("has:image"), "Messages that contain images");- assert.equal(describe("has:attachment"), "Messages that contain attachments");+ assert.equal(describe("has:link"), "Messages with links");+ assert.equal(describe("has:image"), "Messages with images");+ assert.equal(describe("has:attachment"), "Messages with attachments");query = "-h";suggestions = get_suggestions(query);expected = ["-h", "-has:link", "-has:image", "-has:attachment", "-has:reaction"];assert.deepEqual(suggestions.strings, expected);- assert.equal(describe("-has:link"), "Exclude messages that contain links");- assert.equal(describe("-has:image"), "Exclude messages that contain images");- assert.equal(describe("-has:attachment"), "Exclude messages that contain attachments");+ assert.equal(describe("-has:link"), "Exclude messages with links");+ assert.equal(describe("-has:image"), "Exclude messages with images");+ assert.equal(describe("-has:attachment"), "Exclude messages with attachments");// operand suggestions follow.