Skip to content

CRITICAL: Update Mute behavior to not show as unread in the LHN. #33619

Closed

Description

@quinthar

Note: This is being actively discussed in Slack here.

Strategy:
Supporting a billion users requires supporting a wide variety of work styles. We know even from our early discussions that the behavior of the LHN is extremely personal, with very subtle variations resulting in significant visceral reactions. While we can't satisfy everyone (and if we think a particular flow is bad, we might not want to), all things being equal we should aim to be as inclusive of as many workflows as possible.

Problem:
Coming from this discussion, we've realized our current Mute behavior only partially mutes. It does disable realtime notifications on that channel, and also disables UnreadMessageSummary on that channel. But it still shows the chat as unread in the LHN. To avoid this LHN distraction requires someone to leave/join the channel frequently, which is cumbersome, and distracting to the rest of the channel (because of your leave/join messages).

Solution:
Mimic Slack and make Mute fully mute, by not showing as unread in the LHN. This has at least a few benefits:

  • It doesn't return it in the LHN when "Focus mode" is enabled (unless pinned), allowing for faster OpenApp/Reconnect app
  • It allows you to get notified by @here and @channel group mentions (which are presumed to be more important), without getting distracted by anything else.
  • It allows you to pin a chat for quick access without being distracted by if it's read/unread.
  • It allows you to read, post, and disappear without needing to explicitly leave, and without triggering any joined/left messages

So there are advantages to mimicking Slack's Mute behavior. Are there any disadvantages? Is anyone using our current Mute behavior who would be annoyed by this change?

