Skip to content

[Hold for payment 03-02-2023] [$1000] When removing a member from the workspace, the archiveReason displays a “This chat room was archived” placeholder message, only updating to the correct archiveReason after a refresh. #14293

Closed

Description

@trjExpensify

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Create a workspace from an account with a domain on the policyExpenseChat beta
  2. Invite a member to the workspace such that a workspace chat is created for them
  3. Write a couple of messages in the chat for good measure
  4. Delete the workspace
  5. Observe that the archiveReason displays: “This chat room has been archived”
  6. Refresh the browser
  7. Observe that the archiveReason updates to the correct message: "This workspace chat is no longer active because %workspaceName% is no longer an active workspace."

Expected Result:

We shouldn't require a refresh to display the correct archiveReason

Actual Result:

Requires a refresh of the browser

Workaround:

Yes, refresh the browser.

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.2.54-1
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):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

archive refresh

Expensify/Expensify Issue URL:
Issue reported by: @trjExpensify
Slack conversation: https://expensify.slack.com/archives/C02HWMSMZEC/p1673613791866199

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01878e516117d2102f
  • Upwork Job ID: 1613955452910100480
  • Last Price Increase: 2023-01-13

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 13, 2023
  2. self-assigned this
    on Jan 13, 2023
  3. melvin-bot commented on Jan 13, 2023

    @melvin-bot

    Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new.

  4. changed the title [-]When removing a member from the workspace, the archiveReason displays a “This chat room was archived” placeholder message, only updating to the correct archiveReason after a refresh.[/-] [+][$1000] When removing a member from the workspace, the archiveReason displays a “This chat room was archived” placeholder message, only updating to the correct archiveReason after a refresh.[/+] on Jan 13, 2023
  5. melvin-bot commented on Jan 13, 2023

    @melvin-bot
  6. melvin-bot commented on Jan 13, 2023

    @melvin-bot

    Current assignee @trjExpensify is eligible for the External assigner, not assigning anyone new.

  7. melvin-bot commented on Jan 13, 2023

    @melvin-bot

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

  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 13, 2023
  9. melvin-bot commented on Jan 13, 2023

    @melvin-bot

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

  10. abdulrahuman5196 commented on Jan 13, 2023

    @abdulrahuman5196
    Contributor

    Proposal
    The root cause we don't set optimistic data with the proper reason for report_actions being closed while calling 'DeleteWorkspace' API. As we don't set it, it shows default value of "This chat room was archived" until we get response from onyx pusher. We can set the proper reason based on condition on optimistic data itself. For this instance its mentioned as "policyExpenseChat beta" and i am able find different message reasons as well for 'reportArchiveReasons' on en.js page. We can also add appropriate checks and set the proper message in the optimistic data for all instances.

    Code References:

    function deleteWorkspace(policyID, reports) {
    const optimisticData = [
    {
    onyxMethod: CONST.ONYX.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
    value: {
    pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
    errors: null,
    },
    },
    ..._.map(reports, ({reportID}) => ({
    onyxMethod: CONST.ONYX.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
    value: {
    stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
    statusNum: CONST.REPORT.STATUS.CLOSED,
    hasDraft: false,
    oldPolicyName: allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`].name,
    },
    })),
    ];

    App/src/languages/en.js

    Lines 231 to 237 in b42a6cb

    reportArchiveReasons: {
    [CONST.REPORT.ARCHIVE_REASON.DEFAULT]: 'This chat room has been archived.',
    [CONST.REPORT.ARCHIVE_REASON.ACCOUNT_CLOSED]: ({displayName}) => `This workspace chat is no longer active because ${displayName} closed their account.`,
    [CONST.REPORT.ARCHIVE_REASON.ACCOUNT_MERGED]: ({displayName, oldDisplayName}) => `This workspace chat is no longer active because ${oldDisplayName} has merged their account with ${displayName}.`,
    [CONST.REPORT.ARCHIVE_REASON.REMOVED_FROM_POLICY]: ({displayName, policyName}) => `This workspace chat is no longer active because ${displayName} is no longer a member of the ${policyName} workspace.`,
    [CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED]: ({policyName}) => `This workspace chat is no longer active because ${policyName} is no longer an active workspace.`,
    },

    const archiveReason = lodashGet(props.reportClosedAction, 'originalMessage.reason', CONST.REPORT.ARCHIVE_REASON.DEFAULT);

    If the reviewer can let me know on what occasions we want to show which archived message, i can add the appropriate messages in optimistic data itself.

  11. abdulrahuman5196 commented on Jan 13, 2023

    @abdulrahuman5196
    Contributor

    And to note for member devices i don't think we get the report action message appropriately via pusher resulting in the default action choosen from -

    const archiveReason = lodashGet(props.reportClosedAction, 'originalMessage.reason', CONST.REPORT.ARCHIVE_REASON.DEFAULT);

  12. 19 remaining items

  13. abdulrahuman5196 commented on Jan 19, 2023

    @abdulrahuman5196
    Contributor

    @mountiny Would I be compensated as I was the first to root cause the issue and caused it to turn out internal?. I thought the process was to compensate 25% or 50%,100% of original bug, if the bug turns out to be internal depending on the analysis.

  14. mountiny commented on Jan 20, 2023

    @mountiny
    Contributor

    Yes, you will @abdulrahuman5196 :) I think it was 25% but let me or @trjExpensify confirm. This would be paid once the fix is implemented.

    Looking into this today, was running out of time the previous days.

  15. abdulrahuman5196 commented on Jan 20, 2023

    @abdulrahuman5196
    Contributor

    Thank you @mountiny

  16. mountiny commented on Jan 20, 2023

    @mountiny
    Contributor

    @trjExpensify I have finished the PR on this one and its ready for a review. aught one small issue with some race condition I guess, when user clicked on workspace chat which was just archived, there was some time in which it throws error, because the report actions are not loaded correctly (missing to be more specific). I have updated the code to handle that situation better.

  17. mountiny commented on Jan 24, 2023

    @mountiny
    Contributor

    PR merged 🎉

  18. trjExpensify commented on Jan 26, 2023

    @trjExpensify
    ContributorAuthor

    Nice one! Okay, so I've sent the following offers on this Upwork job:

    @rushatgabhane $1,000 for the C+ internal PR review
    @abdulrahuman5196 $250 for helping with identifying the cause after this initially went external.

    The countdown will begin 7 days from being deployed to production.

  19. abdulrahuman5196 commented on Jan 26, 2023

    @abdulrahuman5196
    Contributor

    Thank you @trjExpensify & @mountiny.
    Accepted.

  20. changed the title [-][$1000] When removing a member from the workspace, the archiveReason displays a “This chat room was archived” placeholder message, only updating to the correct archiveReason after a refresh.[/-] [+][Awaiting Payment 03-02-2023] [$1000] When removing a member from the workspace, the archiveReason displays a “This chat room was archived” placeholder message, only updating to the correct archiveReason after a refresh.[/+] on Feb 1, 2023
  21. changed the title [-][Awaiting Payment 03-02-2023] [$1000] When removing a member from the workspace, the archiveReason displays a “This chat room was archived” placeholder message, only updating to the correct archiveReason after a refresh.[/-] [+][Hold for payment 03-02-2023] [$1000] When removing a member from the workspace, the archiveReason displays a “This chat room was archived” placeholder message, only updating to the correct archiveReason after a refresh.[/+] on Feb 1, 2023
  22. abdulrahuman5196 commented on Feb 6, 2023

    @abdulrahuman5196
    Contributor

    Hi, @trjExpensify Gentle remainder. I suppose this issue is past 7 days regression period and still waiting on payment.

  23. MelvinBot commented on Feb 6, 2023

    @MelvinBot
    Contributor

    @trjExpensify, @rushatgabhane, @mountiny Still overdue 6 days?! Let's take care of this!

  24. MelvinBot commented on Feb 6, 2023

    @MelvinBot
    Contributor

    @trjExpensify, @rushatgabhane, @mountiny Still overdue 6 days?! Let's take care of this!

  25. mountiny commented on Feb 6, 2023

    @mountiny
    Contributor

    Yeah sorry, @trjExpensify will be onto this once soon! Thanks for the bump

  26. trjExpensify commented on Feb 7, 2023

    @trjExpensify
    ContributorAuthor

    Settled up both contracts, thanks everyone!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2InternalRequires API changes or must be handled by Expensify staffReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions