App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-12-15] Search - Make users appear first in the result list over group chats or rooms

Open isagoico opened this issue 5 years ago β€’ 30 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Log in with an account that it's in a workspace and has rooms available
  2. Search for a user

Expected Result:

User should be prioritized over group chats or rooms. The prioritization should be:

  1. Person name (e.g. Ann)
  2. Room name (e.g. Ann, Joe or Ann's Room)
  3. Room Description (e.g. the image below) image

Actual Result:

Room is being prioritized over the user

Workaround:

No need.

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.15-1

Reproducible in staging?: Yes Reproducible in production?: Yes

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

image

Expensify/Expensify Issue URL:

Issue reported by: @mountiny Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1637012485218100

View all open jobs on GitHub

isagoico avatar Nov 18 '21 02:11 isagoico

Triggered auto assignment to @Jag96 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Nov 18 '21 02:11 MelvinBot

Proposal

  1. To do this we have to set the prioritizeDefaultRoomsInSearch: false for getSearchOptions. https://github.com/Expensify/App/blob/d2d17181727f2a4d264618986438df2733f107d0/src/libs/OptionsListUtils.js#L581

parasharrajat avatar Nov 18 '21 05:11 parasharrajat

I think Expected behaviour might be more complicated, I guess we should distinguish between the name and description.

Let's consider scenario where we search an and then we would want the #announce roome to be first before any person. Here in this case the #announce room is should because of the limited in the description.

We should first make sure we have the expected behaviour thought through before making this external. Thoughts about the behaviour @TomatoToaster and @trjExpensify?

mountiny avatar Nov 18 '21 12:11 mountiny

From the thread it sounds like we want to prioritize in this order:

  1. Person Name
  2. Room Name
  3. Room Description (Policy/Domain name in this case)

Let's consider scenario where we search an and then we would want the #announce room to be first before any person.

All rooms have the # at the beginning, right? So I'd think if you typed an you'd want to show results for people first, and if you typed #an you'd show the room results.

Jag96 avatar Nov 23 '21 00:11 Jag96

All rooms have the # at the beginning, right? So I'd think if you typed an you'd want to show results for people first, and if you typed #an you'd show the room results.

I agree with that! πŸ‘

Separately, do we need to consider the logic for GroupDMs versus DMs? As in, if you search Ted, you'd expect to return Ted first ahead of Ted, Joe wouldn't you?

trjExpensify avatar Nov 25 '21 00:11 trjExpensify

@Jag96 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

MelvinBot avatar Nov 26 '21 19:11 MelvinBot

Separately, do we need to consider the logic for GroupDMs versus DMs? As in, if you search Ted, you'd expect to return Ted first ahead of Ted, Joe wouldn't you?

That makes sense to me πŸ‘

Any other considerations to make here @vitHoracek @trjExpensify? If not we can make this external!

Jag96 avatar Nov 29 '21 17:11 Jag96

That also seems reasonable to me! I think we settled down on a good solution :)

mountiny avatar Nov 29 '21 20:11 mountiny

That was it from my POV at this point! πŸ‘

trjExpensify avatar Nov 29 '21 21:11 trjExpensify

Triggered auto assignment to @jboniface (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Nov 29 '21 21:11 MelvinBot

@parasharrajat I tried testing w/ your proposal and it looks good for single users vs rooms, but it looks like you can still see a group chat above a single user chat. Can you update your proposal so that single users are shown above group chats?

Jag96 avatar Nov 29 '21 22:11 Jag96

Ok. Great. Based on the expected behaviour https://github.com/Expensify/App/issues/6359#issuecomment-976021754. It can be fixed as follows:

  1. Set the prioritizeDefaultRoomsInSearch: false for getSearchOptions. https://github.com/Expensify/App/blob/d2d17181727f2a4d264618986438df2733f107d0/src/libs/OptionsListUtils.js#L581
  2. Add a new flag prioritizeOneToOneReportsInSearch. mark it true for getSearchOptions. Then add the following code after line OptionsListUtils.js#L510
    // If we are prioritizing 1:1 chats in search, do it only once we started searching
    if (prioritizeOneToOneReportsInSearch && searchValue !== '') {
        const [oneToOneReports, otherReports] = _.partition(recentReportOptions, option => !!option.login);
        recentReportOptions = oneToOneReports.concat(otherReports);
    }

It will satisfy all three.

parasharrajat avatar Nov 30 '21 10:11 parasharrajat

@parasharrajat that sounds good to me! @jboniface let's hire @parasharrajat for this one

Jag96 avatar Nov 30 '21 17:11 Jag96

πŸ“£ @parasharrajat You have been assigned to this job by @Jag96! Please apply to this job in Upwork and let us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

MelvinBot avatar Nov 30 '21 17:11 MelvinBot

Current assignee @parasharrajat is eligible for the Exported assigner, not assigning anyone new.

MelvinBot avatar Dec 01 '21 23:12 MelvinBot

Current assignee @Jag96 is eligible for the Exported assigner, not assigning anyone new.

MelvinBot avatar Dec 01 '21 23:12 MelvinBot

@parasharrajat I created the job and sent an offer!

Jag96 avatar Dec 01 '21 23:12 Jag96

@parasharrajat I tried testing w/ your proposal and it looks good for single users vs rooms, but it looks like you can still see a group chat above a single user chat. Can you update your proposal so that single users are shown above group chats?

Ah, so one thing here @parasharrajat. I was just chatting to @Jag96, but I think this was the logic for most recent when there’s a tiebreaker in the DMs match?

As in, if we have Joe and Joe, Ted. I just sent a message in Joe, Ted and I search for Joe it would show Joe, Ted before Tom.

Does everyone agree we should reinstate that if it was removed? If so, happy to add a milestone on to this Upwork contract to account for it πŸ‘

trjExpensify avatar Dec 01 '21 23:12 trjExpensify

Does everyone agree we should reinstate that if it was removed? If so, happy to add a milestone on to this Upwork contract to account for it πŸ‘

Yup, I forgot about this sorry. I think adding a milestone to the Upwork contract is fine.

Jag96 avatar Dec 01 '21 23:12 Jag96

Ok. understood but @Jag96 could you please lay down all the update cases once again so that I can decide what to do to cover all?

parasharrajat avatar Dec 03 '21 16:12 parasharrajat