App icon indicating copy to clipboard operation
App copied to clipboard

Thread - Unable to invite user to thread when the thread originates from group chat

Open lanitochka17 opened this issue 10 months ago • 11 comments

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.58-4 Reproducible in staging?: Y Reproducible in production?: N If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to FAB > Start chat
  3. Create a group chat with two users
  4. Send a message in group chat
  5. Right click on message > Reply in thread
  6. Click on the thread header > Members
  7. Invite any user

Expected Result:

User is invited successfully

Actual Result:

User is not invited to the thread when the thread originates from group chat. The member count changes from 2 back to 1.

Workaround:

Unknown

Platforms:

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

  • [x] Android: Native
  • [x] Android: mWeb Chrome
  • [x] iOS: Native
  • [x] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/1b9be08a-2fe7-4665-8bfd-780b53102567

View all open jobs on GitHub

lanitochka17 avatar Mar 31 '24 17:03 lanitochka17

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

github-actions[bot] avatar Mar 31 '24 17:03 github-actions[bot]

Triggered auto assignment to @arosiclair (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

melvin-bot[bot] avatar Mar 31 '24 17:03 melvin-bot[bot]

We think that this bug might be related to #vip-vsp

lanitochka17 avatar Mar 31 '24 17:03 lanitochka17

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

lanitochka17 avatar Mar 31 '24 17:03 lanitochka17

Response from backend:

{"jsonCode":401,"message":"401 Group Chats should use InviteToGroupChat command","onyxData":[],"requestID":"xxx"}

rayane-djouah avatar Apr 01 '24 00:04 rayane-djouah

Proposal

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

Unable to invite user to thread when the thread originates from group chat

What is the root cause of that problem?

The backend returns 401 Group Chats should use InviteToGroupChat command when inviting members in a thread that originates from a group chat.

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

we need to make the invite room command conditional on whether the parent report is a group chat or not, if its a group chat then we need to send InviteToGroupChat instead of InviteToRoom.

to achieve that we need to add a new write command InviteToGroupChat here:

    INVITE_TO_GROUP_CHAT: 'InviteToGroupChat',

then inside the inviteToRoom function in the Report.ts file, we need to change this to:

    const parentReport = currentReportData?.[report.parentReportID];
    const isParentReportGroupChat = ReportUtils.isGroupChat(parentReport);
    API.write(isParentReportGroupChat ? WRITE_COMMANDS.INVITE_TO_GROUP_CHAT : WRITE_COMMANDS.INVITE_TO_ROOM, parameters, {optimisticData, successData, failureData});

abzokhattab avatar Apr 01 '24 01:04 abzokhattab

I reproduced on staging and prod v1.4.57-5 so this is not a blocker

arosiclair avatar Apr 01 '24 13:04 arosiclair

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

melvin-bot[bot] avatar Apr 01 '24 13:04 melvin-bot[bot]

I think this probably should be internal but I'm not sure. @marcaaron I saw your name on InviteToRoom and InviteToGroupChat. What do you think? Not sure if those can be used for threads too.

arosiclair avatar Apr 01 '24 13:04 arosiclair

This depends on the outcome of https://expensify.slack.com/archives/C066HJM2CAZ/p1712005980413999

I'm not sure if we intentionally designed this feature to work any kind of way, but proposed a couple of paths forward in that thread.

Gonna stay assigned here so I don't lose the context here. But maybe let's remove the Bug label for now as well until we have chosen a direction.

marcaaron avatar Apr 01 '24 21:04 marcaaron

@marcaaron Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Apr 05 '24 18:04 melvin-bot[bot]

I'm gonna close this one in favor of https://github.com/Expensify/Expensify/issues/384761

That lays out in clearer terms how this feature should work.

marcaaron avatar Apr 24 '24 22:04 marcaaron