Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

[$250] Workspace - Default avatar is different in full screen after uploading avatar and removing it #47535

Open IuliiaHerets opened 1 month ago

IuliiaHerets commented 1 month ago

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: v9.0.21-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace.
  3. Go to Profile.
  4. Upload a workspace avatar.
  5. Remove the workspace avatar.
  6. Go to any workspace room.
  7. Click on the room header.
  8. Click on the workspace avatar.

Expected Result:

The default workspace avatar when viewed in full screen should match.

Actual Result:

The default workspace avatar when viewed in full screen is different from the actual avatar after uploading a custom avatar and removing it.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/45613f12-70d1-4f5b-804e-00362b915e87

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a4f7e2fd3a698d7c
  • Upwork Job ID: 1827400295018022101
  • Last Price Increase: 2024-08-31
  • Automatic offers:
    • FitseTLT | Contributor | 103826687
Issue OwnerCurrent Issue Owner: @MariaHCD
melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @kevinksullivan (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.

IuliiaHerets commented 1 month ago

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

IuliiaHerets commented 1 month ago

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

daledah commented 1 month ago

Proposal

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

The default workspace avatar when viewed in full screen is different from the actual avatar after uploading a custom avatar and removing it.

What is the root cause of that problem?

After adding new workspace avatar and deleting it, we are not deleting originalFileName in Onyx And in ReportAvatar we will reuse the expiration value of originalFileName

https://github.com/Expensify/App/blob/5e5bff3630958264c22a34f083879792ff8ee6ab/src/pages/ReportAvatar.tsx#L39-L40

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

When deleting workspace avatar, we should update originalFileName to null in here


   const optimisticData: OnyxUpdate[] = [
        {
                ...
                avatarURL: '',
                originalFileName: null,
            },
        },

What alternative solutions did you explore? (Optional)

NA

FitseTLT commented 1 month ago

Proposal

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

Default avatar is different in full screen after uploading avatar and removing it

What is the root cause of that problem?

We forgot to clear originalFileName on deleting workspace avatar https://github.com/Expensify/App/blob/d4d5a2586910ff46147219ee3e98bb3e936f8037/src/libs/actions/Policy/Policy.ts#L970-L984 So the fill color will be calcuated based on the previous value of the originalFileName

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

We need to clear originalFileName optimistically and also not forget to set the previous value to the failureData (Note: we also forgot to revert avatarURL on failureData so we should fix that too)

    const policy = getPolicy(policyID);
    const optimisticData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
            value: {
                pendingFields: {
                    avatarURL: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
                },
                errorFields: {
                    avatarURL: null,
                },
                avatarURL: '',
                originalFileName: null,
            },
        },
    ];
    const failureData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
            value: {
                avatarURL:policy?.avatarURL,
                originalFileName:policy?.originalFileName,
                errorFields: {
                    avatarURL: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('avatarWithImagePicker.deleteWorkspaceError'),
                },
            },
        },
    ];

Similarly we might need to clearpolicy.avatar prop optimistically too.

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 1 month ago

@kevinksullivan Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] commented 4 weeks ago

@kevinksullivan Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] commented 3 weeks ago

@kevinksullivan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

kevinksullivan commented 3 weeks ago

Polish collect issue

melvin-bot[bot] commented 3 weeks ago

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

melvin-bot[bot] commented 3 weeks ago

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

melvin-bot[bot] commented 3 weeks ago

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

melvin-bot[bot] commented 2 weeks ago

@Pujan92, @kevinksullivan Eep! 4 days overdue now. Issues have feelings too...

kevinksullivan commented 2 weeks ago

Hi @Pujan92 any update on the reviews?

melvin-bot[bot] commented 2 weeks ago

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

kevinksullivan commented 2 weeks ago

Friendly bump @Pujan92 . If you are unable to get back to this early next week I'll have to reassign.

melvin-bot[bot] commented 2 weeks ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

Pujan92 commented 2 weeks ago

Sorry @kevinksullivan for the delay.

Pujan92 commented 2 weeks ago

RCA from both the proposals is correct where originalFileName hasn't been updated in optimistic data while deleting the workspace avatar. Regarding the solution, I prefer @FitseTLT's proposal as it is also handling the failure case and can be considered as a complete solution.

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed

melvin-bot[bot] commented 2 weeks ago

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

melvin-bot[bot] commented 2 weeks ago

@MariaHCD, @Pujan92, @kevinksullivan Whoops! This issue is 2 days overdue. Let's get this updated quick!

MariaHCD commented 1 week ago

Reviewing this today

melvin-bot[bot] commented 1 week ago

πŸ“£ @FitseTLT πŸŽ‰ 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 πŸ“–

kevinksullivan commented 6 days ago

Looping in another BZ for payment as I'm going OOO

melvin-bot[bot] commented 6 days ago

Triggered auto assignment to @stephanieelliott (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.