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

[HOLD for payment 2023-06-07] [$1000] Center QR image turns into difference avatar for a moment after being removed. #19211

Closed
1 of 6 tasks
kavimuru opened this issue May 18, 2023 · 37 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kavimuru
Copy link

kavimuru commented May 18, 2023

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. Login app in 2 tabs.
  2. From the first tab open Share QR image, from second tab, try to remove the user avatar.
  3. Observe the center Qr image.

Expected Result:

Center QR image should turn into default avatar.

Actual Result:

Center QR image turns into difference avatar for a moment after being removed.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.16.3
Reproducible in staging?: y
Reproducible in production?: y
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

Screen.Recording.2023-05-16.at.22.07.57.mov
Recording.646.mp4

Expensify/Expensify Issue URL:
Issue reported by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1684249640364239

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e69cb0f1402572c0
  • Upwork Job ID: 1659379434933579776
  • Last Price Increase: 2023-05-19
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@hoangzinh
Copy link
Contributor

hoangzinh commented May 18, 2023

Proposal

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

Center QR image turns into difference avatar for a moment after being removed

What is the root cause of that problem?

When we delete user avatar, we set optimisticData of user's avatar to oldDot default avatar (e.i: https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/avatar_4.png).

const defaultAvatar = ReportUtils.getOldDotDefaultAvatar(currentUserEmail);

Later on, the API returns default avatar with newDot (e.i: https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/default-avatar_4.png)
Screenshot 2023-05-19 at 06 16 57

In ShareCodePage, we're using this.props.currentUserPersonalDetails.avatar to generate QR code, which uses above value directly => it explains why we see the oldDot avatar in QR code for a moment then see newDot avatar.

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

We can't reuse the util ReportUtils.getAvatar like other places. Because it will return a SVG component if the current avatar is the default one. QRCode library expect a string of URL not a React component.
So we can make another ReportUtils.getAvatarUrl same as ReportUtils.getAvatar but it returns a newDot default URL instead of SVG component when it's a default avatar.

The function to get newDot default URL is almost same with oldDot. But instead of avatar_${loginHashBucket}.png, it should be default-avatar_${loginHashBucket}.png

What alternative solutions did you explore? (Optional)

Instead of use oldDot default avatar, we can use newDot default avatar for optimisticData, because later on, the API still return the newDot default avatar. So it doesn't make sense to use oldDot default avatar anymore => Write a new util ReportUtils.getNewDotDefaultAvatar same as oldDot, but return with prefix default- (I.e default-avatar_4.png)

const defaultAvatar = ReportUtils.getOldDotDefaultAvatar(currentUserEmail);

@kadiealexander
Copy link
Contributor

Reproduced in Chrome:

2023-05-19_14-03-36.mp4

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label May 19, 2023
@melvin-bot melvin-bot bot changed the title Center QR image turns into difference avatar for a moment after being removed. [$1000] Center QR image turns into difference avatar for a moment after being removed. May 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 19, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 19, 2023

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

@fedirjh
Copy link
Contributor

fedirjh commented May 19, 2023

Hey @hoangzinh thanks for the proposal . I wonder if we can achieve the same result as the chat avatars , check my video below , the avatar in the chat doesn’t change to oldDot default avatar .

Avatar.mov

@hoangzinh
Copy link
Contributor

@fedirjh I thought about it too. For other place, we usually use this util to get avatar ReportUtils.getAvatar, it will return an SVG image if it's default avatar. I have tried for QR code, but it's expecting a image URL/number.

@fedirjh
Copy link
Contributor

fedirjh commented May 20, 2023

@hoangzinh QR code accept base64 strings , so we can convert the Svg to base64. Anyway I think we have a simpler option.

@grgia Is there any specific reason that we keep using the oldDot default avatar ? Can we update getOldDotDefaultAvatar to return the newDot default avatar ? specifically this line

return `${CONST.CLOUDFRONT_URL}/images/avatars/avatar_${loginHashBucket}.png`;

Could be update to :

    return `${CONST.CLOUDFRONT_URL}/images/avatars/default-avatar_${loginHashBucket}.png`;

@melvin-bot melvin-bot bot added the Overdue label May 22, 2023
@tgolen
Copy link
Contributor

tgolen commented May 22, 2023

I think we can go ahead and make that update. I don't think there is any reason to keep using the old avatar.

@melvin-bot melvin-bot bot removed the Overdue label May 22, 2023
@grgia
Copy link
Contributor

grgia commented May 22, 2023

The old avatar is required in order to update the avatar only on both Old and New Dot. On Old dot we do not use our new default avatar designs

@grgia
Copy link
Contributor

grgia commented May 22, 2023

To illustrate:
image

vs
image

To support both platforms, we set the default avatar URL for Old Expensify whereas in New Expensify we calculate which one to show at render

@hoangzinh
Copy link
Contributor

@grgia I think it makes sense if we store default avatar URL of oldDot in BE, so it works for both oldDot and newDot. But from what I observe:

  • We set optimisticData in newDot with old default avatar. But after that, BE API returns new default avatar
    Screenshot 2023-05-22 at 21 10 50 => Does that mean BE is storing with new default avatar?
  • Another interesting thing is, atm, if we remove the avatar for an user then login to oldDot, we are see new default avatar.
    Screenshot 2023-05-22 at 21 12 44

@fedirjh
Copy link
Contributor

fedirjh commented May 22, 2023

I think it makes sense if we store default avatar URL of oldDot in BE, so it works for both oldDot and newDot.

I agree with this point, getOldDotDefaultAvatar is used to set defaultAvatar optimistically. The request sent from newDot doesn’t include the oldDot default avatar

oldDat newDot
Screenshot 2023-05-22 at 5 01 22 PM Screenshot 2023-05-22 at 4 54 07 PM

Another interesting thing is, atm, if we remove the avatar for an user then login to oldDot, we are see new default avatar.

I can confirm the same thing , It looks this should be fixed in the BE as the new avatar is displayed on oldDot

Screenshot 2023-05-22 at 4 58 54 PM

@tgolen
Copy link
Contributor

tgolen commented May 23, 2023

OK, what updates to the proposal need to be made? Is it just a matter of changing the reference in the optimistic data?

@grgia
Copy link
Contributor

grgia commented May 23, 2023

The problem is in /src/pages/ShareCodePage.js


                            logo={isReport ? roomAvatar : this.props.currentUserPersonalDetails.avatar}

we should be using ReportUtils.getAvatar( ... ) here instead of this.props.currentUserPersonalDetails.avatar

@fedirjh
Copy link
Contributor

fedirjh commented May 23, 2023

we should be using ReportUtils.getAvatar( ... ) here instead of this.props.currentUserPersonalDetails.avatar

We discussed that solution in #19211 (comment) , ReportUtils.getAvatar may return String/Function however react-native-qrcode-svg only accepts String/Number

@hoangzinh, can we implement a new function similar to ReportUtils.getAvatar, but instead of returning an SVG component, it returns a URL?

@hoangzinh
Copy link
Contributor

@fedirjh definitely we can. I have updated my proposal to reflect above thing.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 25, 2023

📣 @hoangzinh You have been assigned to this job by @kadiealexander!
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 📖

@kadiealexander
Copy link
Contributor

@tgolen the assigned engineer assigns in Github, that doesn't need to wait for me. I'll ensure the Upwork contracts get sent and everyone gets paid 😊

@tgolen
Copy link
Contributor

tgolen commented May 25, 2023

Cool, I didn't know about that. I'll try to remember it in the future. Thanks!

@tgolen tgolen removed their assignment May 31, 2023
@tgolen tgolen added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels May 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

@tgolen
Copy link
Contributor

tgolen commented May 31, 2023

Unfortunately, I need to reassign this due to going on extended leave.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 31, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Center QR image turns into difference avatar for a moment after being removed. [HOLD for payment 2023-06-07] [$1000] Center QR image turns into difference avatar for a moment after being removed. May 31, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

If no regressions arise, payment will be issued on 2023-06-07. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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:

  • [@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
  • [@fedirjh] 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:
  • [@fedirjh] 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:
  • [@fedirjh] Determine if we should create a regression test for this bug.
  • [@fedirjh] 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.
  • [@kadiealexander] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 6, 2023
@kadiealexander
Copy link
Contributor

kadiealexander commented Jun 7, 2023

Assigned - May 25th 2:50pm (GMT+12) - Thursday
Merged - May 29th 5:32pm (GMT+12) - Monday

PR was merged within 3 business days, eligible for speed bonus.

@kadiealexander
Copy link
Contributor

kadiealexander commented Jun 7, 2023

Contracts sent to all, @fedirjh please don't forget about the checklist!

@fedirjh fedirjh mentioned this issue Jun 7, 2023
57 tasks
@fedirjh
Copy link
Contributor

fedirjh commented Jun 7, 2023

  • Link to the PR: Feat: Share QR Code #18636
  • Link to comment: Feat: Share QR Code #18636 (comment)
  • Link to discussion: N/A , This looks an edge case , testing different scenario would help catch this bug earlier (well for this case it doesn’t look like a realistic test case). I don't think we have anything to add to the current checklist. Let me know if we should create a discussion thread for that.
  • Regression Test: N/A This is an edge case where user has to open the same page on two different devices simultaneously and then tries to remove avatar. Doesn’t looks like a realistic test case.

@kadiealexander
Copy link
Contributor

Thanks @fedirjh! Everyone is paid so I'm closing this out. Great work team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

7 participants