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

[$500] mWeb - LHN - IOU chat is not ordered under pinned messages in LHN #31221

Closed
1 of 6 tasks
lanitochka17 opened this issue Nov 10, 2023 · 11 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 10, 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.98-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:

Preconditions:

  1. User A have pinned chats in LHN
    Steps:
  2. User B request money to User A
  3. User A navigates LHN view

Expected Result:

The chats should be ordered by Pinned > Outstanding IOUs > Drafts > Other chats

Actual Result:

IOU chat is not ordered under pinned messages in LHN

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

Bug6271919_1699656039683.Recording__1363.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fd8b81f64cb92084
  • Upwork Job ID: 1723111524779155456
  • Last Price Increase: 2023-11-10
@lanitochka17 lanitochka17 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 10, 2023
@melvin-bot melvin-bot bot changed the title mWeb - LHN - IOU chat is not ordered under pinned messages in LHN [$500] mWeb - LHN - IOU chat is not ordered under pinned messages in LHN Nov 10, 2023
Copy link

melvin-bot bot commented Nov 10, 2023

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

Copy link

melvin-bot bot commented Nov 10, 2023

Triggered auto assignment to @joekaufmanexpensify (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 10, 2023
Copy link

melvin-bot bot commented Nov 10, 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 10, 2023

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

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Nov 11, 2023

Proposal

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

IOU chat is not ordered under pinned messages in LHN

What is the root cause of that problem?

The main problem is that when we generate a list of Pinned and GBRReports(with IOUs elements), the elements are a part of the same array
As a result, IOUs elements can be ahead of other elements

if (isPinned || ReportUtils.requiresAttentionFromCurrentUser(report)) {
pinnedAndGBRReports.push(report);

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

To fix this
We can separate these elements and update the code like (But here it’s worth clarifying exactly what order of elements we want to expect)

In my understanding it will look like this

  1. pinned or (GBRReports without IOU)
  2. only IOU
    ... other
       const isIOU = ReportUtils.isIOUReport(report);
        if ((isPinned || (ReportUtils.requiresAttentionFromCurrentUser(report) && !isIOU)) {
            pinnedAndGBRReports.push(report);
        } else if (isIOU) {
            iouReports.push(report);
        }
        ...

reportsToDisplay.forEach((report) => {
const isPinned = report.isPinned ?? false;
if (isPinned || ReportUtils.requiresAttentionFromCurrentUser(report)) {
pinnedAndGBRReports.push(report);
} else if (report.hasDraft) {
draftReports.push(report);
} else if (ReportUtils.isArchivedRoom(report)) {
archivedReports.push(report);
} else {
nonArchivedReports.push(report);
}
});

Then we need to sort these arrays (I think the first stage can be implemented within sorting, but it will be difficult to read)

    iouReports.sort((a, b) => (a?.displayName && b?.displayName ? a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()) : 0));
    pinnedAndGBRReports.sort((a, b) => (a?.displayName && b?.displayName ? a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()) : 0));

pinnedAndGBRReports.sort((a, b) => (a?.displayName && b?.displayName ? a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()) : 0));
draftReports.sort((a, b) => (a?.displayName && b?.displayName ? a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()) : 0));

And at the end create a new list

const LHNReports = [...pinnedAndGBRReports, ...iouReports, ...draftReports, ...nonArchivedReports, ...archivedReports].map((report) => report.reportID);

const LHNReports = [...pinnedAndGBRReports, ...draftReports, ...nonArchivedReports, ...archivedReports].map((report) => report.reportID);

What alternative solutions did you explore? (Optional)

NA

@DylanDylann
Copy link
Contributor

Proposal

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

mWeb - LHN - IOU chat is not ordered under pinned messages in LHN

What is the root cause of that problem?

// The LHN is split into four distinct groups, and each group is sorted a little differently. The groups will ALWAYS be in this order:
// 1. Pinned/GBR - Always sorted by reportDisplayName
// 2. Drafts - Always sorted by reportDisplayName
// 3. Non-archived reports and settled IOUs
// - Sorted by lastVisibleActionCreated in default (most recent) view mode
// - Sorted by reportDisplayName in GSD (focus) view mode
// 4. Archived reports
// - Sorted by lastVisibleActionCreated in default (most recent) view mode
// - Sorted by reportDisplayName in GSD (focus) view mode
const pinnedAndGBRReports: Report[] = [];
const draftReports: Report[] = [];
const nonArchivedReports: Report[] = [];
const archivedReports: Report[] = [];
reportsToDisplay.forEach((report) => {
const isPinned = report.isPinned ?? false;
if (isPinned || ReportUtils.requiresAttentionFromCurrentUser(report)) {
pinnedAndGBRReports.push(report);

We combined the pinned report and GBRReport in the same section and the order of these report in this section is sort by the display name

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

Let's see this comment

the green dot always makes the chat go to the top of the list under pinned chats (no matter how the green dot is being set, via mention, outstanding IOU or something else)

I think we should put the pinned report and GBRReport into 2 sections separately and display the pinned report before GBRReport

What alternative solutions did you explore? (Optional)

@DylanDylann
Copy link
Contributor

@puneetlath @greg-schroeder I see that you have context that relate to this issue in here could you help to confirm the expected ?

@melvin-bot melvin-bot bot added the Overdue label Nov 13, 2023
@joekaufmanexpensify
Copy link
Contributor

Going to triage this today

@melvin-bot melvin-bot bot removed the Overdue label Nov 13, 2023
@puneetlath
Copy link
Contributor

The chats should be ordered by Pinned > Outstanding IOUs > Drafts > Other chats

Ah yes, we have changed the ordering so that pinned and GBR (green dot) are treated the same. So they will be mixed together.

@lanitochka17 we might need to update our regression tests to account for this.

@isagoico
Copy link

Thanks for the ping - Have updated the following TC to mention that pending IOUs (green dot) and pinned chats are at the same level for ordering:

@puneetlath
Copy link
Contributor

Thanks! Going to go ahead and close this.

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

7 participants