Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.56k stars 2.9k forks source link

[HOLD for payment 2023-06-28] [$1000] Web - Split Bill - Profile picture still shows avatar on a new split money page #20118

Closed kbecciv closed 1 year ago

kbecciv commented 1 year ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open NewDot staging on web chrome.
  2. Create a workspace (if you don't already have one). Invite a second member to the workspace.
  3. Go to the workspace's announce room.
  4. Split a bill between the two workspace members.
  5. Click the bill split from within the announce room (so it opens the RHN with the details of the bill split.)
  6. Click the settings tab and change your profile image.
  7. Go back to the announce room, click into the bill split, and notice that your old profile image is display in the details page.

Expected Result:

Profile picture should be updated on a new split money page

Actual Result:

Profile picture still shows avatar on a new split money page

Workaround:

Unknown

Platforms:

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

Version Number: 1.3.22.0

Reproducible in staging?: n/a

Reproducible in production?: n/a

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

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

Notes/Photos/Videos: Any additional supporting documentation

https://github.com/Expensify/App/assets/93399543/af62a462-2350-4325-a493-57f36d5ef618

Expensify/Expensify Issue URL:

Issue reported by: @avi-shek-jha

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685417843739759

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015e350d1e95099cb9
  • Upwork Job ID: 1665846988733915136
  • Last Price Increase: 2023-06-12
melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @joekaufmanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] commented 1 year ago

Bug0 Triage Checklist (Main S/O)

dukenv0307 commented 1 year ago

Proposal

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

Old Profile picture still shows avatar on a new split money page

What is the root cause of that problem?

The cause is we get payeePersonalDetails from participants that is converted to optionSelector from personalDetails with format here https://github.com/Expensify/App/blob/9fa12f3cd6bc422d2b9723ac98d575c7ce48f05d/src/libs/OptionsListUtils.js#L216-L230 https://github.com/Expensify/App/blob/9fa12f3cd6bc422d2b9723ac98d575c7ce48f05d/src/pages/iou/SplitBillDetailsPage.js#L69 While getIOUConfirmationOptionsFromPayeePersonalDetail fuction get data from fields that follow personalDetailsPropType. https://github.com/Expensify/App/blob/9fa12f3cd6bc422d2b9723ac98d575c7ce48f05d/src/libs/OptionsListUtils.js#L804 Because personalDetail.avatar and personalDetail.displayname is undefined, text is email or phone number instead of display name https://github.com/Expensify/App/blob/9fa12f3cd6bc422d2b9723ac98d575c7ce48f05d/src/libs/OptionsListUtils.js#L806 and avatar is default avatar instead of current avatar https://github.com/Expensify/App/blob/9fa12f3cd6bc422d2b9723ac98d575c7ce48f05d/src/libs/OptionsListUtils.js#L810

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

We have two solution to fix payee issue

  1. In SpliBillDetailPage, we get payeePersonalDetails from personalDetails instead of participants https://github.com/Expensify/App/blob/9fa12f3cd6bc422d2b9723ac98d575c7ce48f05d/src/pages/iou/SplitBillDetailsPage.js#L69
  2. In getIOUConfirmationOptionsFromPayeePersonalDetail function, we only need return personalDetail and other fields that we need because personalDetail now was converted to option
    return {
    ...personalDetail
    descriptiveText: amountText,
    };

    What alternative solutions did you explore? (Optional)

GItGudRatio commented 1 year ago

Proposal

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

In this issue, we can notice that when we open the Split Bill Details Page, the payee's avatar is not shown correctly.

What is the root cause of that problem?

The root cause behind this issue is that the default avatar URL is passed to the avatar component instead of the user avatar.

This happens because to get the payee's user details, we use the OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail function. This uses the personalDetails.avatar to get the user's avatar. This is not correct because the payee's details in this.props.payeePersonalDetails are of the format:

{
    "icons": [
        {
            "source": "https://d1wpcgnaa73g0y.cloudfront.net/0fb18190762aaf5fa9f5f91acd2b54a0bbc520f1_128.jpeg",
            "name": "...",
            "type": "avatar"
        }
    ],
    "payPalMeAddress": "",
    "phoneNumber": ""
}

