Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Awaiting checklist completion] [$500] Workspace – Workspace chat name and avatar changes to the default after deleting WS #37759

Closed
3 of 6 tasks
lanitochka17 opened this issue Mar 5, 2024 · 29 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 5, 2024

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.47-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/4378569
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Log in
  3. Create new workspace and rename it
  4. Open the WS chat
  5. Delete the workspace

Expected Result:

Workspace chat has the same name as in step 3

Actual Result:

Workspace chat name and avatar changes to the default. The workspace name should be consistent across #admin, #announce and workspace room

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

Bug6402837_1709646269288.WS_with_name_changes_avatar_and_name.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01478bd4327a5c24c1
  • Upwork Job ID: 1765069975003549696
  • Last Price Increase: 2024-03-12
Issue OwnerCurrent Issue Owner: @sobitneupane
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 5, 2024
Copy link

melvin-bot bot commented Mar 5, 2024

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

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave8
CC @zanyrenney

@lanitochka17
Copy link
Author

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

@twisterdotcom twisterdotcom added the External Added to denote the issue can be worked on by a contributor label Mar 5, 2024
@melvin-bot melvin-bot bot changed the title Workspace – Workspace chat name and avatar changes to the default after deleting WS [$500] Workspace – Workspace chat name and avatar changes to the default after deleting WS Mar 5, 2024
Copy link

melvin-bot bot commented Mar 5, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 5, 2024
Copy link

melvin-bot bot commented Mar 5, 2024

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

@twisterdotcom
Copy link
Contributor

37759.mp4

@FitseTLT
Copy link
Contributor

FitseTLT commented Mar 5, 2024

Proposal

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

Workspace – Workspace chat name and avatar changes to the default after deleting WS

What is the root cause of that problem?

Here we are falling back to policyName on the report but the updated policy name is found oldPolicyName

App/src/libs/ReportUtils.ts

Lines 597 to 598 in 5787691

const policyName = finalPolicy?.name || report?.policyName || report?.oldPolicyName || parentReport?.oldPolicyName || noPolicyFound;

as we set oldPolicyName when we delete workspace
oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',
},

/** The policy name to use for an archived report */
oldPolicyName?: string;

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

We need to prioritize oldPolicyName for archived ones as we use for the subtitle of the archived workspace here

App/src/libs/ReportUtils.ts

Lines 2639 to 2641 in 5787691

if (isArchivedRoom(report)) {
return report?.oldPolicyName ?? '';
}

As we might need only to use oldPolicyName for archived workspace we can use isArchivedRoom(report) condition to prioritize oldPolicyName to only use it when the workspace is archived one

App/src/libs/ReportUtils.ts

Lines 597 to 598 in 5787691

const policyName = finalPolicy?.name || report?.policyName || report?.oldPolicyName || parentReport?.oldPolicyName || noPolicyFound;

    const policyName = finalPolicy?.name || (isArchivedRoom(report) ? report?.oldPolicyName : report?.policyName)  || report?.oldPolicyName  || parentReport?.oldPolicyName || noPolicyFound;

What alternative solutions did you explore? (Optional)

We can make the change here if we don't want to change the getPolicyName util function that we use in many places

App/src/libs/ReportUtils.ts

Lines 2594 to 2595 in 5787691

