Skip to content

Further clean up the topic list filtering typeahead logic. #35485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shuklamaneesh23
Copy link
Collaborator

@shuklamaneesh23 shuklamaneesh23 commented Jul 28, 2025

This PR addresses several improvements related to how pills are implemented and displayed:

  • Replaces usage of search_pill with a minimal wrapper module (topic_filter_pill.ts), similar to the approach used in web/src/integration_branch_pill.ts.
  • Refactors get_typeahead_search_term to use data-syntax attribute instead of relying on text/string matching to determine filtering logic.
  • Restores display of description labels instead of raw syntax in the pill UI, now that filtering logic is decoupled from the displayed text.

Fixes part of: #35284.

Screenshots and screen captures:

After Before
Screenshot 2025-07-28 at 6 39 58 PM Screenshot 2025-07-28 at 6 41 52 PM
Screenshot 2025-07-28 at 6 40 06 PM Screenshot 2025-07-28 at 6 41 58 PM
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

This commit adds the `data-syntax` attribute for
`get_typeahead_search_term` to determine the appropriate filtering logic
, rather than relying on plain text or strings.

Additionally, this fix restores the use of the description label instead
of the syntax when displaying the pills.

Fixes part of zulip#35284.
@shuklamaneesh23
Copy link
Collaborator Author

@zulipbot add "buddy review"

@zulipbot zulipbot added the buddy review GSoC buddy review needed. label Jul 28, 2025
@kuv2707
Copy link
Collaborator

kuv2707 commented Jul 28, 2025

Looks good to me!
@zulipbot remove "buddy review"
@zulipbot add "mentor review"

@zulipbot zulipbot added mentor review GSoC mentor review needed. and removed buddy review GSoC buddy review needed. labels Jul 28, 2025
@shuklamaneesh23
Copy link
Collaborator Author

Hey @alya, could you please take a look at it and let me know if the text on the pill now looks good to you?
Thanks!

@sujalshah-bit
Copy link
Collaborator

Will look into soon.

@@ -1,4 +1,4 @@
<div class='pill {{#if deactivated}} deactivated-pill {{/if}}'{{#if user_id}}data-user-id="{{user_id}}"{{/if}}{{#if group_id}}data-user-group-id="{{group_id}}"{{/if}}{{#if stream_id}}data-stream-id="{{stream_id}}"{{/if}} tabindex=0>
<div class='pill {{#if deactivated}} deactivated-pill {{/if}}'{{#if user_id}}data-user-id="{{user_id}}"{{/if}}{{#if group_id}}data-user-group-id="{{group_id}}"{{/if}}{{#if stream_id}}data-stream-id="{{stream_id}}"{{/if}}{{#if data_syntax}}data-syntax="{{data_syntax}}"{{/if}} tabindex=0>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should be line-wrapping this so each if/else clause for data fields is on its own line.

@@ -484,8 +484,11 @@ export function get_left_sidebar_topic_search_term(): string {

export function get_typeahead_search_term(): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function name should probably be get_typeahead_search_pills_syntax or something.

This also seems very wrong as code if there's ever multiple pills. I guess that's not possible for now, but it's a code smell for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mentor review GSoC mentor review needed. size: XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants