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

[HOLD for payment 2024-11-29] [$250] Room - Create room whisper reappears when interacting with it after workspace is deleted #49940

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

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 30, 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: 9.0.41-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Send a mention of a non-existing room
  4. Delete the workspace
  5. Go to workspace chat
  6. Click Yes on the whisper

Expected Result:

The whisper should be removed once the workspace is deleted

Actual Result:

The whisper is not removed after the workspace is deleted
When user selects Yes or No, the whisper disappears and reappears

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

Bug6619523_1727631494594.20240930_013404.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021840941316454719982
  • Upwork Job ID: 1840941316454719982
  • Last Price Increase: 2024-10-08
  • Automatic offers:
    • rayane-djouah | Reviewer | 104326547
    • Krishna2323 | Contributor | 104326549
Issue OwnerCurrent Issue Owner: @greg-schroeder
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 30, 2024
Copy link

melvin-bot bot commented Sep 30, 2024

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

@nyomanjyotisa
Copy link
Contributor

Proposal

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

Room - Create room whisper reappears when interacting with it after workspace is deleted

What is the root cause of that problem?

We still displaying the whisper action although the workspace is deleted or the report is archived

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

Return false on shouldReportActionBeVisible if the report is archived and the report action is whisper action here

    if (isWhisperAction(reportAction) && ReportUtils.isArchivedRoom(report)) {
        return false;
    }

add report param to shouldReportActionBeVisible and make it nullable

Then pass the report here

ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID),

ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID, report),

What alternative solutions did you explore? (Optional)

@Nomanahmeda789
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.
Room - Create room whisper reappears when interacting with it after workspace is deleted

What is the root cause of that problem?
We still displaying the whisper action although the workspace is deleted or the report is archived

What changes do you think we should make in order to solve the problem?
Need to implement logic that can conditionally render the "Create room whisper" based on the workspace's existence. A simple check is need to added before rendering the whisper to check that the workspace is still valid like this:

if (!workspaceExists) return null;

@Muhammad-Maraj-Khan
Copy link

Somewhat agree with @Nomanahmeda789 solution.

@huult
Copy link
Contributor

huult commented Sep 30, 2024

Proposal

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

Create room whisper reappears when interacting with it after workspace is deleted

What is the root cause of that problem?

Currently, we are still showing whispers even when the workspace is deleted.

(isOffline ||
ReportActionsUtils.isDeletedParentAction(reportAction) ||
reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ||
reportAction.errors) &&
ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID),

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

We should add logic to check if it's a whisper, and if the workspace is deleted, then it should not be shown. Some thing like that:

// .src/pages/home/report/ReportActionsList.tsx#L188
+    const isArchivedRoom = ReportUtils.isArchivedRoom(report, reportNameValuePairs);

// .src/pages/home/report/ReportActionsList.tsx#L197
reportAction.errors) && 
- ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID)
+ ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID) &&
+                    (reportAction.actionName !== 'ACTIONABLEREPORTMENTIONWHISPER' || !isArchivedRoom)
POC
Screen.Recording.2024-10-01.at.00.16.10.mp4

@Krishna2323
Copy link
Contributor

Krishna2323 commented Sep 30, 2024

Edited by proposal-police: This proposal was edited at 2024-10-01 04:43:52 UTC.

Proposal


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

Room - Create room whisper reappears when interacting with it after workspace is deleted

What is the root cause of that problem?

In shouldReportActionBeVisible, we are not checking whether the report is writeable, and we also don't check for this in ReportActionsList.

function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, key: string | number): boolean {
if (!reportAction) {
return false;
}
if (isReportActionDeprecated(reportAction, key)) {
return false;
}
// Filter out any unsupported reportAction types
if (!supportedActionTypes.includes(reportAction.actionName)) {
return false;
}
// Ignore closed action here since we're already displaying a footer that explains why the report was closed
if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED) {
return false;
}
// Ignore markedAsReimbursed action here since we're already display message that explains the expense was paid
// elsewhere in the IOU reportAction
if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED) {
return false;
}
if (isWhisperActionTargetedToOthers(reportAction)) {
return false;
}
if (isPendingRemove(reportAction) && !reportAction.childVisibleActionCount) {
return false;
}
if (isTripPreview(reportAction)) {
return true;
}
// All other actions are displayed except thread parents, deleted, or non-pending actions
const isDeleted = isDeletedAction(reportAction);
const isPending = !!reportAction.pendingAction;
return !isDeleted || isPending || isDeletedParentAction(reportAction) || isReversedTransaction(reportAction);
}

const sortedVisibleReportActions = useMemo(
() =>
sortedReportActions.filter(
(reportAction) =>
(isOffline ||
ReportActionsUtils.isDeletedParentAction(reportAction) ||
reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ||
reportAction.errors) &&
ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID),
),
[sortedReportActions, isOffline],
);

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


We have 2 solutions to solve this issue.

  • Add ReportUtils.canUserPerformWriteAction check in shouldReportActionBeVisible util function.
    • For this we can pass the report to shouldReportActionBeVisible and then use canUserPerformWriteAction with the report and return false is !canUserPerformWriteAction is false. We also need to check if the action is a whisper or not and based on that we will return the boolean.
function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, key: string | number,report): boolean {
    if ((isActionableMentionWhisper(reportAction) || isActionableTrackExpense(reportAction) || isActionableReportMentionWhisper(reportAction)) && !canUserPerformWriteAction(report)) {
        return false;
    }
    
    // We can also consider checking isActionableJoinRequest & isActionableJoinRequestPending

What alternative solutions did you explore? (Optional)

Result

@greg-schroeder greg-schroeder added the External Added to denote the issue can be worked on by a contributor label Oct 1, 2024
@melvin-bot melvin-bot bot changed the title Room - Create room whisper reappears when interacting with it after workspace is deleted [$250] Room - Create room whisper reappears when interacting with it after workspace is deleted Oct 1, 2024
Copy link

melvin-bot bot commented Oct 1, 2024

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

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

melvin-bot bot commented Oct 1, 2024

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

@daledah
Copy link
Contributor

daledah commented Oct 1, 2024

Edited by proposal-police: This proposal was edited at 2024-10-01 04:28:05 UTC.

Proposal

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

The whisper is not removed after the workspace is deleted
When user selects Yes or No, the whisper disappears and reappears

What is the root cause of that problem?

  • When the report is deleted, we do not disable the actionable item button:

so user can click on it and BE returns an error to indicate that user doesn't have permission to perform the action.

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

  • We should add isDisabled={item.isDisabled} to:

  • And for each element in:

return isDisabled: ReportUtils.isArchivedRoomWithID(report?.reportID) or can use isDisabled: !ReportUtils.canUserPerformWriteAction(report) instead

image

@daledah
Copy link
Contributor

daledah commented Oct 1, 2024

Proposal updated

@daledah
Copy link
Contributor

daledah commented Oct 1, 2024

@greg-schroeder Can you confirm the expected behavior here. When the report is archived, we should:

  1. Hide the whisper message.

  2. Still displays the whisper message but disables the "Yes/No" buttons.

@Krishna2323
Copy link
Contributor

Proposal Updated

  • Updated main solution

@greg-schroeder
Copy link
Contributor

Discussing this with the team

@greg-schroeder
Copy link
Contributor

greg-schroeder commented Oct 2, 2024

@daledah I think in this case, it makes the most sense to just hide the whisper.

Reasoning: The whisper is there to help the user take action that we think they might want to take. Since the chat is no longer active, and no action can be taken, we probably don't need to show them a message that is trying to help them take an action that's no longer possible.

h/t @dannymcclain for articulating this reasoning better than I could ☝️

Copy link

melvin-bot bot commented Oct 4, 2024

@greg-schroeder, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Oct 4, 2024
@rayane-djouah
Copy link
Contributor

Thanks for clarifying the expected result!

@melvin-bot melvin-bot bot removed the Overdue label Oct 4, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

@greg-schroeder, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
@rayane-djouah
Copy link
Contributor

@Krishna2323's proposal looks good to me.

I agree that the most appropriate check is ReportUtils.canUserPerformWriteAction, as we're doing in similar areas of the codebase (example: PR #46560). in addition to isActionableReportMentionWhisper(reportAction).

Note: I think it's better to pass a canUserPerformWriteAction boolean flag to shouldReportActionBeVisible instead of the report object.


Additionally, I appreciate that the proposal suggests addressing the bug with the actionable join request whisper action and other whispers, even though they are not within the scope of this issue

The check can be structured as follows:
(isActionableReportMentionWhisper(reportAction) || isActionableJoinRequestPending(reportAction)) && !canUserPerformWriteAction

Since self DMs cannot be archived, using isActionableTrackExpense(reportAction) is unnecessary (this can be confirmed by the assigned internal engineer).

Moreover, my testing confirms that we can still invite users from an actionable mention whisper to the report, so including isActionableMentionWhisper(reportAction) is not required. If this behavior isn't expected, we can reintroduce isActionableMentionWhisper(reportAction) and adjust the backend to prohibit the action (pending confirmation from the assigned internal engineer).

Based on my tests, the backend doesn't permit interactions with the actionable whisper for ActionableReportMentionWhisper (as reported in this issue) and ActionableJoinRequestPending. Screenshots:

ActionableJoinRequestPending:
Screenshot 2024-10-07 at 10 18 50 PM

ActionableReportMentionWhisper:
Screenshot 2024-10-07 at 10 29 58 PM

Here is a screen recording of the tests:

Screen.Recording.2024-10-07.at.10.06.39.PM.mov

🎀👀🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Oct 7, 2024
@greg-schroeder
Copy link
Contributor

Same as above

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Nov 5, 2024
Copy link

melvin-bot bot commented Nov 5, 2024

This issue has not been updated in over 15 days. @tgolen, @greg-schroeder, @rayane-djouah, @Krishna2323 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@rayane-djouah
Copy link
Contributor

rayane-djouah commented Nov 5, 2024

Update: @Krishna2323 is addressing PR review comments #50692 (comment)

@greg-schroeder greg-schroeder added Weekly KSv2 and removed Monthly KSv2 labels Nov 11, 2024
@greg-schroeder
Copy link
Contributor

Work on PR continues

@greg-schroeder greg-schroeder added Daily KSv2 and removed Weekly KSv2 labels Nov 15, 2024
@greg-schroeder
Copy link
Contributor

Changes requested on PR, still underway

@greg-schroeder
Copy link
Contributor

Merged. Awaiting deploy to staging -> prod

Copy link

melvin-bot bot commented Nov 21, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

Copy link

melvin-bot bot commented Nov 21, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

Copy link

melvin-bot bot commented Nov 22, 2024

@tgolen, @greg-schroeder, @rayane-djouah, @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@rayane-djouah
Copy link
Contributor

PR on staging. @Krishna2323 and I addressed the above bugs in a follow up PR

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Nov 22, 2024
@melvin-bot melvin-bot bot changed the title [$250] Room - Create room whisper reappears when interacting with it after workspace is deleted [HOLD for payment 2024-11-29] [$250] Room - Create room whisper reappears when interacting with it after workspace is deleted Nov 22, 2024
Copy link

melvin-bot bot commented Nov 22, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 22, 2024
Copy link

melvin-bot bot commented Nov 22, 2024

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

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

Copy link

melvin-bot bot commented Nov 22, 2024

@rayane-djouah @greg-schroeder @rayane-djouah The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@rayane-djouah
Copy link
Contributor

BugZero Checklist:

  • Classify the bug:

    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
  • 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: [Feat] Implement room mention actionable whisper #41406 (comment)

  • If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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

  • If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [@greg-schroeder] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

#### Precondition:

- A workspace has been created.

#### Test:

1. Navigate to the Workspace Chat.
2. Send a mention of a non-existing room.
3. Verify that an actionable whisper for the room mention is displayed.
4. Navigate to Settings > Workspaces.
5. Delete the workspace.
6. Return to the Workspace Chat.
7. Verify that the actionable whisper is no longer displayed.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 29, 2024
@greg-schroeder
Copy link
Contributor

Paid contracts via Upwork, filed regression issue

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Status: Polish
Development

No branches or pull requests

10 participants