if (isPolicyExpenseChat(report)) {
formattedName = getPolicyExpenseChatName(report, policy);

@twisterdotcom
Copy link
Contributor

Just one thing, I came back to this after a few hours and it finally showed the new name:
image

So... it must be there, it's just reverting back for some time, for some reason.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Mar 6, 2024

Proposal

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

Workspace chat name and avatar changes to the default. The workspace name should be consistent across #admin, #announce and workspace room

What is the root cause of that problem?

When we delete the workspace, we update the oldPolicyName for all related reports but we don't set policyName to empty

oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',

It leads getPolicyName to return the old name for the report like the policy expense report because when we change the WS name policyName of this still is the old name.

const policyName = finalPolicy?.name || report?.policyName || report?.oldPolicyName || parentReport?.oldPolicyName || noPolicyFound;

After OpenReport API is called, policyName is updated to empty and then the WS name and avatar display correctly

That's the root cause of this issue

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

Since BE will return policyName as empty after we delete the workspace, we should update it as empty in optimistic data to make this work well in offline and before OpenReport API is called

policyName: ''

oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',

What alternative solutions did you explore? (Optional)

When we change the display name of WS, we should update policyName of all related reports in optimistic data and BE also needs to update this as well.

@askavyblr
Copy link

askavyblr commented Mar 6, 2024

Proposal

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

The chat name and avatar in the workspace are reset to the default. The workspace name must remain consistent across #admin, #announce, and the workspace room.

What is the root cause of that problem?

When the workspace is deleted, we ensure that the oldPolicyName is left empty. here

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

hasDraft: false,
oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',

What alternative solutions did you explore? (Optional)

we need to check if Workspace got deleted then use report?.oldPolicyName else report?.policyName

const policyName = finalPolicy?.name || report?.policyName || report?.oldPolicyName || parentReport?.oldPolicyName || noPolicyFound;

@twisterdotcom
Copy link
Contributor

@sobitneupane lots of proposals to go at here.

@kaushiktd
Copy link
Contributor

kaushiktd commented Mar 8, 2024

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

Workspace – Workspace chat name and avatar changes to the default after deleting WS

What is the root cause of that problem?

The root cause of this problem lies in how the system handles the retrieval of workspace names. Currently, the system prioritizes policyName over oldPolicyName, which leads to the default behavior upon deletion of a workspace.

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

https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L590

  let finalPolicyName: string | undefined;

    if (policy && [policy.name](http://policy.name/)) {
        finalPolicyName = [policy.name](http://policy.name/); // Use policy name if available
    } else if (isArchivedRoom(report) && report.oldPolicyName) {
        finalPolicyName = report.oldPolicyName; // If the room is archived, use oldPolicyName if available
    } else {
        finalPolicyName = report?.policyName; // Otherwise, use policyName
    }

const policyName = finalPolicyName|| report?.policyName || report?.oldPolicyName || parentReport?.oldPolicyName || noPolicyFound;


    return policyName;

Handle finalPolicyName as potentially undefined.

  • Use policy.name if available.
  • Use report.oldPolicyName for archived rooms.
  • Otherwise, use report?.policyName.
  • Return finalPolicyName, or parentReport?.oldPolicyName, or noPolicyFound if undefined.

Video:-

https://drive.google.com/file/d/1cINMbBK3n5VRVuxrMuVgVQWgGH5r6XSX/view?usp=sharing

@melvin-bot melvin-bot bot added the Overdue label Mar 8, 2024
@Victor-Nyagudi
Copy link
Contributor

I believe the best place to handle this is on the back end such that when a workspace is deleted, report.policyName, when returned, is falsy, therefore, report.oldPolicyName is reached and this is what's shown to the user i.e. the updated workspace's name.

const policyName = finalPolicy?.name || report?.policyName || report?.oldPolicyName || parentReport?.oldPolicyName || noPolicyFound;

@twisterdotcom
Copy link
Contributor

bump @sobitneupane

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2024
Copy link

melvin-bot bot commented Mar 12, 2024

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

@sobitneupane
Copy link
Contributor

Thanks for the proposal everyone.

Proposal from @dukenv0307 looks good to me.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 12, 2024

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

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Mar 14, 2024
Copy link

melvin-bot bot commented Mar 14, 2024

❌ There was an error making the offer to @dukenv0307 for the Contributor role. The BZ member will need to manually hire the contributor.

@twisterdotcom
Copy link
Contributor

Not overdue, just hired @dukenv0307

@melvin-bot melvin-bot bot removed the Overdue label Mar 14, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 15, 2024
@dukenv0307
Copy link
Contributor

@sobitneupane The PR is ready for review.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 22, 2024
@melvin-bot melvin-bot bot changed the title [$500] Workspace – Workspace chat name and avatar changes to the default after deleting WS [HOLD for payment 2024-03-29] [$500] Workspace – Workspace chat name and avatar changes to the default after deleting WS Mar 22, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 22, 2024
Copy link

melvin-bot bot commented Mar 22, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.55-3 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-29. 🎊

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

  • @sobitneupane requires payment through NewDot Manual Requests
  • @dukenv0307 requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Mar 22, 2024

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:

  • [@sobitneupane / @dukenv0307] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane / @dukenv0307] 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:
  • [@sobitneupane / @dukenv0307] 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:
  • [@sobitneupane / @dukenv0307] Determine if we should create a regression test for this bug.
  • [@sobitneupane / @dukenv0307] 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.
  • [@twisterdotcom] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@twisterdotcom
Copy link
Contributor

twisterdotcom commented Mar 29, 2024

Payment Summary:

@twisterdotcom twisterdotcom changed the title [HOLD for payment 2024-03-29] [$500] Workspace – Workspace chat name and avatar changes to the default after deleting WS [Awaiting checklist completion] [$500] Workspace – Workspace chat name and avatar changes to the default after deleting WS Mar 29, 2024
@twisterdotcom
Copy link
Contributor

Bump @sobitneupane

@melvin-bot melvin-bot bot added the Overdue label Apr 8, 2024
@cead22
Copy link
Contributor

cead22 commented Apr 9, 2024

No overdue

@sobitneupane
Copy link
Contributor

sobitneupane commented Apr 11, 2024

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:

  • PR that introduced the bug has been identified. Link to the PR:

#33691

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:

#33691 This regression was probably caused by typescript migration PR.

  • 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:

N/A

  • Determine if we should create a regression test for this bug.

Yes.

  • 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.

#37759 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Apr 11, 2024
@sobitneupane
Copy link
Contributor

Regression Test Proposal

  1. Create a workspace
  2. Change the workspace name
  3. Delete the workspace and go to the archived #admin/#announce room
  4. Verify that the workspace chat avatar and name doesn't change back to the previous workspace name.

Do we agree 👍 or 👎

@JmillsExpensify
Copy link

$500 approved for @sobitneupane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Status: Tracking Issues
Development

No branches or pull requests

10 participants