https://github.com/Expensify/App/blob/0813e2ca1476635a8324cbd9f998424663a33128/src/components/MoneyRequestConfirmationList.js#L198-L201

https://github.com/Expensify/App/blob/245364fd417e1e00ce2dc6996d0c0f030d4687a4/src/libs/OptionsListUtils.js#L810

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

If there is no props.payeePersonalDetails, it fallbacks to this.props.currentUserPersonalDetails, which has the personalDetails.avatar property. A good way to fix this issue would be to use ternary operators to check if the property avatar exists on the personalDetails object, then use that property else look for icons[0].source or vice versa and pass that to the UserUtils.getAvatar accordingly.

What alternative solutions did you explore? (Optional)

Alternatively, we can modify the personal details prop to use avatar instead of the icons array. https://github.com/Expensify/App/blob/245364fd417e1e00ce2dc6996d0c0f030d4687a4/src/pages/iou/SplitBillDetailsPage.js#L69

joekaufmanexpensify commented 1 year ago

I can reproduce this. Interestingly, the profile image in the LHN and in the settings tab is also not updating right away after changing it. Although both do update after refreshing the session. Whereas the image on the bill split detailed page does not.

joekaufmanexpensify commented 1 year ago

https://github.com/Expensify/App/assets/54866469/1e372f58-22d4-4750-9052-e63b0cc09c7b

melvin-bot[bot] commented 1 year ago

Job added to Upwork: https://www.upwork.com/jobs/~015e350d1e95099cb9

melvin-bot[bot] commented 1 year ago

Current assignee @joekaufmanexpensify is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

parasharrajat commented 1 year ago

Reviewing...

joekaufmanexpensify commented 1 year ago

Sounds good, thanks @parasharrajat !

joekaufmanexpensify commented 1 year ago

@parasharrajat are we good to proceed with either of these proposals?

joekaufmanexpensify commented 1 year ago

Bumped proposals in slack here

parasharrajat commented 1 year ago

Solution 1 from @dukenv0307 's proposal looks good to me. It seems a simple mistake that we get the payee's personal details from the participants. We do need an option structure for the payee to render but we have a function to convert the personal details to option type. As we fallback to current user personal details, it is clear that payeePersonalDetails should be some type of currentuserpersonalDetails and https://github.com/Expensify/App/blob/9fa12f3cd6bc422d2b9723ac98d575c7ce48f05d/src/components/MoneyRequestConfirmationList.js#L178 should return the same type.

cc: @flodnv

:ribbon: :eyes: :ribbon: C+ reviewed

bernhardoj commented 1 year ago

Sharing my opinion:

I think @dukenv0307 2nd proposal looks better. Filtering personalDetails (especially in HT account) doesn't sounds good.

parasharrajat commented 1 year ago

personalDetails are indexed based on login so IMO, it is O(1) to get the details when we have a login. Also, OptionsListUtils.getPersonalDetailsForLogins can be used for this purpose.

Am I missing something?

dukenv0307 commented 1 year ago

@parasharrajat As @bernhardoj mentioned above we are using filter function to get payeeDetails now and he thinks is not good. So shoud we get payeePersonalDetails by personalDetails[reportAction.actorEmail] instead of using filter function.

_.filter(participants, (participant) => participant.login === reportAction.actorEmail)[0]; 
bernhardoj commented 1 year ago

Ah, you're right. I totally forgot about that 🀦

melvin-bot[bot] commented 1 year ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

joekaufmanexpensify commented 1 year ago

@flodnv thoughts on proceeding with this proposal?

flodnv commented 1 year ago

Option 1 from @dukenv0307's proposal looks good to me, and

So shoud we get payeePersonalDetails by personalDetails[reportAction.actorEmail] instead of using filter function.

Yes

melvin-bot[bot] commented 1 year ago

πŸ“£ @dukenv0307 You have been assigned to this job by @flodnv! Please apply to this job in Upwork 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 πŸ“–

dukenv0307 commented 1 year ago

