mirror of https://github.com/zulip/zulip.git
search_suggestion: Change suggestion string for has: operator.
Earlier in search suggestion, has: operator returned two different suggestion string which were `messages with one or more links` and `messages that contain links`. This commit changes this to a consistent suggestion string. Fixes: zulip#30908
This commit is contained in:
parent
52d8813214
commit
f7c3f1414d
|
@ -665,7 +665,7 @@ export class Filter {
|
||||||
|
|
||||||
// Note: We hack around using this in "describe" below.
|
// Note: We hack around using this in "describe" below.
|
||||||
case "has":
|
case "has":
|
||||||
return verb + "messages with one or more";
|
return verb + "messages with";
|
||||||
|
|
||||||
case "id":
|
case "id":
|
||||||
return verb + "message ID";
|
return verb + "message ID";
|
||||||
|
|
|
@ -720,25 +720,25 @@ function get_has_filter_suggestions(last: NarrowTerm, terms: NarrowTerm[]): Sugg
|
||||||
const suggestions: SuggestionAndIncompatiblePatterns[] = [
|
const suggestions: SuggestionAndIncompatiblePatterns[] = [
|
||||||
{
|
{
|
||||||
search_string: "has:link",
|
search_string: "has:link",
|
||||||
description_html: "messages that contain links",
|
description_html: "messages with links",
|
||||||
is_people: false,
|
is_people: false,
|
||||||
incompatible_patterns: [{operator: "has", operand: "link"}],
|
incompatible_patterns: [{operator: "has", operand: "link"}],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
search_string: "has:image",
|
search_string: "has:image",
|
||||||
description_html: "messages that contain images",
|
description_html: "messages with images",
|
||||||
is_people: false,
|
is_people: false,
|
||||||
incompatible_patterns: [{operator: "has", operand: "image"}],
|
incompatible_patterns: [{operator: "has", operand: "image"}],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
search_string: "has:attachment",
|
search_string: "has:attachment",
|
||||||
description_html: "messages that contain attachments",
|
description_html: "messages with attachments",
|
||||||
is_people: false,
|
is_people: false,
|
||||||
incompatible_patterns: [{operator: "has", operand: "attachment"}],
|
incompatible_patterns: [{operator: "has", operand: "attachment"}],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
search_string: "has:reaction",
|
search_string: "has:reaction",
|
||||||
description_html: "messages that contain reactions",
|
description_html: "messages with reactions",
|
||||||
is_people: false,
|
is_people: false,
|
||||||
incompatible_patterns: [{operator: "has", operand: "reaction"}],
|
incompatible_patterns: [{operator: "has", operand: "reaction"}],
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
{{~!-- squash whitespace --~}}
|
{{~!-- squash whitespace --~}}
|
||||||
{{else if (eq this.type "prefix_for_operator")}}
|
{{else if (eq this.type "prefix_for_operator")}}
|
||||||
{{~!-- squash whitespace --~}}
|
{{~!-- 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 --~}}
|
{{~!-- squash whitespace --~}}
|
||||||
{{else if (eq this.type "user_pill")}}
|
{{else if (eq this.type "user_pill")}}
|
||||||
{{~!-- squash whitespace --~}}
|
{{~!-- squash whitespace --~}}
|
||||||
|
|
|
@ -1500,7 +1500,7 @@ test("describe", ({mock_template}) => {
|
||||||
{operator: "channel", operand: "devel"},
|
{operator: "channel", operand: "devel"},
|
||||||
{operator: "has", operand: "image", negated: true},
|
{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);
|
assert.equal(Filter.search_description_as_html(narrow), string);
|
||||||
|
|
||||||
narrow = [
|
narrow = [
|
||||||
|
@ -1514,7 +1514,7 @@ test("describe", ({mock_template}) => {
|
||||||
{operator: "has", operand: "image", negated: true},
|
{operator: "has", operand: "image", negated: true},
|
||||||
{operator: "channel", operand: "devel"},
|
{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);
|
assert.equal(Filter.search_description_as_html(narrow), string);
|
||||||
|
|
||||||
narrow = [];
|
narrow = [];
|
||||||
|
|
|
@ -381,9 +381,9 @@ test("empty_query_suggestions", () => {
|
||||||
assert.equal(describe("is:resolved"), "Topics marked as resolved");
|
assert.equal(describe("is:resolved"), "Topics marked as resolved");
|
||||||
assert.equal(describe("is:followed"), "Followed topics");
|
assert.equal(describe("is:followed"), "Followed topics");
|
||||||
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 that contain links");
|
assert.equal(describe("has:link"), "Messages with links");
|
||||||
assert.equal(describe("has:image"), "Messages that contain images");
|
assert.equal(describe("has:image"), "Messages with images");
|
||||||
assert.equal(describe("has:attachment"), "Messages that contain attachments");
|
assert.equal(describe("has:attachment"), "Messages with attachments");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("has_suggestions", ({override, mock_template}) => {
|
test("has_suggestions", ({override, mock_template}) => {
|
||||||
|
@ -404,17 +404,17 @@ test("has_suggestions", ({override, mock_template}) => {
|
||||||
return suggestions.lookup_table.get(q).description_html;
|
return suggestions.lookup_table.get(q).description_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(describe("has:link"), "Messages that contain links");
|
assert.equal(describe("has:link"), "Messages with links");
|
||||||
assert.equal(describe("has:image"), "Messages that contain images");
|
assert.equal(describe("has:image"), "Messages with images");
|
||||||
assert.equal(describe("has:attachment"), "Messages that contain attachments");
|
assert.equal(describe("has:attachment"), "Messages with attachments");
|
||||||
|
|
||||||
query = "-h";
|
query = "-h";
|
||||||
suggestions = get_suggestions(query);
|
suggestions = get_suggestions(query);
|
||||||
expected = ["-h", "-has:link", "-has:image", "-has:attachment", "-has:reaction"];
|
expected = ["-h", "-has:link", "-has:image", "-has:attachment", "-has:reaction"];
|
||||||
assert.deepEqual(suggestions.strings, expected);
|
assert.deepEqual(suggestions.strings, expected);
|
||||||
assert.equal(describe("-has:link"), "Exclude messages that contain links");
|
assert.equal(describe("-has:link"), "Exclude messages with links");
|
||||||
assert.equal(describe("-has:image"), "Exclude messages that contain images");
|
assert.equal(describe("-has:image"), "Exclude messages with images");
|
||||||
assert.equal(describe("-has:attachment"), "Exclude messages that contain attachments");
|
assert.equal(describe("-has:attachment"), "Exclude messages with attachments");
|
||||||
|
|
||||||
// operand suggestions follow.
|
// operand suggestions follow.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue