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-23] [HOLD for payment 2023-06-21] [$1000] profile pic does not update in tooltip in offline mode #20672

Closed
1 of 6 tasks
kavimuru opened this issue Jun 13, 2023 · 55 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Jun 13, 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. go to offline
  2. go to Settings >Profile
  3. change the profile pic
  4. go to any chat and hover on email to see user details in tooltip

Expected Result:

updated profile pic should show

Actual Result:

shows old profile pic

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.27-2
Reproducible in staging?: y
Reproducible in production?: n
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-06-13.at.3.00.50.PM.mov
Recording.966.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0163d5011f7c3a7e5f
  • Upwork Job ID: 1668632232209276928
  • Last Price Increase: 2023-06-13
@kavimuru kavimuru added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 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

@OSBotify
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 2023

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

@mdneyazahmad
Copy link
Contributor

Proposal

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

Avatar is not updated in tooltip in offline mode

What is the root cause of that problem?

When user upload a new profile picture. It is updated in Onyx with this key ONYXKEYS.PERSONAL_DETAILS to immediately reflect the result. In the chat we are getting the avatar from ONYXKEYS.PERSONAL_DETAILS_LIST which is not updated until it is stored on the server. Therefore, it keeps displaying the old avatar. We are also using the avatar url from ONYXKEYS.PERSONAL_DETAILS wherever it immediately shows the updated avatar.

const userDetails = lodashGet(props.personalDetailsList, props.accountID, props.fallbackUserDetails);

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

Get url from ONYXKEYS.PERSONAL_DETAILS

  1. Import required files
import compose from '../../libs/compose';
import * as UserUtils from '../../libs/UserUtils';
import {withPersonalDetails} from '../OnyxProvider';
  1. Add withPersonalDetails
export default compose(
    withPersonalDetails(), 
    withOnyx({
        personalDetailsList: {
            key: ONYXKEYS.PERSONAL_DETAILS_LIST,
        },
    })
)(UserDetailsTooltip);
  1. Get url from ONYXKEYS.PERSONAL_DETAILS
    const personalDetail = props.personalDetails[userDetails.login] || {};

    const avatarSource = UserUtils.getAvatar(personalDetail.avatar, userDetails.login);
  1. Update the prop in Avatar component

What alternative solutions did you explore? (Optional)

None

commit: eef7da9

@melvin-bot melvin-bot bot added Daily KSv2 and removed Hourly KSv2 labels Jun 13, 2023
@slafortune slafortune added the External Added to denote the issue can be worked on by a contributor label Jun 13, 2023
@melvin-bot melvin-bot bot changed the title profile pic does not update in tooltip in offline mode [$1000] profile pic does not update in tooltip in offline mode Jun 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0163d5011f7c3a7e5f

@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 2023

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

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

melvin-bot bot commented Jun 13, 2023

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

@Nikhil-Vats
Copy link
Contributor

Nikhil-Vats commented Jun 13, 2023

Proposal

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

Profile picture in tooltip is not updated in offline mode.

What is the root cause of that problem?

The root causes is -

  1. The profile picture is queried using the wrong key in Onyx which is not updated in offline mode. The component uses PERSONAL_DETAILS_LIST to query the avatar but only PERSONAL_DETAILS is updated in offline mode.
  2. The renderTooltipContent is used for rendering tooltip and it is wrapped within useCallback since the userDetails.avatar doesn't change so profile pic in tooltip is not updated.

function UserDetailsTooltip(props) {
const userDetails = lodashGet(props.personalDetailsList, props.accountID, props.fallbackUserDetails);
const renderTooltipContent = useCallback(
() => (
<View style={[styles.alignItemsCenter, styles.ph2, styles.pv2]}>
<View style={styles.emptyAvatar}>
<Avatar
containerStyles={[styles.actionAvatar]}
source={userDetails.avatar}
/>
</View>
<Text style={[styles.mt2, styles.textMicroBold, styles.textReactionSenders, styles.textAlignCenter]}>
{String(userDetails.displayName).trim() ? userDetails.displayName : ''}
</Text>
<Text style={[styles.textMicro, styles.fontColorReactionLabel]}>
{String(userDetails.login).trim() && !_.isEqual(userDetails.login, userDetails.displayName) ? Str.removeSMSDomain(userDetails.login) : ''}
</Text>
</View>
),
[userDetails.avatar, userDetails.displayName, userDetails.login],
);

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

  1. Import withCurrentUserPersonalDetails because it contains the updated profile pic in offline mode.
    return withOnyx({
    personalDetails: {
    key: ONYXKEYS.PERSONAL_DETAILS,
    },
  2. All other details like login, displayName can also be used from the same personalDetails prop so we can remove the personalDetailsList key entirely from component.
  3. Change useCallback dependency to use the new avatar variable as dependency. Since, it will be updated so the tooltip will have the updated profile pic.

What alternative solutions did you explore? (Optional)

Alternatively, we can also update the function below to change the avatar in PERSONAL_DETAILS_LIST as well. This would be great because it might be used at other places in future so I personally think this is the best way to go.

function updateAvatar(file) {
const optimisticData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,

Following changes will be needed -

  1. Add another prop in updateAvatar for accountID or get it from personalDetails which is already a variable in the file.
  2. Update optimisticData to update avatar in PERSONAL_DETAILS_LIST.
  3. Update successData and failureData to set avatar in pendingFields to null in PERSONAL_DETAILS_LIST.
Result
Screen.Recording.2023-06-13.at.9.14.27.PM.mov

@s-alves10
Copy link
Contributor

Proposal

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

Profile avatar in user details tooltip is not updated in offline mode.

What is the root cause of that problem?

UserDetailsTooltip component uses personal details list to show the avatar but this isn't updated in offline mode when profile avatar is updated as you can see here

function updateAvatar(file) {
const optimisticData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,
value: {
[currentUserEmail]: {
avatar: file.uri,
avatarThumbnail: file.uri,
originalFileName: file.name,
errorFields: {
avatar: null,
},
pendingFields: {
avatar: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
originalFileName: null,
},
},
},
},
];
const successData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,
value: {
[currentUserEmail]: {
pendingFields: {
avatar: null,
},
},
},
},
];
const failureData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,
value: {
[currentUserEmail]: {
avatar: personalDetails[currentUserEmail].avatar,
avatarThumbnail: personalDetails[currentUserEmail].avatarThumbnail || personalDetails[currentUserEmail].avatar,
pendingFields: {
avatar: null,
},
},
},
},
];
API.write('UpdateUserAvatar', {file}, {optimisticData, successData, failureData});
}

