search: Adjust text in has: message suggestions.

This commit is contained in:
Karl Stolley 2023-06-27 14:41:19 -05:00 committed by Tim Abbott
parent bee7166a86
commit 7f4fe7282f
2 changed files with 13 additions and 13 deletions

View File

@ -575,17 +575,17 @@ function get_has_filter_suggestions(last, operators) {
const suggestions = [ const suggestions = [
{ {
search_string: "has:link", search_string: "has:link",
description_html: "messages with one or more link", description_html: "messages that contain links",
invalid: [{operator: "has", operand: "link"}], invalid: [{operator: "has", operand: "link"}],
}, },
{ {
search_string: "has:image", search_string: "has:image",
description_html: "messages with one or more image", description_html: "messages that contain images",
invalid: [{operator: "has", operand: "image"}], invalid: [{operator: "has", operand: "image"}],
}, },
{ {
search_string: "has:attachment", search_string: "has:attachment",
description_html: "messages with one or more attachment", description_html: "messages that contain attachments",
invalid: [{operator: "has", operand: "attachment"}], invalid: [{operator: "has", operand: "attachment"}],
}, },
]; ];
@ -747,7 +747,7 @@ export function get_search_result(base_query, query) {
// Display the default first // Display the default first
// `has` and `is` operators work only on predefined categories. Default suggestion // `has` and `is` operators work only on predefined categories. Default suggestion
// is not displayed in that case. e.g. `messages with one or more abc` as // is not displayed in that case. e.g. `messages that contain abc` as
// a suggestion for `has:abc`does not make sense. // a suggestion for `has:abc`does not make sense.
if (last.operator !== "" && last.operator !== "has" && last.operator !== "is") { if (last.operator !== "" && last.operator !== "has" && last.operator !== "is") {
suggestion = get_default_suggestion(search_operators); suggestion = get_default_suggestion(search_operators);

View File

@ -441,9 +441,9 @@ test("empty_query_suggestions", () => {
assert.equal(describe("is:unread"), "Unread messages"); assert.equal(describe("is:unread"), "Unread messages");
assert.equal(describe("is:resolved"), "Topics marked as resolved"); assert.equal(describe("is:resolved"), "Topics marked as resolved");
assert.equal(describe("sender:myself@zulip.com"), "Sent by me"); assert.equal(describe("sender:myself@zulip.com"), "Sent by me");
assert.equal(describe("has:link"), "Messages with one or more link"); assert.equal(describe("has:link"), "Messages that contain links");
assert.equal(describe("has:image"), "Messages with one or more image"); assert.equal(describe("has:image"), "Messages that contain images");
assert.equal(describe("has:attachment"), "Messages with one or more attachment"); assert.equal(describe("has:attachment"), "Messages that contain attachments");
}); });
test("has_suggestions", ({override}) => { test("has_suggestions", ({override}) => {
@ -462,17 +462,17 @@ test("has_suggestions", ({override}) => {
return suggestions.lookup_table.get(q).description_html; return suggestions.lookup_table.get(q).description_html;
} }
assert.equal(describe("has:link"), "Messages with one or more link"); assert.equal(describe("has:link"), "Messages that contain links");
assert.equal(describe("has:image"), "Messages with one or more image"); assert.equal(describe("has:image"), "Messages that contain images");
assert.equal(describe("has:attachment"), "Messages with one or more attachment"); assert.equal(describe("has:attachment"), "Messages that contain attachments");
query = "-h"; query = "-h";
suggestions = get_suggestions("", query); suggestions = get_suggestions("", query);
expected = ["-h", "-has:link", "-has:image", "-has:attachment"]; expected = ["-h", "-has:link", "-has:image", "-has:attachment"];
assert.deepEqual(suggestions.strings, expected); assert.deepEqual(suggestions.strings, expected);
assert.equal(describe("-has:link"), "Exclude messages with one or more link"); assert.equal(describe("-has:link"), "Exclude messages that contain links");
assert.equal(describe("-has:image"), "Exclude messages with one or more image"); assert.equal(describe("-has:image"), "Exclude messages that contain images");
assert.equal(describe("-has:attachment"), "Exclude messages with one or more attachment"); assert.equal(describe("-has:attachment"), "Exclude messages that contain attachments");
// operand suggestions follow. // operand suggestions follow.