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 2024-02-20] [$500] Android - Room-Invited room avatar looks different #35262

Closed
3 of 6 tasks
lanitochka17 opened this issue Jan 26, 2024 · 30 comments
Closed
3 of 6 tasks
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

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 26, 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: 1.4.32
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. Go to https://staging.new.expensify.com/
  2. Tap on a room chat
  3. Tap header--- members-- invite a user X
  4. Launch app
  5. Login as user X in Android app
  6. Tap on invited room chat
  7. Tap on header -- avatar

Expected Result:

Invited room avatar must be shown correctly

Actual Result:

Invited room avatar looks different ( like placeholder)

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

Bug6355985_1706287071557.full.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01220f7073da90ab3b
  • Upwork Job ID: 1750958302280990720
  • Last Price Increase: 2024-01-26
  • Automatic offers:
    • tienifr | Contributor | 28133955
@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 Jan 26, 2024
Copy link

melvin-bot bot commented Jan 26, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01220f7073da90ab3b

@melvin-bot melvin-bot bot changed the title Android - Room-Invited room avatar looks different [$500] Android - Room-Invited room avatar looks different Jan 26, 2024
Copy link

melvin-bot bot commented Jan 26, 2024

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

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

melvin-bot bot commented Jan 26, 2024

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

@tienifr
Copy link
Contributor

tienifr commented Jan 27, 2024

Proposal

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

Invited room avatar looks different ( like placeholder)

What is the root cause of that problem?

In here, we're not using the ReportUtils.getPolicyName method to get the policy name.

When user is a member of the room but is not a member of the workspace, they will not have access to the policy data. So the policy?.name used here will be empty.

In this case, the right thing to do is to fallback to the report's report?.policyName, which is what ReportUtils.getPolicyName already handled for us (along with a few other cases).

So it couldn't find the policyName and will fallback to the default avatar (instead of the avatar with workspace initial as it should be).

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

In here, use the ReportUtils.getPolicyName method to get the policy name.

const policyName = ReportUtils.getPolicyName(report, false, policy);

(Can consider passing returnEmptyIfNotFound param as true, but false is generally used in such icon-getting logic)

Optionally, in here, we should use the getWorkspaceAvatar since it's a proven method for retrieving the workspace avatar. To be safe, we can pass the policy as a second param into getWorkspaceAvatar and use it instead of getting from allPolicies, if the param is passed in (just like what we did with getPolicyName)

What alternative solutions did you explore? (Optional)

Unrelated, but there's a report.policyAvatar field that was recently added from the back-end to fix another issue, and the front-end changes for that is already being handled via this PR. It will fix some use cases related to the policy avatar but not directly related to this issue. If any additional change related to the report.policyAvatar (like same change for getWorkspaceAvatar), it should be handled in that PR as well.

@Tony-MK
Copy link
Contributor

Tony-MK commented Jan 29, 2024

Proposal

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

Android - Room-Invited room avatar looks different

What is the root cause of that problem?

No policy record associated with the room is stored in the onyx because the user was not invited to the policy but to the policy room.

App/src/libs/ReportUtils.ts

Lines 1443 to 1446 in c5ca9a8

const policyExpenseChatAvatarSource = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar
? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar
: getDefaultWorkspaceAvatar(workspaceName);

Hence, in the getWorkspaceIcon function, the value of policyExpenseChatAvatarSource will be the default icon of the room.

Report Onyx

However, The correct workspace avatar source is stored in the policyAvatar attribute is available in the report, but we are not utilizing it in the getWorkspaceIcon.

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

We should also check if the report?.policyAvatar is present after the policy fails to be found in the Onyx collection and before it calls getDefaultWorkspaceAvatar.

Therefore, let's change the code snippet mentioned above to modify the getWorkspaceIcon function like below.

const policyExpenseChatAvatarSource = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar
  ? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar : report?.policyAvatar;

const workspaceIcon: Icon = {
    source: policyExpenseChatAvatarSource ?? getDefaultWorkspaceAvatar(workspaceName) ?? '',
    ....

Extras

  1. Change the getWorkspaceAvatar function as well for consistency.
  2. Add policyAvatar to the Report type due to typescript errors.

@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
@tienifr
Copy link
Contributor

tienifr commented Jan 29, 2024

@Tony-MK Just FYI the report.policyAvatar was recently added from the back-end to fix another issue, and the front-end changes you suggested is already being handled via this PR, if any additional change related to the report.policyAvatar, it should be handled in that PR as well.

Proposal updated to mention this additional information.

@Christinadobrzyn
Copy link
Contributor

reviewing proposals

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
@allroundexperts
Copy link
Contributor

allroundexperts commented Jan 29, 2024

Thanks for the proposal @tienifr. As far as I've understood, you're just getting the name of the policy but if the policy does not exist, the default avatar would still be shown.

I think what @Tony-MK has proposed is much more simpler and a better solution. I would go with that.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 29, 2024

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

@tienifr
Copy link
Contributor

tienifr commented Jan 30, 2024

Thanks for the proposal @tienifr. As far as I've understood, you're just getting the name of the policy but if the policy does not exist, the default avatar would still be shown.

@allroundexperts No, if the policy does not exist, it will use the policyName from the report (please see the full fallback logic here), there won't be a case where it cannot find the policy name, the getPolicyName was designed for that.

I think what @Tony-MK has #35262 (comment) is much more simpler and a better solution. I would go with that.

@allroundexperts I've tried that solution and it doesn't work, I don't think it's actually related to this issue, because in ReportAvatar we currently don't use getWorkspaceIcon (or getWorkspaceAvatar). Could you give it a try as well (if not already)?

@Christinadobrzyn
Copy link
Contributor

Reviewing proposals

@allroundexperts
Copy link
Contributor

Will provide an update tomorrow!

@Tony-MK
Copy link
Contributor

Tony-MK commented Jan 31, 2024

@allroundexperts I've tried that solution and it doesn't work, I don't think it's actually related to this issue, because in ReportAvatar we currently don't use getWorkspaceIcon (or getWorkspaceAvatar). Could you give it a try as well (if not already)?

Hey, @allroundexperts and @tienifr, my proposed solution works suitably and is viable.

Firstly, you try it out for yourself on this test branch.

Furthermore, the video below compares the dev and staging to demonstrate that the changes work and provide consistency throughout the app.

POC.mov

Finally, we use the getWorkspaceIcon, from the getIcons function to render the workspace avatars, and used by many other components.

App/src/libs/ReportUtils.ts

Lines 1517 to 1519 in 953b313

if (isAdminRoom(report) || isAnnounceRoom(report) || isChatRoom(report) || isArchivedRoom(report)) {
const workspaceIcon = getWorkspaceIcon(report, policy);
return [workspaceIcon];

@tienifr
Copy link
Contributor

tienifr commented Jan 31, 2024

@Tony-MK I think you've mistaken this one with another issue. The issue you're trying to fix is the same as this issue (which already has a PR raised to fix it)

This GH issue is when the workspace has no avatar uploaded, thus the workspace name initial (A as in the OP video) is shown, also it happens only in the ReportAvatar, as you can see in the OP video, in other pages it still shows A initial correctly

cc @allroundexperts

@allroundexperts
Copy link
Contributor

Okay. I got the incorrect impression here as well that the issue was for custom avatars of a workspace. @tienifr correctly pointed out that the above is being handled in #33470. This issue is about the default avatar not getting displayed correctly because policy name is missing (since the user was invited to the room, not the policy). As such, I think @tienifr's proposal would work well in this case. Thanks for the explanation @tienifr!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 31, 2024

Current assignee @srikarparsi is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@Tony-MK
Copy link
Contributor

Tony-MK commented Jan 31, 2024

Thanks @tienifr .

Seems I did not figure out the expected result properly.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 1, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

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

@Christinadobrzyn
Copy link
Contributor

Awesome! Looks like we're working on a PR!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 2, 2024
@Christinadobrzyn
Copy link
Contributor

PR is here - #35630

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 13, 2024
@melvin-bot melvin-bot bot changed the title [$500] Android - Room-Invited room avatar looks different [HOLD for payment 2024-02-20] [$500] Android - Room-Invited room avatar looks different Feb 13, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 13, 2024
Copy link

melvin-bot bot commented Feb 13, 2024

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

Copy link

melvin-bot bot commented Feb 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.40-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 2024-02-20. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Feb 13, 2024

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.
  • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/373547

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 20, 2024
@Christinadobrzyn
Copy link
Contributor

hi! Sorry I'm ooo sick today - I'll follow up on this tomorrow

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Feb 21, 2024

Payouts due:

Contributor: $500 @tienifr (paid in Upwork - https://www.upwork.com/nx/wm/workroom/36224169/overview)
Contributor+: $500 @allroundexperts (payment through NewDot)

Eligible for 50% #urgency bonus? NA

Do we need a regression test for this?

@Christinadobrzyn
Copy link
Contributor

nudge @allroundexperts do need a regression test for this?

@melvin-bot melvin-bot bot added the Overdue label Feb 26, 2024
@Christinadobrzyn
Copy link
Contributor

DMd @allroundexperts about the regression test

@allroundexperts
Copy link
Contributor

Checklist

  1. The app should take the user back to the profile page when the user clicks the back button in the web browser #28999
  2. https://github.com/Expensify/App/pull/28999/files#r1503761169
  3. N/A
  4. A regression test would be helpful here. The steps given in the OP look clear enough to me.

@Christinadobrzyn
Copy link
Contributor

Awesome! Thanks @allroundexperts - created the regression test.

I think this can be closed!

@JmillsExpensify
Copy link

$500 approved for @allroundexperts based on this summary.

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

No branches or pull requests

7 participants