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][$500] Chat - Latest chat user is not showing in recent on Start chat screen #31397

Closed
4 of 6 tasks
izarutskaya opened this issue Nov 15, 2023 · 32 comments
Closed
4 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@izarutskaya
Copy link

izarutskaya commented Nov 15, 2023

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.3.99-0
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
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Go to FAB> Start chat
  3. Add e-mail and send a message to conversation
  4. Go back to home page
  5. Go to FAB> Start chat

Expected Result:

Latest chat should appear on the top of suggestion list

Actual Result:

Latest chat with user is not showing in recent on Start chat screen

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

Bug6277920_1700069001676.JLFA3209.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019fd53c186025d25b
  • Upwork Job ID: 1724859146766970880
  • Last Price Increase: 2023-11-15
  • Automatic offers:
    • DylanDylann | Contributor | 27775244
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 15, 2023
@melvin-bot melvin-bot bot changed the title Chat - Latest chat user is not showing in recent on Start chat screen [$500] Chat - Latest chat user is not showing in recent on Start chat screen Nov 15, 2023
Copy link

melvin-bot bot commented Nov 15, 2023

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

Copy link

melvin-bot bot commented Nov 15, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 15, 2023
Copy link

melvin-bot bot commented Nov 15, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Nov 15, 2023

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

@manlaig
Copy link

manlaig commented Nov 15, 2023

Proposal

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

Latest user chats are not visible under chat suggestions

What is the root cause of that problem?

The reportOption.login field is null or undefined on some users, those reports are skipped along with reports with multiple participants even though they don't have multiple participants. This is caused by this condition:

// Skip if we aren't including multiple participant reports and this report has multiple participants
if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.login) {
continue;
}

For example, this is a reportOption object for one of my accounts that was affected by this bug. As you can see, the login property in this object is undefined, so this user chat was not appearing under chat suggestions because it was skipped along with reports with multiple participants.

{"accountID": 15938398, "allReportErrors": {}, "alternateText": "", "brickRoadIndicator": "", "hasDraftComment": false, "hasOutstandingIOU": false, "icons": [{"fallBackIcon": undefined, "id": 15938398, "name": "🏴󠁧󠁢󠁥󠁮󠁧󠁿", "source": [Function SvgComponent], "type": "avatar"}], "iouReportAmount": 0, "iouReportID": undefined, "isArchivedRoom": false, "isChatRoom": false, "isDefaultRoom": false, "isExpenseReport": false, "isIOUReportOwner": false, "isMoneyRequestReport": false, "isOptimisticPersonalDetail": undefined, "isOwnPolicyExpenseChat": false, "isPinned": false, "isPolicyExpenseChat": false, "isTaskReport": false, "isThread": false, "isUnread": false, "isWaitingOnBankAccount": false, "keyForList": "4771041332570714", "login": undefined, "ownerAccountID": 0, "participantsList": [{"accountID": 15938398, "avatar": "https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/default-avatar_20.png", "displayName": "🏴󠁧󠁢󠁥󠁮󠁧󠁿", "firstName": "🏴󠁧󠁢󠁥󠁮󠁧󠁿", "lastName": ""}], "pendingAction": undefined, "phoneNumber": undefined, "policyID": "_FAKE_", "reportID": "4771041332570714", "searchText": "🏴󠁧󠁢󠁥󠁮󠁧󠁿", "shouldShowSubscript": false, "subtitle": "", "text": "🏴󠁧󠁢󠁥󠁮󠁧󠁿", "tooltipText": "15938398"}

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

Need to change the above condition to check for reportOption.accountID field instead of checking for reportOption.login to filter users.
So, the above condition would change to:

if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.accountID)
{
       continue;
}

This happened to one of my accounts and making this change fixed the issue for me.

Result

RPReplay_Final1700077600.5.MOV

What alternative solutions did you explore? (Optional)

@manlaig
Copy link

manlaig commented Nov 15, 2023

Updated proposal to include a screen recording

@manlaig
Copy link

manlaig commented Nov 15, 2023

Updated proposal to make small adjustments to the wording.

@manlaig
Copy link

manlaig commented Nov 15, 2023

Updated proposal to add an example of the bug.

@paultsimura
Copy link
Contributor

paultsimura commented Nov 16, 2023

Proposal

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

Some users are missing from the "Recents" section when starting a chat.

What is the root cause of that problem?

When building the options list, we filter out the reports where the option has missing login as a way to verify that this is a multiple-users chat:

// Skip if we aren't including multiple participant reports and this report has multiple participants
if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.login) {
continue;
}

Some users from 1:1 chats have missing login data, so these options are filtered out here as well, even though they are 1:1 chats, not multiple ones.

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

First, we should change this condition to check for both accountID and login missing, because in some cases, a new user will have a login, but not an accountID (we then generate the accountID for such users), and we don't want to miss these reports either:

if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.accountID && !reportOption.login) {
    continue;
}

Second, if we change only this condition, the options will appear in the list, but they will navigate to incorrect reports because we use the following logic when clicking on the option:

/**
* Creates a new 1:1 chat with the option and the current user,
* or navigates to the existing chat if one with those participants already exists.
*
* @param {Object} option
*/
function createChat(option) {
Report.navigateToAndOpenReport([option.login]);
}

Therefore, we should change this logic to the following:

    function createChat(option) {
        if (!option.login) {
            Report.navigateToAndOpenReportWithAccountIDs([option.accountID]);
        }

        Report.navigateToAndOpenReport([option.login]);
    }

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Nov 20, 2023
@DylanDylann
Copy link
Contributor

Proposal

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

Chat - Latest chat user is not showing in recent on Start chat screen

What is the root cause of that problem?

When A starts a new chat with B (The account B doesn't already exist), the login field in personal detail will be null. Only when account B is created and replies to a new message to account A, personal details in account A will be updated. It makes account B isn't displayed on the Start chat Page because this logic

if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.login) {

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

if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.login) {

Here we should update to use accountID field instead of login field because in the multiple participant chat accountID always be '0'

When doing that, we accept to display options that don't have a login field on Start Chat Page. So that we also update some logics in Start Chat Page

function toggleOption(option) {

In this function we should use accountID instead of login field to check condition

IN here

function createChat(option) {

we should check to useNavigation.dismissModal(option.reportID); field instead of login field like we did in Search Page

App/src/pages/SearchPage.js

Lines 161 to 171 in ff4c947

if (option.reportID) {
this.setState(
{
searchValue: '',
},
() => {
Navigation.dismissModal(option.reportID);
},
);
} else {
Report.navigateToAndOpenReport([option.login]);

One more place

const createGroup = () => {

We should check if login is null/underfined we can use option.text or using accountIDs instead of

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Nov 21, 2023

@allroundexperts, @muttmuure Eep! 4 days overdue now. Issues have feelings too...

@allroundexperts
Copy link
Contributor

@DylanDylann's proposal looks good to me. @paultsimura I think you missed the case when a group is to be created.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Nov 21, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 21, 2023
Copy link

melvin-bot bot commented Nov 21, 2023

📣 @allroundexperts Please request via NewDot manual requests for the Reviewer role ($500)

Copy link

melvin-bot bot commented Nov 21, 2023

📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@amyevans
Copy link
Contributor

Just a heads up I'll be OOO the remainder of the week, if a PR is ready before then, I'll review it next Monday or Tuesday. Thanks!

@DylanDylann
Copy link
Contributor

@amyevans @allroundexperts As expected in OP, when A starts a new chat with B (The account B doesn't already exist), we will display the user B on the Start Chat Page. Do you want do the same thing in the other page (that don't include multipe participant chat) like RoomInvitePage, WorkSpaceInvitePage, TaskAssigneeSelectorModal, MoneyRequestParticipantsSelector

@DylanDylann
Copy link
Contributor

Screenshot 2023-11-23 at 15 47 15

One more thing, we will display "Hidden" as display name as decision here

@allroundexperts
Copy link
Contributor

I guess @amyevans would answer this better.

@amyevans
Copy link
Contributor

As expected in OP, when A starts a new chat with B (The account B doesn't already exist), we will display the user B on the Start Chat Page. Do you want do the same thing in the other page (that don't include multipe participant chat) like RoomInvitePage, WorkSpaceInvitePage, TaskAssigneeSelectorModal, MoneyRequestParticipantsSelector

Hmm, to be honest I'm not sure of expected behavior on this one, and also given that Hidden will be displayed per your comment here I am second guessing if it makes sense to display User B in the Start Chat Page either, as I think it's potentially confusing for User A.

I know the logic that goes into which users are "known" is complex, so wondering if these questions have already been discussed or if @puneetlath has an opinion here on expected behavior.

@DylanDylann
Copy link
Contributor

@puneetlath Could you help to check above comment: #31397 (comment) ?

Copy link

melvin-bot bot commented Nov 29, 2023

@amyevans @allroundexperts @muttmuure @DylanDylann this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2023
Copy link

melvin-bot bot commented Dec 4, 2023

@amyevans, @allroundexperts, @muttmuure, @DylanDylann Huh... This is 4 days overdue. Who can take care of this?

@amyevans
Copy link
Contributor

amyevans commented Dec 6, 2023

Coming back to this, I think that because Hidden will be displayed, it really is not adding any value, so we shouldn't ship this change yet.

There's been some internal discussion though to consider accountA as knowing accountB if accountA invited accountB (https://github.com/Expensify/Expensify/issues/342920), so let's wait until that's implemented and then we can move forward here.

@melvin-bot melvin-bot bot removed the Overdue label Dec 6, 2023
@amyevans amyevans added Weekly KSv2 and removed Daily KSv2 labels Dec 6, 2023
@amyevans amyevans changed the title [$500] Chat - Latest chat user is not showing in recent on Start chat screen [HOLD][$500] Chat - Latest chat user is not showing in recent on Start chat screen Dec 6, 2023
@melvin-bot melvin-bot bot added the Overdue label Dec 14, 2023
@amyevans
Copy link
Contributor

https://github.com/Expensify/Expensify/issues/342920 is closed so I retested and can no longer repro:

Screen.Recording.2023-12-15.at.10.02.52.AM.mov

I think we can close this but feel free to reopen if you disagree @muttmuure

@melvin-bot melvin-bot bot removed the Overdue label Dec 15, 2023
@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 18, 2023

@amyevans @muttmuure Should we process payment for this issue? Since this issue has already been assigned to contributors and we spent lots of effort on this issue to propose a solution and create a draft PR. This is some similar issues that the compensation is paid out without PR: #27108 (comment) #28844 (comment)

@DylanDylann
Copy link
Contributor

@amyevans @muttmuure Could you help to check the above comment?

@muttmuure
Copy link
Contributor

Yeah I think that sounds fair enough

@muttmuure
Copy link
Contributor

@DylanDylann I've sent you an offer on Upwork

@muttmuure
Copy link
Contributor

$500 - @allroundexperts for C+

@DylanDylann
Copy link
Contributor

@muttmuure Thanks, I accepted

@JmillsExpensify
Copy link

$500 payment approved for @allroundexperts based on this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants