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.55k stars 2.89k forks source link

Web - Thread - Noting happen when clicking "Join thread" button unless returning to inbox again #52472

Open IuliiaHerets opened 1 day ago

IuliiaHerets commented 1 day 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.61-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): testpayment935+613@gmail.com Issue reported by: Applause Internal Team

Action Performed:

  1. (User A) Send any message to 1:1 conversation for the account you have access to
  2. (User B) go to the new message from User A and open context menu
  3. (User B) Click "Join Thread"
  4. Navigating to Settings/Search and go to Inbox again

Expected Result:

The "Join Thread" option should navigate to thread immediately or not navigating at all unless clicking "reply in thread"

Actual Result:

"Join thread" option navigating to "reply in thread" page after navigating to other bottom navigations like Search or Setting and returning back to inbox

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/55c0e212-9e0c-459e-8fe4-c83ee1eb9cec

View all open jobs on GitHub

melvin-bot[bot] commented 1 day 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.

FitseTLT commented 1 day ago

Edited by proposal-police: This proposal was edited at 2024-11-13 13:06:19 UTC.

Proposal

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

Web - Thread - Noting happen when clicking "Join thread" button unless returning to inbox again

What is the root cause of that problem?

We are unnecessarily displaying join option for non-parent actions https://github.com/Expensify/App/blob/4d9be4eb2537b49fa6cf35135770cf3c6d62a1cd/src/pages/home/report/ContextMenu/ContextMenuActions.tsx#L313 and when we press the join button openReport is called with new child report id here https://github.com/Expensify/App/blob/4d9be4eb2537b49fa6cf35135770cf3c6d62a1cd/src/libs/actions/Report.ts#L1871 so when we navigate back to the inbox it will be opened as the last accessed report

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

We should check if the report action has a childReportID to show join menu

return (
                !subscribed &&
                !isWhisperAction &&
                !isTaskAction &&
                !isExpenseReportAction &&
                !isThreadFirstChat &&
                !!reportAction?.childReportID &&
                (shouldDisplayThreadReplies || (!isDeletedAction && !isArchivedRoom))
            );

We won't need the else condition here https://github.com/Expensify/App/blob/4d9be4eb2537b49fa6cf35135770cf3c6d62a1cd/src/libs/actions/Report.ts#L1852

What alternative solutions did you explore? (Optional)

mkzie2 commented 1 day ago

Proposal

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

"Join thread" option navigating to "reply in thread" page after navigating to other bottom navigations like Search or Setting and returning back to inbox

What is the root cause of that problem?

The difference is here, if reportAction?.childReportNotificationPreference is undefined, getChildReportNotificationPreference function returns always if the user is the creator of the action, otherwise it returns hidden

https://github.com/Expensify/App/blob/b1c1a4b53746f6e9ba0a7853faaf42695ca4c067/src/pages/home/report/ContextMenu/ContextMenuActions.tsx#L305

https://github.com/Expensify/App/blob/b1c1a4b53746f6e9ba0a7853faaf42695ca4c067/src/libs/ReportUtils.ts#L1762-L1768

https://github.com/Expensify/App/blob/b1c1a4b53746f6e9ba0a7853faaf42695ca4c067/src/libs/actions/Report.ts#L1843

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

In this function, we should navigate to the thread if we create a new report

Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(newChat.reportID));

https://github.com/Expensify/App/blob/b1c1a4b53746f6e9ba0a7853faaf42695ca4c067/src/libs/actions/Report.ts#L1874

What alternative solutions did you explore? (Optional)

Or we can get childReportNotificationPreference here from reportAction?.childReportNotificationPreference

const childReportNotificationPreference = reportAction?.childReportNotificationPreference;

https://github.com/Expensify/App/blob/b1c1a4b53746f6e9ba0a7853faaf42695ca4c067/src/pages/home/report/ContextMen u/ContextMenuActions.tsx#L305

And update the subscribed

const subscribed = !(childReportNotificationPreference === 'hidden');

https://github.com/Expensify/App/blob/4d9be4eb2537b49fa6cf35135770cf3c6d62a1cd/src/pages/home/report/ContextMenu/ContextMenuActions.tsx#L308