Activity

  1. converted this from a draft issue on Dec 26, 2023
  2. added
    Hot PickReady for an engineer to pick up and run with
    on Dec 27, 2023
  3. quinthar commented on Dec 28, 2023

    @quinthar
    ContributorAuthor

    Optimistically assigning to @neil-marcellini as I know this was important to him.

  4. self-assigned this
    on Dec 29, 2023
  5. roryabraham commented on Dec 29, 2023

    @roryabraham
    Contributor

    Coming from slack with my understanding of the requirements here. Update OpenApp and ReconnectApp to:

    • ONLY return muted reports if they are "pinned"
    • DO NOT mark muted reports unread in the LHN (eg, in bold), even if they have unread messages
    • DO keep showing the "unread indicator" inside the chat

    I have a feeling these will be more complex than they might seem on the surface but I'm going to dig in here and try to come up with a plan.

  6. added and removed
    Hot PickReady for an engineer to pick up and run with
    on Dec 29, 2023
  7. melvin-bot commented on Dec 29, 2023

    @melvin-bot

    Current assignee @roryabraham is eligible for the Engineering assigner, not assigning anyone new.

  8. roryabraham commented on Dec 29, 2023

    @roryabraham
    Contributor

    Slight modification to the above:

    when in #focus mode ONLY return muted reports if they are "pinned"

  9. roryabraham commented on Dec 29, 2023

    @roryabraham
    Contributor

    when in #focus mode ONLY return muted reports if they are "pinned"

    It looks like this should be relatively easy to accomplish by updating this WHERE clause as follows:

    diff --git a/auth/lib/Report.cpp b/auth/lib/Report.cpp
    index c1d0e6cc5c..993ee0151a 100644
    --- a/auth/lib/Report.cpp
    +++ b/auth/lib/Report.cpp
    @@ -5097,13 +5097,16 @@ JSON::Value Report::getChats(SQLite& db, const int64_t accountID, const list<str
                 "    OR r.reportID IN parentReportsWithOutstandingChildRequest "
                 //   Task assigned to accountID is not complete
                 "    OR (COALESCE(JSON_EXTRACT(rnvps.rNVPs, " + SQ("$." + string(NVP_TYPE)) + "), '') = " + SQ(TYPE_TASK) + " AND r.managerID = " + SQ(accountID) + " AND status = " + SQ(STATUS_OPEN) + ") "
    -            //   Reports with unread comments: lastReadTime_ is older than the lastReportAction.created
    +            //   Reports with unread comments: lastReadTime_ is older than the lastReportAction.created, except those w/ notification preference "muted"
                 "    OR ("
    -            "         CASE "
    -            "           WHEN " + lastReportActionType + " = " + SQ(ACTION_CLOSED) + " THEN lastVisibleActionCreatedBeforeArchived "
    -            "           ELSE " + lastReportActionCreated + " "
    -            "         END > " + lastReadTime + " "
    -            "       ) "
    +            "      ("
    +            "        CASE "
    +            "          WHEN " + lastReportActionType + " = " + SQ(ACTION_CLOSED) + " THEN lastVisibleActionCreatedBeforeArchived "
    +            "          ELSE " + lastReportActionCreated + " "
    +            "        END > " + lastReadTime + " "
    +            "      )"
    +            "      AND COALESCE(JSON_EXTRACT(rnvps.rNVPs, " + SQ("$." + string(NVP_NOTIFICATION_PREFERENCES) + "." + to_string(accountID)) + "), '') != " + SQ(NOTIFICATION_PREFERENCE_MUTE) +
    +            "    ) "
                 //   Retrieve the user's primary policy workspace chat if it's available so it can be accessed locally for requesting money
                 + (policyWorkspaceChatID > 0 ? ownPolicyExpenseChatFilter : "") +
                 //   Transaction threads are returned so they can be displayed on NewDot's chat list with RBR when they have violations

    Draft PR for that piece here: https://github.com/Expensify/Auth/pull/9560

  10. roryabraham commented on Dec 29, 2023

    @roryabraham
    Contributor

    DO NOT mark muted reports unread in the LHN (eg, in bold), even if they have unread messages

    For this piece, it looks like "whether a chat is unread" in the LHN is determined here, by ReportUtils.isUnread. So I think we can update it to NOT mark muted reports as unread by simply updating that function like so:

    diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
    index b41b74cd57..5a746b9e45 100644
    --- a/src/libs/ReportUtils.ts
    +++ b/src/libs/ReportUtils.ts
    @@ -3269,6 +3269,10 @@ function isUnread(report: OnyxEntry<Report>): boolean {
             return false;
         }
     
    +    if (report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE) {
    +        return false;
    +    }
    +
         // lastVisibleActionCreated and lastReadTime are both datetime strings and can be compared directly
         const lastVisibleActionCreated = report.lastVisibleActionCreated ?? '';
         const lastReadTime = report.lastReadTime ?? '';

    However, I think we'll want to control that by a flag, because there are other places where ReportUtils.isUnread is used, such as here, where we'd want to consider it unread even if its notification preference is MUTE

  11. 7 remaining items

  12. roryabraham commented on Jan 5, 2024

    @roryabraham
    Contributor

    The source of my woes was that due to a recent change w/ reliable updates I needed to be running bwm. Ioni sent out an email and we're discussing running bwm as a service in the VM to make the dev environment more automatic.

    Anyways, during my testing I found that a number of things just weren't working as expected, and then I discovered that was due to a recent regression on staging. I created a PR to fix that regression that we'll want to CP to staging, but I was blocked on completing my testing until that's merged.

  13. roryabraham commented on Jan 12, 2024

    @roryabraham
    Contributor

    Was trying to push this over the finish line today, but was blocked by an unrelated deploy blocker.

  14. roryabraham commented on Jan 12, 2024

    @roryabraham
    Contributor

    Removing reviewing label so this doesn't appear greyed out in my K2

  15. roryabraham commented on Jan 12, 2024

    @roryabraham
    Contributor

    This is currently blocked by #34466

  16. changed the title [-]CRITICAL: Update `Mute` behavior to not show as unread in the LHN.[/-] [+][HOLD] CRITICAL: Update `Mute` behavior to not show as unread in the LHN.[/+] on Jan 12, 2024
  17. quinthar commented on Jan 21, 2024

    @quinthar
    ContributorAuthor

    #34466 has been merged, this is no longer blocked. What are next steps?

  18. changed the title [-][HOLD] CRITICAL: Update `Mute` behavior to not show as unread in the LHN.[/-] [+]CRITICAL: Update `Mute` behavior to not show as unread in the LHN.[/+] on Jan 21, 2024
  19. roryabraham commented on Jan 22, 2024

    @roryabraham
    Contributor

    PR put in for review. Just a note, I think I'll create an external follow-up issue to cover my changes with automated tests in the existing UnreadIndicatorsTest file. It can all be covered by automated tests, I just didn't take the time to build them. The manual testing takes a lot of time because there are so many scenarios, which to me suggests that this will be vulnerable to regressions. Therefore the automated tests will be valuable.

  20. quinthar commented on Jan 23, 2024

    @quinthar
    ContributorAuthor

    Can you link the PR here? I'm not sure what you are referring to with "PR put in for review".

  21. roryabraham commented on Jan 24, 2024

    @roryabraham
    Contributor

    This is the PR: #33779

  22. quinthar commented on Jan 26, 2024

    @quinthar
    ContributorAuthor

    Woohoo deployed to staging!

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

Metadata

Metadata

Assignees

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions