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

[$500] Chat - WS custom avatar is not updated in chat conversation after request money #32507

Closed
6 tasks done
lanitochka17 opened this issue Dec 5, 2023 · 13 comments
Closed
6 tasks done
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 Dec 5, 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!


Version Number: 1.4.8.0
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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Launch the app
  2. Log in with any account
  3. Set your avatar to custom avatar
  4. Set your WS to custom avatar
  5. Go to Expense report
  6. Request Money

Expected Result:

WS custom avatar is updated in chat conversation after request money

Actual Result:

WS custom avatar is not updated in chat conversation after request money

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

Bug6302189_1701800461966.RPReplay_Final1701795456__1_.1.mp4

Bug6302189_1701800461936!image__33_

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01863c1504c75474be
  • Upwork Job ID: 1732107025747791872
  • Last Price Increase: 2023-12-05
  • Automatic offers:
    • shubham1206agra | Contributor | 28042361
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 5, 2023
@melvin-bot melvin-bot bot changed the title Chat - WS custom avatar is not updated in chat conversation after request money [$500] Chat - WS custom avatar is not updated in chat conversation after request money Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

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

Copy link

melvin-bot bot commented Dec 5, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01863c1504c75474be

Copy link

melvin-bot bot commented Dec 5, 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

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

melvin-bot bot commented Dec 5, 2023

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

@paultsimura
Copy link
Contributor

paultsimura commented Dec 5, 2023

Proposal

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

The custom avatar of a workspace is not displayed, the default avatar is shown.

What is the root cause of that problem?

There is a broken key, by which we are trying to fetch the avatar of a workspace. The policies collection stores the keys in the format policy_${policyID}, while we try to access it by policy${policyID}. As a result, the avatar is undefined, and the fallback value of getDefaultWorkspaceAvatar(workspaceName) is returned.

App/src/libs/ReportUtils.ts

Lines 1168 to 1171 in 83451a8

function getWorkspaceAvatar(report: OnyxEntry<Report>): UserUtils.AvatarSource {
const workspaceName = getPolicyName(report, false, allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]);
return allPolicies?.[`policy${report?.policyID}`]?.avatar ?? getDefaultWorkspaceAvatar(workspaceName);
}

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

In here, we should change the key policy${report?.policyID} to policy_${report?.policyID}

App/src/libs/ReportUtils.ts

Lines 1168 to 1171 in 83451a8

function getWorkspaceAvatar(report: OnyxEntry<Report>): UserUtils.AvatarSource {
const workspaceName = getPolicyName(report, false, allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]);
return allPolicies?.[`policy${report?.policyID}`]?.avatar ?? getDefaultWorkspaceAvatar(workspaceName);
}

Result:

image

What alternative solutions did you explore? (Optional)

@b4s36t4
Copy link
Contributor

b4s36t4 commented Dec 5, 2023

Proposal

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

Chat - WS custom avatar is not updated in chat conversation after request money

What is the root cause of that problem?

We have all the logic placed with the code, but there is some issue on how we're accessing the policy data and that's causing an issue.

function getWorkspaceAvatar(report: OnyxEntry<Report>): UserUtils.AvatarSource {
Here in this function we get the avatar for the respective policy.

If we carefully observe that we're accessing the policy from allPolicies with key policy${report.policyID} but we save the policies in the following format.

policy_${report.policyID}

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

Updating access key with _ should solve the issue.

    return allPolicies?.[`policy_${report?.policyID}`]?.avatar ?? getDefaultWorkspaceAvatar(workspaceName);

What alternative solutions did you explore? (Optional)

NA

@aimane-chnaif
Copy link
Contributor

Asked author of offending PR since it's still within regression period

@kubabutkiewicz
Copy link
Contributor

@aimane-chnaif PR is ready

@aimane-chnaif
Copy link
Contributor

@aimane-chnaif PR is ready

cc: @shubham1206agra for review

@thesahindia thesahindia removed their assignment Dec 10, 2023
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 12, 2023
Copy link

melvin-bot bot commented Dec 12, 2023

📣 @shubham1206agra 🎉 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 📖

@mountiny
Copy link
Contributor

This was a regression from another PR so I think we can actually close this issue given the PR was merged and its simple enough

Copy link

melvin-bot bot commented Dec 13, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@mountiny
Copy link
Contributor

There was a regression from this PR, which was already a fix for a regression so I think we can close without payments here.

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
None yet
Development

No branches or pull requests

9 participants