Skip to content
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

[$250] [Search v2.1] - (you) disappears after selecting own user name #47712

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 20, 2024 · 28 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 20, 2024

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


Version Number: 9.0.22-5
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com/search/filters
  2. Click From or To
  3. Select your user name

Expected Result:

(you) will not disappear after selecting own user name

Actual Result:

(you) disappears after selecting own user name

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6576827_1724140883869.bandicam_2024-08-20_15-59-12-380.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bc33a0aabc7f4ab9
  • Upwork Job ID: 1826026505817504872
  • Last Price Increase: 2024-08-27
  • Automatic offers:
    • FitseTLT | Contributor | 103781419
Issue OwnerCurrent Issue Owner: @FitseTLT
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 20, 2024
Copy link

melvin-bot bot commented Aug 20, 2024

Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@twisterdotcom FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@etCoderDysto
Copy link
Contributor

etCoderDysto commented Aug 20, 2024

Edited by proposal-police: This proposal was edited at 2024-08-20 13:39:32 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

(you) disappears after selecting own user name

What is the root cause of that problem?

When the user selects their account, In getParticipantsOption, we assign assign displayName which is the users name without (you) to text

function getParticipantsOption(participant: ReportUtils.OptionData | Participant, personalDetails: OnyxEntry<PersonalDetailsList>): Participant {
const detail = getPersonalDetailsForAccountIDs([participant.accountID ?? -1], personalDetails)[participant.accountID ?? -1];
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const login = detail?.login || participant.login || '';
const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(detail, LocalePhoneNumber.formatPhoneNumber(login));
return {
keyForList: String(detail?.accountID),
login,
accountID: detail?.accountID ?? -1,
text: displayName,

And the text prop will be used to render the users display name in InviteMemberListItem component

getParticipantsOption is called here by formatSectionsFromSearchTerm

return isPolicyExpenseChat ? getPolicyExpenseReportOption(participant) : getParticipantsOption(participant, personalDetails);

And formatSectionsFromSearchTerm is called here to fetch section

const formattedResults = OptionsListUtils.formatSectionsFromSearchTerm(
cleanSearchTerm,

Then the section will be used by SectionList

What changes do you think we should make in order to solve the problem?

Since participant.text has the display name that includes (you) we should assign participant.text to text prop and fallback to displayName if participant.text is undefiend

text: participant?.text ?? displayName,

What alternative solutions did you explore? (Optional)

@FitseTLT
Copy link
Contributor

FitseTLT commented Aug 20, 2024

Edited by proposal-police: This proposal was edited at 2024-08-20 14:33:24 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Search filters - (you) disappears after selecting own user name

What is the root cause of that problem?

We are properly setting (you) to current user here

if (chatOptions.currentUserOption && !isCurrentUserSelected) {
const formattedName = ReportUtils.getDisplayNameForParticipant(chatOptions.currentUserOption.accountID, false, true, true, personalDetails);
newSections.push({

but only doing it when current user is not selected

What changes do you think we should make in order to solve the problem?

We should do the same update of text we did here for selected current user too
So change this to

   const currentUserSelected = formattedResults.section.data.find((option) => option.accountID === chatOptions.currentUserOption?.accountID);
        newSections.push(formattedResults.section);

        if (chatOptions.currentUserOption) {
            const formattedName = ReportUtils.getDisplayNameForParticipant(chatOptions.currentUserOption.accountID, false, true, true, personalDetails);
            if (!currentUserSelected) {
                newSections.push({
                    title: '',
                    data: [{...chatOptions.currentUserOption, text: formattedName}],
                    shouldShow: true,
                });
            } else {
                currentUserSelected.text = formattedName;
            }
        }

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

The (you) text disappears from the current user option after selecting it.

What is the root cause of that problem?

When the current user is not selected yet, we format the name using getDisplayNameForParticipant and pass shouldAddCurrentUserPostfix as true which adds the (you) suffix.

if (chatOptions.currentUserOption && !isCurrentUserSelected) {
const formattedName = ReportUtils.getDisplayNameForParticipant(chatOptions.currentUserOption.accountID, false, true, true, personalDetails);
newSections.push({
title: '',
data: [{...chatOptions.currentUserOption, text: formattedName}],

When the user is selected, the selected options is formatted with OptionsListUtils.formatSectionsFromSearchTerm > getParticipantsOption.

const formattedResults = OptionsListUtils.formatSectionsFromSearchTerm(
cleanSearchTerm,
selectedOptions,

return isPolicyExpenseChat ? getPolicyExpenseReportOption(participant) : getParticipantsOption(participant, personalDetails);

In getParticipantsOption, the text is from PersonalDetailsUtils.getDisplayNameOrDefault whcih doesn't contains the (you) suffix because we don't pass shouldAddCurrentUserPostfix to it.

const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(detail, LocalePhoneNumber.formatPhoneNumber(login));

What changes do you think we should make in order to solve the problem?

Pass as true for shouldAddCurrentUserPostfix to getDisplayNameOrDefault.

const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(detail, LocalePhoneNumber.formatPhoneNumber(login), undefined, shouldAddCurrentUserPostfix);

This will require us to pass down the value as true from SearchFiltersParticipantsSelector > formatSectionsFromSearchTerm > getParticipantsOption.

@twisterdotcom twisterdotcom added the External Added to denote the issue can be worked on by a contributor label Aug 20, 2024
@melvin-bot melvin-bot bot changed the title Search filters - (you) disappears after selecting own user name [$250] Search filters - (you) disappears after selecting own user name Aug 20, 2024
Copy link

melvin-bot bot commented Aug 20, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01bc33a0aabc7f4ab9

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 20, 2024
Copy link

melvin-bot bot commented Aug 20, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

Copy link

melvin-bot bot commented Aug 26, 2024

@twisterdotcom, @abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Aug 26, 2024
@abdulrahuman5196
Copy link
Contributor

Hi, came back from weekend. Will check in the morning.

@melvin-bot melvin-bot bot removed the Overdue label Aug 26, 2024
Copy link

melvin-bot bot commented Aug 27, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@abdulrahuman5196
Copy link
Contributor

@FitseTLT 's proposal here #47712 (comment) looks good and works well. It aims to fix the issue in the SearchFiltersParticipantsSelector similar to existing approach of showing (you).

🎀 👀 🎀
C+ Reviewed

Copy link

melvin-bot bot commented Aug 29, 2024

Triggered auto assignment to @Gonals, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@bernhardoj
Copy link
Contributor

@abdulrahuman5196 any opinion with my proposal?

I think the selected proposal doesn't follow a similar approach. The approach is mutating the item returned from the array below.

const isCurrentUserSelected = selectedOptions.find((option) => option.accountID === chatOptions.currentUserOption?.accountID);

The current approach is, selected options are formatted by OptionsListUtils.formatSectionsFromSearchTerm and then pushed to the list. If the current user isn't selected, we push the current user with (you) suffix to the list. If the user is selected, then it will be handled by OptionsListUtils.formatSectionsFromSearchTerm, just like the other selected items.

Also, the selected proposal will cause the current user to always be at the top even though there are selected items.
image

@FitseTLT
Copy link
Contributor

FitseTLT commented Aug 29, 2024

Also, the selected proposal will cause the current user to always be at the top even though there are selected items.

@abdulrahuman5196 It's because I moved down the newSections.push(formattedResults.section); below the if block I have updated and moved it back. It works fine now.
We alrdeay have a code that concatenates (you)

data: [{...chatOptions.currentUserOption, text: formattedName}],

the only problem we forgot to do the same for selected list so my approach is indeed using the same as existing approach.

2024-08-29.20-47-03.mp4

@abdulrahuman5196
Copy link
Contributor

@bernhardoj

I think the selected proposal doesn't follow a similar approach. The approach is mutating the item returned from the array below.

I noticed that during approval, but its more like a PR code fix.
for the issue you mentioned, we can fix that during PR since we don't consider the proposal code to be the expect PR code.

any opinion with my proposal?
Pass as true for shouldAddCurrentUserPostfix to getDisplayNameOrDefault

I was not aligned in passing shouldAddCurrentUserPostfix as true in the common helper method usecase. Since the default value of shouldAddCurrentUserPostfix in getDisplayNameOrDefault is false and I have also noticed we are not passing it as true in multiple common places.

@bernhardoj
Copy link
Contributor

bernhardoj commented Aug 29, 2024

I was not aligned in passing shouldAddCurrentUserPostfix as true in the common helper method usecase. Since the default value of shouldAddCurrentUserPostfix in getDisplayNameOrDefault is false and I have also noticed we are not passing it as true in multiple common places.

I don't see why this is a problem since we only pass it as true in the filter page just like we did with the non-selected current user section.

I think the selected proposal doesn't follow a similar approach. The approach is mutating the item returned from the array below.

I noticed that during approval, but its more like a PR code fix.

I believe the root issue is that we are not formatting it inside OptionsListUtils.formatSectionsFromSearchTerm (assuming you agree with this), but the selected proposal explanation is revolving around mutating the array and lacks the explanation that we already did some formatting inside OptionsListUtils.formatSectionsFromSearchTerm which is why I posted my proposal because I think the approach is very different.

^ just an explaination why I posted my proposal 😄, i'll accept any decision

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Sep 2, 2024
Copy link

melvin-bot bot commented Sep 2, 2024

📣 @FitseTLT 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@twisterdotcom
Copy link
Contributor

We have an assignee @MelvinBot

@melvin-bot melvin-bot bot removed the Overdue label Sep 2, 2024
Copy link

melvin-bot bot commented Sep 3, 2024

@twisterdotcom @Gonals @FitseTLT @abdulrahuman5196 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@FitseTLT
Copy link
Contributor

FitseTLT commented Sep 3, 2024

PR will be up tomorrow

@FitseTLT
Copy link
Contributor

bump for a review @abdulrahuman5196

@luacmartins luacmartins changed the title [$250] Search filters - (you) disappears after selecting own user name [$250] [Search v2.1] - (you) disappears after selecting own user name Sep 19, 2024
@FitseTLT
Copy link
Contributor

A PR was raised and under review but another PR fixed it so I had to close it.

@luacmartins
Copy link
Contributor

It seems like we can close this issue then?

@luacmartins luacmartins moved this from Polish to Done in [#whatsnext] #expense Sep 23, 2024
@FitseTLT
Copy link
Contributor

@twisterdotcom PR was raised and was on review; I think Payment is due here.

@abdulrahuman5196
Copy link
Contributor

@twisterdotcom PR was raised and was on review; I think Payment is due here.

Yeah. Same is mentioned in C+ doc as well

@twisterdotcom
Copy link
Contributor

Aha, I see.

If a contributor has been hired for a job and we decide to close the job before it is successfully completed, full payment is due for the hired contributor. If the C+ only reviewed proposals and not a PR, they are eligible for 50%. If they started reviewing a PR it's 100%. One caveat here might be if the hired contributor wasn't working on their PR with urgency.

Okay, cool, @abdulrahuman5196 was actively reviewing, so let's do both $250.

Payment Summary:

@JmillsExpensify
Copy link

$250 approved for @abdulrahuman5196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Status: Done
Development

No branches or pull requests

9 participants