[HOLD for payment 2024-12-07] [$250] QAB - Workspace avatar remains custom when change do default
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: 9.0.38-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): [email protected] Issue reported by: Applause Internal Team
Action Performed:
- Sign-up for an gmail account as a brand new user
- Create a workspace and give it a custom avatar
- Go to FAB
- Click Submit expense and send a manual request to the workspace
- Change the workspace avatar to default
- Open FAB
- Take a look at the workspace avatar in the QAB
Expected Result:
Default workspace avatar should be displayed in the quick action button
Actual Result:
Custom workspace avatar is displayed in the quick action button when user change the workspace avatar to default. Avatar doesn't get removed not only on the QAB but also for the workspace chat also.
Workaround:
Unknown
Platforms:
- [x] Android: Native
- [x] Android: mWeb Chrome
- [ ] iOS: Native
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/7ba18b69-148b-4f61-9332-c5cb3f610240
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021838248313041984995
- Upwork Job ID: 1838248313041984995
- Last Price Increase: 2024-11-18
- Automatic offers:
- c3024 | Reviewer | 105022549
- mkzie2 | Contributor | 105022550
Issue Owner
Current Issue Owner: @slafortune
Triggered auto assignment to @slafortune (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We think that this bug might be related to #wave-collect - Release 1
@slafortune FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Proposal
Please re-state the problem that we are trying to solve in this issue.
Custom workspace avatar is displayed in the quick action button when user change the workspace avatar to default. Avatar doesn't get removed not only on the QAB but also for the workspace chat also.
What is the root cause of that problem?
When we remove the avatar of the policy, report. policyAvatar hasn't changed. It leads after we remove the avatar, isSameAvatarURL still true then we return the policy avatar from workSpaceIconsCache which is still old policy avatar
https://github.com/Expensify/App/blob/37bf6b2fef128786dfcd83257a56f56c0cd1eb3d/src/libs/ReportUtils.ts#L1958-L1965
What changes do you think we should make in order to solve the problem?
When we get the policyAvatarURL here, we should check if the policy still exists we should prioritize the avatarURL of policy first
const reportPolicy = policy ?? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`];
// disabling to protect against empty strings
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const policyAvatarURL = reportPolicy ? reportPolicy?.avatarURL : report?.policyAvatar;
https://github.com/Expensify/App/blob/37bf6b2fef128786dfcd83257a56f56c0cd1eb3d/src/libs/ReportUtils.ts#L1958-L1965
What alternative solutions did you explore? (Optional)
We have some other solutions like updating policyAvatar to empty for all related reports of the workspace when we remove the custom avatar or we can update workSpaceIconsCache of the policy to the default icon when we delete the custom avatar.
📣 @1234abd! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Job added to Upwork: https://www.upwork.com/jobs/~021838248313041984995
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)
I think this is more a backend issue, where the
the report?.policyAvatar doesnt update on policy avatar removal.
FYI: the report?.policyAvatar was introduced to solve this issue https://github.com/Expensify/App/issues/33470, so i think the safest solution would be to fix it from the backend
📣 @hayes102! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Thanks for the proposals. Please explain in root cause why this bug only happens in QAB.
@situchan This bug also happens for policy-related reports like the video below. The old policy avatar displays briefly until the OpenReport API is complete that update policyAvatar to empty.
https://github.com/user-attachments/assets/29cdc6b6-1359-4241-a2f9-3235c2932406
I am inclined to https://github.com/Expensify/App/issues/49448#issuecomment-2369231324. Can we fix this in backend? 🎀👀🎀
Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@situchan When we update the avatar of the workspace back-end update the policyAvatar of the report but this will not be returned in the response because maybe we can have many related reports for a workspace. Then when we open a related report this field will be updated. So I think we should update the way we get the avatar in frontend.
cc @luacmartins
This is yet another example of duplicated data causing issues. Can we use the data in the policy_ key instead?
@luacmartins Yes that is what I proposed.
Yea, I think we should be using that. FWIW we have a way to retrieve non-member policy data, so I'm not even sure why we added policyAvatar to the report key as this also goes against our principles of keeping DB and Onyx data the same cc @techievivek
@luacmartins I think we used policyAvatar for the case the policy is deleted
@slafortune, @luacmartins, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@techievivek kind bump https://github.com/Expensify/App/issues/49448#issuecomment-2372636151
Yea, I think we should be using that. FWIW we have a way to retrieve non-member policy data, so I'm not even sure why we added policyAvatar to the report key as this also goes against our principles of keeping DB and Onyx data the same
I see, I wasn’t aware we already had a method to retrieve policy data for non-members. Since that's the case, I agree we should use that instead of introducing a new field. It also seems that adding the avatar to reports follows a similar approach to when we added the policyName field https://github.com/Expensify/App/pull/37003/files#diff-5f549daaaaca967d763b3671e371465143185bab398c16825ff9cb2d41a7de7fL120, which also goes against the principle of keeping the DB and Onyx data consistent. Should we look into that as well?
Yes, I think we should
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@slafortune @luacmartins @situchan this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@slafortune, @luacmartins, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@situchan @luacmartins is there a proposal that will work - or an update?
I think there's a bit of internal work that needs to be done before we can change anything in App itself. @techievivek are you able to work on these changes?
@luacmartins This only requires a frontend change, right? As you mentioned, we already sent all those details via the backend, so can we not pass this to an external contributor via this GH? Or do we need some other backend changes as well?
Do non-members already have access to that data? If they do, then I agree we only need FE changes.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