@flodnv @parasharrajat The PR is ready to review.

melvin-bot[bot] commented 1 year ago

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

On to the next one πŸš€

melvin-bot[bot] commented 1 year ago

@flodnv, @parasharrajat, @joekaufmanexpensify, @dukenv0307 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

joekaufmanexpensify commented 1 year ago

Hm, not overdue. PR is waiting to be deployed to prod.

melvin-bot[bot] commented 1 year ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 1 year ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.29-11 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-06-28. :confetti_ball:

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

melvin-bot[bot] commented 1 year ago

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

joekaufmanexpensify commented 1 year ago

This one did not qualify for speed bonus, so we need to issue the following payments:

joekaufmanexpensify commented 1 year ago

@dukenv0307 offer sent for $1,000!

joekaufmanexpensify commented 1 year ago

@parasharrajat offer sent for $1,000!

joekaufmanexpensify commented 1 year ago

@avi-shek-jha offer sent for $250!

joekaufmanexpensify commented 1 year ago

@parasharrajat Could you please complete your portion of the BZ checklist when you have a chance? Thanks!

dukenv0307 commented 1 year ago

@joekaufmanexpensify I think this issue should have speed bonus because while reviewing the PR, we have another PR of the internal team for migrating from email-based indexing to account Ids here https://github.com/Expensify/App/pull/20473 and we need to wait for this PR to be merged to complete the PR of this issue.

Screenshot from 2023-06-26 20-40-39

Can you check again and correct me if I'm wrong?

joekaufmanexpensify commented 1 year ago

Hm, were we waiting for that PR though? I see this PR was being reviewed concurrently to the one you referenced. And one comment about it, but it didn't seem to me like we were holding on it. Unless I am not understanding correctly.

And it seems like we were still actively working on this PR when the other one you referenced got merged, rather than this one being done, and just waiting for the other one to merge. So I'd still say no speed bonus here. But LMK if you're thinking about this differently!

joekaufmanexpensify commented 1 year ago

As soon as the bug-zero checklist is complete here, we'll be all set to issue payment tomorrow!

parasharrajat commented 1 year ago

[@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:https://github.com/Expensify/App/pull/19390 [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:https://github.com/Expensify/App/pull/19390/files#r1244341085 [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: Not required! it was a simple mistake and proper testing and code review should have caught it. [@parasharrajat] Determine if we should create a regression test for this bug. Yes [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again. https://github.com/Expensify/App/issues/20118#issuecomment-1610200034

parasharrajat commented 1 year ago

Regression Test Steps

  1. Login with any account
  2. Open an announce workspace chat or a group chat
  3. Split bill among members.
  4. Click on the split bill preview to see the details.
  5. Verify that the payee user in detail split bill page displays with the current avatar and display name.
  6. Change the avatar of the login user.
  7. Go back to the preview of the split bill following steps 2 & 4.
  8. Verify that the payee avatar is changed.

Verify that no errors appear in the JS console

Do you agree πŸ‘ or πŸ‘Ž ?

parasharrajat commented 1 year ago

@joekaufmanexpensify Please hold my payment for now. I will ping you soon with further details.

joekaufmanexpensify commented 1 year ago

Sounds good, thanks! I will create the regression test issue tomorrow.

flodnv commented 1 year ago

I think the regression test sounds good as long as QA agrees it's not too niche... πŸ‘

joekaufmanexpensify commented 1 year ago

Sounds good. Added regression test issue above. BZ checklist is now complete!

joekaufmanexpensify commented 1 year ago

All set to issue payment here! @parasharrajat I know your payment is held right now, but going to issue the others.

joekaufmanexpensify commented 1 year ago

@dukenv0307 $1,000 sent and contract ended!

joekaufmanexpensify commented 1 year ago

@avi-shek-jha $250 sent and contract ended!

joekaufmanexpensify commented 1 year ago

Leaving this open until we are all set to pay @parasharrajat

joekaufmanexpensify commented 1 year ago

Held pending being able to pay rajat.

joekaufmanexpensify commented 1 year ago

Not overdue. Pending being able to issue payment here.