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

Don't treat muted reports as unread in LHN #33779

Merged
merged 11 commits into from
Jan 24, 2024
Merged

Don't treat muted reports as unread in LHN #33779

merged 11 commits into from
Jan 24, 2024

Conversation

roryabraham
Copy link
Contributor

@roryabraham roryabraham commented Dec 29, 2023

Details

This PR accomplishes the following:

  • DO NOT mark muted reports unread in the LHN (eg, in bold), even if they have unread messages
  • Hide muted reports in the LHN in focus mode, even if they have unread messages
  • DO keep showing the "unread indicator" inside the chat

Fixed Issues

$ (partial) #33619

Tests

Setup

  1. Open NewDot in two windows and sign into two accounts, A and B.
  2. Create a DM between A and B
  3. As user A, Click on the report header, and switch the notification preference (Notify me about new messages) to Mute

Scenario 1: regular DM, "most recent" mode

  1. Make sure user A is in "most recent" mode (i.e: not in #focus mode – you can adjust that in Preferences -> Priority Mode)
  2. As user A, Open a different report. If on web, open another tab. If on mobile, background the app.
  3. As user B, send some messages to user A.
  4. As user A, verify
    1. You do not receive a push notification
    2. The unread count on the app / tab does not increment
  5. After about 20 seconds, as user A, reopen the app. verify that you can see the new messages in the LHN, but the report is not bold in the LHN.
  6. Open the report, and verify that you see the new message marker in the report above the last unread message from user B.

Scenario 2: regular DM, #focus mode

  1. As user A, switch to #focus mode.
  2. As user A, open a different report. Verify that the DM with user B is no longer visible in the LHN.
  3. As user B, send some messages to user A.
  4. As user A, verify that the report does not appear in the LHN.
  5. As user A, use Search to open the DM with user B. Verify that you see the new message marker in the report above the last unread message from user B.

Scenario 3: manual mark as unread, "most recent" mode

  1. As user A, switch to "most recent" mode
  2. As user A, open a report with no unread messages and no green brick road (GBR) indicator.
  3. Right-click or long-press on a message, and mark it as unread.
  4. Verify That the new message marker appears above the message you just marked as unread.
  5. As user A, verify that the report does not appear as bold in the LHN.

Scenario 4: manual mark as unread, #focus mode

  1. As user A, switch to #focus mode
  2. Open a report with no unread messages and no GBR indicator.
  3. Right-click or long-press on a message, and mark it as unread.
  4. Verify That the new message marker appears above the message you just marked as unread.
  5. Open another report.
  6. Verify that the previous report that you just marked as unread is not visible in the LHN.
  7. Using search, open the report you previously marked as unread.
  8. Verify that the new message marker appears above the message you previously marked as unread.

Scenario 5: Money request, #focus mode

  1. As user A, open a report other than the DM with user B, and verify that the DM with user B does not show in the LHN
  2. As user B, request $5 from user A
  3. As user A, verify that the DM with user B appears in the LHN and has a GBR indicator. Verify that it does not appear as bold.
  4. As user A, open the DM with user B and mark the request as settled elsewhere.
  5. As user A, open a different report.
  6. Verify that the DM with user B is no longer visible in the LHN.

#### Scenario 6: Task assignment, #focus mode
1. As user B, open the DM with user A and assign a task to user A.
1. As user A, verify that the DM with user B appears in the LHN and has a GBR indicator. Verify that is does not appear as bold.
1. As user A, open the DM with user B and mark the task as completed.
1. As user A, open a different report.
1. Verify that the DM with user B is no longer visible in the LHN.

Note: Scenario 6 is failing because the task report appears in the LHN as a new, fresh report. Therefore is has a fresh notification preference of Immediately. To fix this, I think all that's needed would be a back-end change to make new reports inherit the notification preference from their parent report. I'm not treating this as a blocker. Slack context

Scenario 7: Mention in a room, #focus mode

  1. As user A, create a workspace
  2. Invite user B to the workspace as a member.
  3. As user A, create a room in the new workspace, visible to workspace members with permissions for all members to comment.
  4. As user A, click on the room header, go to settings, and update the notification preference to Mute
  5. As user B, join the new room.
  6. As user A, open another report and verify that the room is not visible in the LHN.
  7. As user A, open another tab or background the app.
  8. As user B, open the room and send a message mentioning user A.
  9. As user A, verify that you do not receive a push notification and that the unread count for the app does not increase.
  10. After about 20 seconds, as user A, reopen the app. verify that the room appears in the LHN with a GBR indicator. Verify that it does not appear as bold.
  11. As user A, open the room and read the message send by user B.
  12. As user A, open another report.
  13. Verify that the room is no longer visible in the LHN.

Scenario 8: Pinning a chat, #focus mode

  1. As user A, verify that the DM with user B is not visible in the LHN.
  2. Using search, open the DM with user B.
  3. Click on the three dots details menu in the report header, and pin the chat.
  4. Open a different report.
  5. Verify that the pinned chat remains visible in the LHN.
  6. As user B, send a message in the DM with user A.
  7. As user A, verify that the pinned DM with user B remains visible, but is not bold.
  8. As user B, mention user A in a message.
  9. As user A, verify that the pinned DM with user B remains visible, and now has a GBR indicator. Verify that it is not bold.

Scenario 9: Basic regression test

  1. As User A, unmute the chat DM with user B, then open a different report.
  2. As User B, send a DM to user A
  3. As User A, verify that the chat from B is visible in the LHN and appears as bold / unread.
  • Verify that no errors appear in the JS console

Offline tests

n/a

QA Steps

  1. Same as test steps
  2. Important: Once complete, please create a follow-up GitHub issue to update TestRail to include regression steps covering the test steps from this PR, and comment on this PR to link the follow-up issue.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Scenario 1
Android: Native
android1.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iosWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov
Scenario 2
Android: Native
android2.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iOSWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov
Scenario 3
Android: Native
android3.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iOSWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov
Scenario 4
Android: Native
android4.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iOSWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov
Scenario 5
Android: Native
android5.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iOSWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov
~~Scenario 6~~
Scenario 7
Android: Native
android7.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iOSWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov
Scenario 8
Android: Native
android8.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iOSWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov
Scenario 9
Android: Native
android9.mp4
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
iOSWeb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov

@roryabraham roryabraham self-assigned this Dec 29, 2023
@roryabraham roryabraham requested a review from a team as a code owner December 29, 2023 20:17
@melvin-bot melvin-bot bot removed the request for review from a team December 29, 2023 20:17
Copy link

melvin-bot bot commented Dec 29, 2023

@rlinoz Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Copy link
Contributor

🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪

Android 🤖 iOS 🍎
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/33779/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Desktop 💻 Web 🕸️
❌ FAILED ❌ https://33779.pr-testing.expensify.com
The QR code can't be generated, because the Desktop build failed Web

👀 View the workflow run that generated this build 👀

# Conflicts:
#	src/libs/ReportUtils.ts
@roryabraham roryabraham changed the title [WIP] Don't treat muted reports as unread in LHN Don't treat muted reports as unread in LHN Jan 22, 2024
@roryabraham
Copy link
Contributor Author

Ready for review! cc @rlinoz

@akinwale
Copy link
Contributor

akinwale commented Jan 22, 2024

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native

33779-android-native

Android: mWeb Chrome

33779-android-chrome

iOS: Native

33779-ios-native

iOS: mWeb Safari

33779-ios-safari

MacOS: Chrome / Safari

Scenario 1

33779-scenario-1.mp4

Scenario 2

33779-scenario-2.mp4

Scenario 3

33779-scenario-3.mp4

Scenario 4

33779-scenario-4.mp4

Scenario 5

33779-scenario-5.mp4

Scenario 6

33779-scenario-6.mp4

Scenario 7

33779-scenario-7_1.mp4
33779-scenario-7_2.mp4

Scenario 8

33779-scenario-8.mp4
MacOS: Desktop

33779-desktop

@@ -3662,7 +3663,7 @@ function shouldReportBeInOptionList({

// All unread chats (even archived ones) in GSD mode will be shown. This is because GSD mode is specifically for focusing the user on the most relevant chats, primarily, the unread ones
if (isInGSDMode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB, but it would be nice to have some sort of comment that gives a hint what GSD mode is (in relation to focus mode and/or recent mode).

Copy link
Contributor

@akinwale akinwale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

All scenarios test well.

@melvin-bot melvin-bot bot requested a review from arosiclair January 23, 2024 04:23
Copy link

melvin-bot bot commented Jan 23, 2024

@arosiclair Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Copy link

melvin-bot bot commented Jan 23, 2024

🎯 @akinwale, thanks for reviewing and testing this PR! 🎉

An E/App issue has been created to issue payment here: #34943.

@rlinoz
Copy link
Contributor

rlinoz commented Jan 23, 2024

Hey @roryabraham , code looks good!

I just got this scenario, want to know if it is a problem:

Scenario 7: Mention in a room, #focus mode

When sending a message with user B in a room the notification count shown in the tab goes up for user A

@roryabraham
Copy link
Contributor Author

roryabraham commented Jan 23, 2024

@rlinoz good question – let's ask in slack

Edit: brought to slack, but I went ahead and fixed the bug. Great catch @rlinoz! Updating the testing steps to account for that...

# Conflicts:
#	src/components/LHNOptionsList/OptionRowLHN.tsx
#	src/libs/ReportUtils.ts
Copy link
Contributor

@rlinoz rlinoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rlinoz rlinoz merged commit edf0fd0 into main Jan 24, 2024
16 checks passed
@rlinoz rlinoz deleted the Rory-MuteUnread branch January 24, 2024 12:38
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/rlinoz in version: 1.4.32-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/francoisl in version: 1.4.32-5 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants