App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2024-12-07] [$250] QAB - Workspace avatar remains custom when change do default

Open IuliiaHerets opened this issue 1 year ago • 102 comments

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:

  1. Sign-up for an gmail account as a brand new user
  2. Create a workspace and give it a custom avatar
  3. Go to FAB
  4. Click Submit expense and send a manual request to the workspace
  5. Change the workspace avatar to default
  6. Open FAB
  7. 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

View all open jobs on GitHub

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 OwnerCurrent Issue Owner: @slafortune

IuliiaHerets avatar Sep 19 '24 09:09 IuliiaHerets

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.

melvin-bot[bot] avatar Sep 19 '24 09:09 melvin-bot[bot]

We think that this bug might be related to #wave-collect - Release 1

IuliiaHerets avatar Sep 19 '24 09:09 IuliiaHerets

@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

IuliiaHerets avatar Sep 19 '24 09:09 IuliiaHerets

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.

mkzie2 avatar Sep 19 '24 09:09 mkzie2

📣 @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:

  1. Make sure you've read and understood the contributing guidelines.
  2. 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.
  3. 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.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Sep 19 '24 09:09 melvin-bot[bot]

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

melvin-bot[bot] avatar Sep 23 '24 16:09 melvin-bot[bot]

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

melvin-bot[bot] avatar Sep 23 '24 16:09 melvin-bot[bot]

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 avatar Sep 23 '24 19:09 hayes102

📣 @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:

  1. Make sure you've read and understood the contributing guidelines.
  2. 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.
  3. 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.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Sep 23 '24 19:09 melvin-bot[bot]

Thanks for the proposals. Please explain in root cause why this bug only happens in QAB.

situchan avatar Sep 23 '24 21:09 situchan

@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

mkzie2 avatar Sep 24 '24 06:09 mkzie2

I am inclined to https://github.com/Expensify/App/issues/49448#issuecomment-2369231324. Can we fix this in backend? 🎀👀🎀

situchan avatar Sep 24 '24 06:09 situchan

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

melvin-bot[bot] avatar Sep 24 '24 06:09 melvin-bot[bot]

@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

mkzie2 avatar Sep 24 '24 08:09 mkzie2

This is yet another example of duplicated data causing issues. Can we use the data in the policy_ key instead?

luacmartins avatar Sep 24 '24 13:09 luacmartins

@luacmartins Yes that is what I proposed.

mkzie2 avatar Sep 24 '24 15:09 mkzie2

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 avatar Sep 25 '24 00:09 luacmartins

@luacmartins I think we used policyAvatar for the case the policy is deleted

mkzie2 avatar Sep 25 '24 02:09 mkzie2

@slafortune, @luacmartins, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Sep 27 '24 18:09 melvin-bot[bot]

@techievivek kind bump https://github.com/Expensify/App/issues/49448#issuecomment-2372636151

situchan avatar Sep 30 '24 06:09 situchan

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?

techievivek avatar Sep 30 '24 07:09 techievivek

Yes, I think we should

luacmartins avatar Sep 30 '24 14:09 luacmartins

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Sep 30 '24 16:09 melvin-bot[bot]

@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!

melvin-bot[bot] avatar Oct 03 '24 18:10 melvin-bot[bot]

@slafortune, @luacmartins, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Oct 03 '24 18:10 melvin-bot[bot]

@situchan @luacmartins is there a proposal that will work - or an update?

slafortune avatar Oct 03 '24 21:10 slafortune

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 avatar Oct 04 '24 13:10 luacmartins

@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?

techievivek avatar Oct 04 '24 15:10 techievivek

Do non-members already have access to that data? If they do, then I agree we only need FE changes.

luacmartins avatar Oct 04 '24 16:10 luacmartins

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Oct 07 '24 16:10 melvin-bot[bot]