This is the root cause

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

Update the personal details list data when avatar is updated.

In the above updateAvatar function, add the following code to the optimisticData

        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: ONYXKEYS.PERSONAL_DETAILS_LIST,
            value: {
                [personalDetails[currentUserEmail].accountID]: {
                    avatar: file.uri,
                    errorFields: {
                        avatar: null,
                    },
                },
            },
        },

Result
20672_mac_chrome.mp4

What alternative solutions did you explore? (Optional)

@pecanoro
Copy link
Contributor

It seems the problem is coming from this PR in which we introduced the feature. @cloudpresser can you please create a PR to fix this issue? Mostly because it's code you introduced and probably an oversight on the solution.

@fedirjh
Copy link
Contributor

fedirjh commented Jun 13, 2023

@pecanoro This issue should be fixed by #20473 , ONYXKEYS.PERSONAL_DETAILS is being deprecated and replaced by ONYXKEYS.PERSONAL_DETAILS_LIST , We just used the new key when we implemented the user details tooltip in #20276 (comment)

@melvin-bot
Copy link

melvin-bot bot commented Jun 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 14, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.27-7 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-21. 🎊

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 Jun 14, 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:

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.28-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-23. 🎊

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 melvin-bot bot changed the title [HOLD for payment 2023-06-21] [$1000] profile pic does not update in tooltip in offline mode [HOLD for payment 2023-06-23] [HOLD for payment 2023-06-21] [$1000] profile pic does not update in tooltip in offline mode Jun 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 16, 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:

  • [@allroundexperts] The PR that introduced the bug has been identified. Link to the PR:
  • [@allroundexperts] 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:
  • [@allroundexperts] 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:
  • [@allroundexperts] Determine if we should create a regression test for this bug.
  • [@allroundexperts] 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.
  • [@slafortune] 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 21, 2023
@slafortune
Copy link
Contributor

@gadhiyamanan, @allroundexperts , @s-alves10 offers are sent!

@allroundexperts can you complete the checklist?

@gadhiyamanan
Copy link
Contributor

@slafortune accepted, thanks!

@s-alves10
Copy link
Contributor

Offer accepted. Thank you

@melvin-bot melvin-bot bot added the Overdue label Jun 26, 2023
@pecanoro
Copy link
Contributor

@allroundexperts Waiting for you to finish the checklist so we can finish the payment and close it!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jun 26, 2023
@s-alves10
Copy link
Contributor

@pecanoro

May I ask you if this is eligible for speed bonus?
#20672 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jun 28, 2023
@pecanoro
Copy link
Contributor

@s-alves10 Yes! It should! Wasn't the case?

@s-alves10
Copy link
Contributor

s-alves10 commented Jun 28, 2023

I'm afraid not

@slafortune
Copy link
Contributor

Yes! It should have - I missed that and can certainly add it! Bonus sent @s-alves10

@allroundexperts
Copy link
Contributor

Yes! It should have - I missed that and can certainly add it! Bonus sent @s-alves10

Don't forget me @slafortune!

@melvin-bot melvin-bot bot added the Overdue label Jul 3, 2023
@pecanoro
Copy link
Contributor

pecanoro commented Jul 3, 2023

@slafortune Friendly bump to handle the remaining payment issues!

@melvin-bot melvin-bot bot removed the Overdue label Jul 3, 2023
@slafortune
Copy link
Contributor

You bet @allroundexperts - can you please complete the checklist? Is there a regression test?

@allroundexperts
Copy link
Contributor

@slafortune It seems like the checklist is not needed here. As per #20672 (comment) we intentionally did not update PERSONAL_DETAILS key in the original PR. This got fixed in a subsequent PR but we just wanted to fix this temporarily here because it might have impacted user experience.

@slafortune
Copy link
Contributor

Thanks @allroundexperts ! I think if the checklist isn't needed for any reason, having an explanation as to why it isn't needed is super helpful to make sure we are getting everything.

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests