App
App copied to clipboard
[$500] Android - Room-Invited room avatar looks different
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:
- Go to https://staging.new.expensify.com/
- Tap on a room chat
- Tap header--- members-- invite a user X
- Launch app
- Login as user X in Android app
- Tap on invited room chat
- 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?
- [x] Android: Native
- [x] Android: mWeb Chrome
- [ ] iOS: Native
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/2cc7ff31-e401-4ea1-9653-8b8efea4f6de
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
Job added to Upwork: https://www.upwork.com/jobs/~01220f7073da90ab3b
Triggered auto assignment to @Christinadobrzyn (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @allroundexperts (External
)
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.
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.
https://github.com/Expensify/App/blob/c5ca9a810b529cdc8b8fceb179e9cfc01061355a/src/libs/ReportUtils.ts#L1443-L1446
Hence, in the getWorkspaceIcon
function, the value of policyExpenseChatAvatarSource
will be the default icon of the room.
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
- Change the
getWorkspaceAvatar
function as well for consistency. - Add
policyAvatar
to theReport
type due to typescript errors.
@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.
reviewing proposals
~~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~~
Triggered auto assignment to @srikarparsi, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
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 https://github.com/Expensify/App/issues/35262#issuecomment-1913814447 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)?
Reviewing proposals
Will provide an update tomorrow!
@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.
https://github.com/Expensify/App/assets/22982173/b2aaef3c-27ea-405a-9715-63ce31955d2e
Finally, we use the getWorkspaceIcon
, from the getIcons
function to render the workspace avatars, and used by many other components.
https://github.com/Expensify/App/blob/953b313cf08ce8ff347c2b6ec686064727bb0eba/src/libs/ReportUtils.ts#L1517-L1519
@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
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
Current assignee @srikarparsi is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.
Thanks @tienifr .
Seems I did not figure out the expected result properly.
π£ @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 π
Awesome! Looks like we're working on a PR!
PR is here - https://github.com/Expensify/App/pull/35630
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.40-5 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/35630
If no regressions arise, payment will be issued on 2024-02-20. :confetti_ball:
For reference, here are some details about the assignees on this issue:
- @allroundexperts requires payment through NewDot Manual Requests
- @tienifr requires payment automatic offer (Contributor)
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:
- [X] [@allroundexperts] The PR that introduced the bug has been identified. Link to the PR:
- [X] [@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:
- [X] [@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:
- [X] [@allroundexperts] Determine if we should create a regression test for this bug.
- [X] [@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.
- [x] [@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
hi! Sorry I'm ooo sick today - I'll follow up on this tomorrow
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?
nudge @allroundexperts do need a regression test for this?
DMd @allroundexperts about the regression test
Checklist
- https://github.com/Expensify/App/pull/28999
- https://github.com/Expensify/App/pull/28999/files#r1503761169
- N/A
- A regression test would be helpful here. The steps given in the OP look clear enough to me.
Awesome! Thanks @allroundexperts - created the regression test.
I think this can be closed!
$500 approved for @allroundexperts based on this summary.