Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

search: Fix bug preventing closing regular search pills.

evykassirerfc2ce3deb2d8
diff --git a/web/src/search_pill.ts b/web/src/search_pill.ts
index 9963cbb7b4f..44803e1f90d 100644
--- a/web/src/search_pill.ts
+++ b/web/src/search_pill.ts
@@ -65,21 +65,22 @@ export function get_search_string_from_item(item: SearchPill): string {
// to e.g. remove a user from a group-DM pill without deleting the whole
// DM pill.
function on_pill_exit(
- clicked_pill: HTMLElement,
+ clicked_element: HTMLElement,
all_pills: InputPill<SearchPill>[],
remove_pill: (pill: HTMLElement) => void,
): void {
- const $user_pill_container = $(clicked_pill).parents(".user-pill-container");
+ const $user_pill_container = $(clicked_element).parents(".user-pill-container");
if (!$user_pill_container.length) {
// This is just a regular search pill, so we don't need to do fancy logic.
- remove_pill(clicked_pill);
+ const $clicked_pill = $(clicked_element).closest(".pill");
+ remove_pill($clicked_pill[0]!);
return;
}
// The user-pill-container container class is used exclusively for
// group-DM search pills, where multiple user pills sit inside a larger
// pill. The exit icons in those individual user pills should remove
// just that pill, not the outer pill.
- const user_id_string = $(clicked_pill).closest(".pill").attr("data-user-id");
+ const user_id_string = $(clicked_element).closest(".pill").attr("data-user-id");
assert(user_id_string !== undefined);
const user_id = Number.parseInt(user_id_string, 10);