Skip to content

[HOLD for payment 2024-03-07] [$500] Workspaces - Сustom avatar is applied to all workspace rooms #35934

Closed

Description

@lanitochka17

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: 1.4.37-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: https://expensify.testrail.io/index.php?/tests/view/4283786&group_by=cases:section_id&group_order=asc&group_id=229065
Email or phone of affected tester (no customers): applausetester+yuriy.6feb.sec@applause.expensifail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open NewDat App and WS settings
  2. change default Avatar to the custom one
  3. check all rooms in the LHN panel

Expected Result:

Verify the Workspace chat displays the new avatar and name.
Default avatars (admins, announce) should have specific icons like at the example.

Actual Result:

All WS rooms (including admins, announce) have the same new custom avatar

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

Bug6369622_1707241367609!actual_result
Bug6369622_1707241211176.Screen_Recording_2024-02-06_at_18.36.24.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013fc2b5417b9e2c4a
  • Upwork Job ID: 1754928206561398784
  • Last Price Increase: 2024-02-13
  • Automatic offers:
    • akinwale | Contributor | 0
    • Tony-MK | Contributor | 0

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 6, 2024
  2. changed the title [-] Workspaces - Сustom avatar is applied to all workspace rooms[/-] [+][$500] Workspaces - Сustom avatar is applied to all workspace rooms[/+] on Feb 6, 2024
  3. melvin-bot commented on Feb 6, 2024

    @melvin-bot
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 6, 2024
  5. melvin-bot commented on Feb 6, 2024

    @melvin-bot

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

  6. melvin-bot commented on Feb 6, 2024

    @melvin-bot

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

  7. lanitochka17 commented on Feb 6, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave6
    CC @greg-schroeder

  8. Tony-MK commented on Feb 6, 2024

    @Tony-MK
    Contributor

    Proposal

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

    Workspaces - Сustom avatar is applied to all workspace rooms

    What is the root cause of that problem?

    The getWorkspaceIcon function is being used for admin and announce rooms in the getIcons function.

    App/src/libs/ReportUtils.ts

    Lines 1543 to 1544 in 8563c0f

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

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

    We should use getDefualtWorkspaceIcon instead for WS rooms which should only show the default workspace icon.

  9. ikevin127 commented on Feb 8, 2024

    @ikevin127
    Contributor

    Proposal

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

    All WS rooms (including admins, announce) have the same new custom avatar.

    What is the root cause of that problem?

    Note

    The WS rooms which should have default avatars: admin rooms, announce rooms, chat rooms and archived rooms.

    Despite the fact that we check the WS room type here in the getIcons function:

    if (isAdminRoom(report) || isAnnounceRoom(report) || isChatRoom(report) || isArchivedRoom(report)) {

    The issue comes from the getWorkspaceIcon function which is called within the if mentioned above:

    App/src/libs/ReportUtils.ts

    Lines 1443 to 1450 in 9f37d3e

    /**
    * Given a report, return the associated workspace icon.
    */
    function getWorkspaceIcon(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = null): Icon {
    const workspaceName = getPolicyName(report, false, policy);
    const policyExpenseChatAvatarSource = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar
    ? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar
    : getDefaultWorkspaceAvatar(workspaceName);

    where we can see that regardless of the WS room type, we're always getting the avatar source from the policy?.avatar and only in case that doesn't exist we fallback to getDefaultWorkspaceAvatar.

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

    Replace the logic within the WS room types check with the following:

    Code spoiler
        if (isAdminRoom(report) || isAnnounceRoom(report) || isChatRoom(report) || isArchivedRoom(report)) {
            const workspaceName = getPolicyName(report, false, policy);
            const workspaceIcon: Icon = {
                source: getDefaultWorkspaceAvatar(workspaceName) ?? '',
                type: CONST.ICON_TYPE_WORKSPACE,
                name: workspaceName,
                id: -1,
            };
            return [workspaceIcon];
        }

    essentially using only the part we need from the getWorkspaceIcon function.

    What alternative solutions did you explore? (Optional)

    Alternatively we can change the getWorkspaceIcon function by adding the check again something like:

    Code spoiler
        // ... rest of the function
        let policyExpenseChatAvatarSource = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar ?? getDefaultWorkspaceAvatar(workspaceName);
    
        if (isAdminRoom(report) || isAnnounceRoom(report) || isChatRoom(report) || isArchivedRoom(report)) {
            policyExpenseChatAvatarSource = getDefaultWorkspaceAvatar(workspaceName);
        }
        // ... rest of the function

    Screenshots

    MacOS: Chrome / Safari
    Before After
    web-before web-after
  10. akinwale commented on Feb 8, 2024

    @akinwale
    Contributor

    Taking over as C+ here.

  11. removed their assignment
    on Feb 8, 2024
  12. 48 remaining items

  13. aldo-expensify commented on Feb 27, 2024

    @aldo-expensify
    Contributor

    Next steps:

    Pay C+ @akinwale and contributor @Tony-MK, and then we can close this out

  14. changed the title [-][$500] Workspaces - Сustom avatar is applied to all workspace rooms[/-] [+][HOLD for payment 2024-03-07] [$500] Workspaces - Сustom avatar is applied to all workspace rooms[/+] on Feb 29, 2024
  15. melvin-bot commented on Feb 29, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.45-6 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-03-07. 🎊

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

  16. melvin-bot commented on Feb 29, 2024

    @melvin-bot

    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:

    • [@akinwale] The PR that introduced the bug has been identified. Link to the PR:
    • [@akinwale] 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:
    • [@akinwale] 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:
    • [@akinwale] Determine if we should create a regression test for this bug.
    • [@akinwale] 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.
    • [@anmurali / @muttmuure] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  17. muttmuure commented on Mar 7, 2024

    @muttmuure
    Contributor

    Paying now

  18. muttmuure commented on Mar 7, 2024

    @muttmuure
    Contributor

    Paid up, no regression test as it was reverted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions