Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
filter: Remove user pill context for user suggestions.
Pratik Chanda1a700d8bac66
diff --git a/web/src/filter.ts b/web/src/filter.tsindex 54e54799326..bc2008f900c 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -12,10 +12,8 @@ import * as message_store from "./message_store.ts";import type {Message} from "./message_store.ts";import * as muted_users from "./muted_users.ts";import {page_params} from "./page_params.ts";-import type {User} from "./people.ts";import * as people from "./people.ts";import * as resolved_topic from "./resolved_topic.ts";-import type {UserPillItem} from "./search_suggestion.ts";import {current_user, narrow_canonical_term_schema, narrow_operator_schema} from "./state_data.ts";import type {NarrowCanonicalTerm, NarrowTerm, NarrowTermSuggestion} from "./state_data.ts";import * as stream_data from "./stream_data.ts";@@ -66,17 +64,8 @@ type Part =prefix_for_operator: string;operand: string;is_empty_string_topic?: boolean;- }- | {- type: "user_pill";- operator: string;- users: ValidOrInvalidUser[];};-type ValidOrInvalidUser =- | {valid_user: true; user_pill_context: UserPillItem}- | {valid_user: false; operand: string};-const channels_operands = new Set(["public", "web-public"]);function message_in_home(message: Message): boolean {@@ -223,19 +212,6 @@ function message_matches_search_term(message: Message, term: NarrowTerm): booleareturn true; // unknown operators return true (effectively ignored)}-// For when we don't need to do highlighting-export function create_user_pill_context(user: User): UserPillItem {- const avatar_url = people.small_avatar_url_for_person(user);-- return {- id: user.user_id,- display_value: user.full_name,- has_image: true,- img_src: avatar_url,- should_add_guest_user_indicator: people.should_add_guest_user_indicator(user.user_id),- };-}-const USER_OPERATORS = new Set(["dm-including","dm",@@ -790,31 +766,6 @@ export class Filter {};}const prefix_for_operator = Filter.operator_to_prefix(term.operator, term.negated);- if (- term.operator === "sender" ||- term.operator === "dm" ||- term.operator === "dm-including"- ) {- const user_emails = term.operand.split(",");- const users: ValidOrInvalidUser[] = user_emails.map((email) => {- const person = people.get_by_email(email);- if (person === undefined) {- return {- valid_user: false,- operand: email,- };- }- return {- valid_user: true,- user_pill_context: create_user_pill_context(person),- };- });- return {- type: "user_pill",- operator: prefix_for_operator,- users,- };- }if (prefix_for_operator !== "") {if (term.operator === "channel") {const stream = stream_data.get_sub_by_id_string(term.operand);diff --git a/web/src/search_suggestion.ts b/web/src/search_suggestion.tsindex f9a56926194..e28418c2dfd 100644--- a/web/src/search_suggestion.ts+++ b/web/src/search_suggestion.ts@@ -18,14 +18,6 @@ import * as stream_topic_history_util from "./stream_topic_history_util.ts";import * as typeahead_helper from "./typeahead_helper.ts";import * as util from "./util.ts";-export type UserPillItem = {- id: number;- display_value: string;- has_image: boolean;- img_src: string;- should_add_guest_user_indicator: boolean;-};-type ChannelTopicEntry = {channel_id: string;topic: string;diff --git a/web/templates/search_description.hbs b/web/templates/search_description.hbsindex 8b22e70b622..b288954926a 100644--- a/web/templates/search_description.hbs+++ b/web/templates/search_description.hbs@@ -22,17 +22,6 @@{{~ else ~}}{{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}}{{~/if~}}- {{else if (eq this.type "user_pill")}}- {{~!-- squash whitespace --~}}- {{this.operator}}- {{~#each this.users}}- {{#if this.valid_user}}- {{> user_pill .}}- {{else}}- {{this.operand}}- {{/if}}- {{~/each~}}- {{~!-- squash whitespace --~}}{{else if (eq this.type "is_operator")}}{{#if (eq this.operand "mentioned")}}{{~!-- squash whitespace --~}}diff --git a/web/templates/user_pill.hbs b/web/templates/user_pill.hbsdeleted file mode 100644index beaa5605d46..00000000000--- a/web/templates/user_pill.hbs+++ /dev/null@@ -1,3 +0,0 @@-<span class="user-pill pill-container pill-container-button">- {{> input_pill user_pill_context }}-</span>diff --git a/web/tests/search_suggestion.test.cjs b/web/tests/search_suggestion.test.cjsindex 801e6265903..4fd310e3e06 100644--- a/web/tests/search_suggestion.test.cjs+++ b/web/tests/search_suggestion.test.cjs@@ -150,9 +150,7 @@ test("get_is_suggestions_for_spectator", () => {page_params.is_spectator = false;});-test("dm_suggestions", ({override, mock_template}) => {- mock_template("search_description.hbs", true, (_data, html) => html);-+test("dm_suggestions", ({override}) => {let query = "is:dm";let suggestions = get_suggestions(query);let expected = [