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.57k stars 2.91k forks source link

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

Open IuliiaHerets opened 1 week ago

IuliiaHerets commented 1 week 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

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021858763130278701100
  • Upwork Job ID: 1858763130278701100
  • Last Price Increase: 2024-11-19
Issue OwnerCurrent Issue Owner: @parasharrajat
melvin-bot[bot] commented 1 week 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 week 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 report actions that are not parent of a chat thread 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 only show join option on a report action if there is a chat thread associated with that report action that the user can join into (otherwise the join button will be a duplicate of reply in thread, there only difference being reply in thread opens the child report ). So 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 week ago

Edited by proposal-police: This proposal was edited at 2024-11-19 08:56:27 UTC.

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)

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

stephanieelliott commented 3 days ago

Agree this seems buggy, adding labels.

melvin-bot[bot] commented 3 days ago

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

melvin-bot[bot] commented 3 days ago

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

parasharrajat commented 3 days ago

Both of the proposals lack clear explanations.

  1. @FitseTLT When you say non-parent actions, what does that mean? Please don't use purely technical terms in explanations. It will help make it more readable. There are non-technical persons also reading these proposals.
  2. @mkzie2 You didn't explain what you are trying to achieve in your alternative solution. It just mentions changes.

Apart from this, the expected behavior here should be that the user does not navigate to the thread in any way. Please update your proposals for it. Ref: https://github.com/Expensify/App/pull/27994

mkzie2 commented 3 days ago

@parasharrajat I updated my alternative solution.

FitseTLT commented 3 days ago

@parasharrajat I have tried to make it more readable based on your suggestion. Can you check it again? Thx

parasharrajat commented 3 days ago

Thanks, both of you. But I think you missed the following part of the comment.

Apart from this, the expected behavior here should be that the user does not navigate to the thread in any way. Please update your proposals for it. Ref: https://github.com/Expensify/App/pull/27994

mkzie2 commented 3 days ago

Apart from this, the expected behavior here should be that the user does not navigate to the thread in any way.

@parasharrajat What does that mean? My alternative solution will only hide the Join thread, not add any navigate to thread logic.

FitseTLT commented 3 days ago

Thanks, both of you. But I think you missed the following part of the comment.

Apart from this, the expected behavior here should be that the user does not navigate to the thread in any way. Please update your proposals for it. Ref: #27994

@parasharrajat I have not proposed to navigate to the thread on join thread but only make the join thread option to be available only if the thread linked to the report action exists. Is there anything you haven't understood?

parasharrajat commented 3 days ago

I am telling the expected behaviour for this issue. It's not a feedback for any proposal.

FitseTLT commented 3 days ago

I am telling the expected behaviour for this issue. It's not a feedback for any proposal.

@parasharrajat There is no navigation going on join thread even on current main, the current issue is making the impression of it happening. When you navigate back to Inbox from search we open the recently accessed report but on join thread we called openReport, so that the previously unsubscribed chat thread will be available in FE, but that openReport request will make the chat thread as the lastAccessedReport, hence, that's why it navigates to the joined new chat thread on going back to inbox as shown in the OP.

But the purpose of the join thread button is, as clearly indicated in the PR you linked, to allow a user join back a thread they have unsubscribed. Thus, we shouldn't show the join thread menu for report actions that are not yet have a linked child report/ chat thread.

mkzie2 commented 3 days ago

I am telling the expected behaviour for this issue. It's not a feedback for any proposal.

When we click on Join thread, a new report is created and when we go back from search it is displayed as the last accessed report

@parasharrajat As I explained in the RCA, the thread is opened after going back from the search page because it's a newly created report. With my alternative solution, no new report is created then this bug doesn't happen.

parasharrajat commented 2 days ago

It is briefly mentioned here https://github.com/Expensify/App/pull/27994#discussion_r1364689708. IT should work like get Notified about replied feature of Slack.

I agree that navigation is happening due to lastaccessed report and openReport call. But that is what I am saying that it should not happen here.

But the purpose of the join thread button is, as clearly indicated in the PR you linked, to allow a user join back a thread they have unsubscribed. Thus, we shouldn't show the join thread menu for report actions that are not yet have a linked child report/ chat thread.

This is absolutely correct but this feature also works for chats where no thread is created so far.

Subscribing to a thread without comments (Need 2 users, User A and User B):

  1. With User B, comment in a chat
  2. With User A, subscribe to the comment that was just created
  3. With User B, reply to the comment
  4. Ensure that the thread shows up in User As LHN and they receive a notification
  5. Verify that no errors appear in the JS console

Here are the test steps for this one from that PR.

parasharrajat commented 2 days ago

@srikarparsi Can you please help us clarify the purpose of this feature?

srikarparsi commented 1 day ago

Sorry, the purpose of Join thread? If so, yes it should mimic get Notified about replied in replies. It shouldn't open the thread report.