zulip / zulip

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
https://zulip.com
Apache License 2.0
21.51k stars 7.8k forks source link

sender:me can't be parsed as a search pill #31315

Open evykassirer opened 2 months ago

evykassirer commented 2 months ago

Followup to https://github.com/zulip/zulip/pull/31173#discussion_r1704884030

If you type "sender:me" and then press enter without a typeahead option selected, it doesn't get turned into a pill. It does show the right dropdown option that can be selected, but validating "sender:me" parses "me" as an email and makes it invalid.

zulipbot commented 2 months ago

Hello @zulip/server-search members, this issue was labeled with the "area: search" label, so you may want to check it out!

mitesh092 commented 1 month ago

@zulipbot claim

zulipbot commented 1 month ago

Welcome to Zulip, @mitesh092! We just sent you an invite to collaborate on this repository at https://github.com/zulip/zulip/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:

As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!

mitesh092 commented 1 month ago

Hi @evykassirer,

I have made the necessary changes to address the issue where sender: me was not being parsed as a search pill. Here’s a summary of what was done:

Solution Applied: I updated the code to handle the specific case where the search string ends with "sender:me". The fix involves adjusting the search_string assignment to check if the last part of the query is "sender:me". If it is, the search_string is set to sender_me_query instead of sender_query. This ensures that "sender:me" is properly parsed and converted into a search pill.

code preview: search_string: last_string === "sender:me" ? sender_me_query : sender_query,

### Testing: The code has been tested to confirm that sender:me is now correctly parsed and displayed as a search pill.

Screenshot 2024-09-05 061641

I will now proceed to open a pull request with these changes.

Thank you!