App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-26] [$175] Room - Notification option is still visible after leaving the room

Open lanitochka17 opened this issue 2 weeks ago • 21 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: 9.5.40-0 Reproducible in staging?: Yes Reproducible in production?: yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/Expensify/issues/439505 Email or phone of affected tester (no customers): Issue reported by: Applause Internal Team Bug source: Device used: App Component:

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Create new room & navigate to it
  3. Tap header -> settings
  4. Notice Notifications is set "daily"
  5. Tap leave and now tap header -> settings

Expected Result:

Notifications field should be missing

Actual Result:

Notification option is still visible after leaving the room

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [ ] MacOS: Chrome / Safari

Screenshots/Videos

https://github.com/user-attachments/assets/066668ca-060a-4730-b03b-9b8b457a6b2a

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

lanitochka17 avatar Nov 17 '26 17:11 lanitochka17

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

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

Proposal

What is the root cause of that problem?

The Notifications row treats an existing participant record as proof that the user is still subscribed to the room. Leaving a default restricted workspace room retains that record but changes its notification preference to hidden, so the row incorrectly remains visible.

Confidence: Medium — supported by code and existing tests; browser reproduction was not performed.

Supporting evidence

This explains the row remaining visible even after a successful state update; stale caching is not required.

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

Keep the existing visibility checks and additionally hide Notifications when the already-resolved settings preference is hidden. Use isHiddenForCurrentUser(notificationPreferenceValue) rather than checking the raw report preference.

Add regression coverage for:

  • Daily → leave → Notifications disappears.
  • Rejoin or failed leave → Notifications returns.
  • Muted rooms and legacy admin-room defaults remain supported.
Compatibility considerations

The settings-specific preference helper preserves legacy admin-room defaults while retaining explicit hidden values: ReportUtils.ts:1981–1998.

The hidden-state helper does not classify Mute as hidden: ReportUtils.ts:2617–2632.

What alternative solutions did you explore? (Optional)

Changing leave-room behavior is unnecessary: retaining room access is intentional. A cache refresh would not fix a visibility condition that accepts the correctly updated participant record.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/107138) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 17 '26 17:11 MelvinBot

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~015c92a110b06ee5b3

Proposal

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

After leaving a workspace room, navigating to the room's Settings page still displays the Notify me about new messages row with the value Hidden, and tapping it still opens the Notification preferences screen instead of hiding the Notifications field.

What is the root cause of that problem?

  1. When a workspace member leaves a workspace room (leaveRoom in src/libs/actions/Report/index.ts, isWorkspaceMemberLeavingWorkspaceRoom || isChatThread), the participant entry in report.participants[currentUserAccountID] is intentionally retained in Onyx with notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN ('hidden') so workspace members can still view/rejoin the room.
  2. In PR #101664 (commit be25be7d, "Fix empty notification preferences in admin rooms"), getReportNotificationPreferenceForSettings was introduced so legacy #admins rooms with an empty preference ('') fall back to the room default while preserving explicit 'hidden' values. However, that PR also changed:
    • DynamicReportSettingsPage.tsx: shouldShowNotificationPref was switched from !isMoneyRequestReport && !isHiddenForCurrentUser(notificationPreferenceValue) to !isMoneyRequestReport && !!currentUserParticipant, and the !isHiddenForCurrentUser(notificationPreferenceValue) guard around formatting notificationPreference at line 56 was removed.
    • DynamicNotificationPreferencePage.tsx: shouldDisableNotificationPreferences was switched from (!isMoneyRequest && isHiddenForCurrentUser(currentNotificationPreference)) to !currentUserParticipant.

Because leaving a workspace room retains currentUserParticipant with notificationPreference: 'hidden', !!currentUserParticipant evaluates to true, so DynamicReportSettingsPage renders Notify me about new messages: Hidden (unlike ReportDetailsMenuSettingsItem.tsx and ProfilePage.tsx, which both check !isHiddenForCurrentUser(...)), and deep-linking to DynamicNotificationPreferencePage remains accessible even though the user has left the room.

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

  1. Hide the Notifications row when notificationPreferenceValue resolves to hidden in src/pages/settings/Report/DynamicReportSettingsPage.tsx:

    • Keep notificationPreferenceValue = getReportNotificationPreferenceForSettings(report, currentUserAccountID) so legacy #admins rooms with an empty '' preference still resolve to their default ('always') and remain visible/editable as intended in PR #101664.
    • Re-import isHiddenForCurrentUser from @libs/ReportUtils, remove the then-unused currentUserParticipant variable (line 49), and restore the hidden guard:
      const notificationPreferenceValue = getReportNotificationPreferenceForSettings(report, currentUserAccountID);
      const shouldShowNotificationPref = !isMoneyRequestReport && !isHiddenForCurrentUser(notificationPreferenceValue);
      const notificationPreference =
          shouldShowNotificationPref && notificationPreferenceValue
              ? translate(`notificationPreferencesPage.notificationPreferences.${notificationPreferenceValue}`)
              : '';
      
      • After leaving a room (notificationPreference: 'hidden'), getReportNotificationPreferenceForSettings returns 'hidden' (for both regular rooms and #admins rooms), so shouldShowNotificationPref is false and the Notifications field is hidden.
      • Muted rooms ('mute') and legacy #admins rooms with '' ('always') return false from isHiddenForCurrentUser(...), so they continue showing Mute / Immediately.
  2. Also guard the Notifications preference screen in src/pages/settings/Report/DynamicNotificationPreferencePage.tsx:

    • Re-import isMoneyRequestReport as isMoneyRequestReportUtils from @libs/ReportUtils and restore the hidden check alongside isArchivedNonExpenseReport and isSelfDM (while keeping currentUserParticipant / currentUserNotificationPreference at lines 33-34 intact so saving on a legacy #admins room with '' still works):
      const isMoneyRequest = isMoneyRequestReportUtils(report);
      const shouldDisableNotificationPreferences =
          isArchivedNonExpenseReport(report, isReportArchived) || isSelfDM(report) || (!isMoneyRequest && isHiddenForCurrentUser(currentNotificationPreference));
      
    • Since getReportNotificationPreferenceForSettings returns 'hidden' when !currentUserParticipant as well as after leaveRoom, this prevents users who left a room from editing notification preferences via deep link without rejoining, while still preserving legacy #admins rooms ('' -> room default).
  3. Add unit/component regression tests:

    • Test DynamicReportSettingsPage:
      • Hides the Notify me about new messages row when participants[accountID].notificationPreference is 'hidden' (after leaveRoom), and shows it again once set to 'daily'/'always'/'mute' (rejoin or failed leave).
      • Preserves PR #101664 behavior for legacy #admins rooms where participants[accountID].notificationPreference is '' (row remains visible with default value) while hiding an #admins room explicitly set to 'hidden'.
    • Test DynamicNotificationPreferencePage:
      • Shows FullPageNotFoundView when opened for a left/hidden room (notificationPreference: 'hidden'), while remaining editable for 'mute', 'daily', 'always', and legacy #admins rooms with ''.

What alternative solutions did you explore? (Optional)

  • Checking !isHiddenForCurrentUser(report) (raw getReportNotificationPreference) instead of getReportNotificationPreferenceForSettings: rejected because getReportNotificationPreference returns 'hidden' for legacy #admins rooms with an empty '' preference, which would regress PR #101664.
  • Modifying leaveRoom (src/libs/actions/Report/index.ts) to remove participants[currentUserAccountID] for workspace rooms: rejected because retaining the participant entry with 'hidden' is intentional so workspace members keep room access and can rejoin.

andregrunert-ctrl avatar Nov 17 '26 17:11 andregrunert-ctrl

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 17 '26 17:11 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f6ba4c6dde3d0fbb

Proposal

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

After leaving a workspace room, navigating to the room's Settings page still displays the Notify me about new messages row (showing Hidden), and tapping it navigates to the Notification preferences screen instead of hiding the Notifications field for users who left the room.

What is the root cause of that problem?

  1. In src/pages/settings/Report/DynamicReportSettingsPage.tsx (line 63):
    const shouldShowNotificationPref = !isMoneyRequestReport && !!currentUserParticipant;
    
    When a workspace member leaves a room (leaveRoom in src/libs/actions/Report/index.ts), their participant record in report.participants[currentUserAccountID] is intentionally retained with notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN ('hidden') so the user can still view the room and rejoin.
  2. Because currentUserParticipant remains defined in Onyx, !!currentUserParticipant evaluates to true.
  3. Even though notificationPreferenceValue = getReportNotificationPreferenceForSettings(report, currentUserAccountID) correctly resolves to 'hidden', DynamicReportSettingsPage does not check !isHiddenForCurrentUser(notificationPreferenceValue) before rendering the MenuItemField.
  4. Additionally, in src/pages/settings/Report/DynamicNotificationPreferencePage.tsx (line 39), shouldDisableNotificationPreferences only checks !currentUserParticipant, so opening or deep-linking to the notification preferences screen remains accessible even after leaving the room.

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

  1. In src/pages/settings/Report/DynamicReportSettingsPage.tsx:

    • Import isHiddenForCurrentUser from @libs/ReportUtils.
    • Update shouldShowNotificationPref (line 63) to check !isHiddenForCurrentUser(notificationPreferenceValue):
      const shouldShowNotificationPref = !isMoneyRequestReport && !isHiddenForCurrentUser(notificationPreferenceValue);
      const notificationPreference =
          shouldShowNotificationPref && notificationPreferenceValue
              ? translate(`notificationPreferencesPage.notificationPreferences.${notificationPreferenceValue}`)
              : '';
      
    • When a user leaves a room (notificationPreference: 'hidden'), isHiddenForCurrentUser('hidden') returns true, so shouldShowNotificationPref evaluates to false and the Notifications row is cleanly hidden.
    • For active members, muted rooms ('mute'), and legacy #admins rooms ('' -> default 'always'), isHiddenForCurrentUser(...) returns false, so they remain visible as intended by PR #101664.
  2. In src/pages/settings/Report/DynamicNotificationPreferencePage.tsx:

    • Update shouldDisableNotificationPreferences (line 39) to also guard against hidden preference:
      const shouldDisableNotificationPreferences =
          isArchivedNonExpenseReport(report, isReportArchived) || isSelfDM(report) || isHiddenForCurrentUser(currentNotificationPreference);
      
    • This ensures users who left the room cannot edit notification preferences via direct navigation without rejoining, displaying FullPageNotFoundView.
  3. Unit Tests:

    • Add unit test coverage in tests/unit/ReportUtilsTest.ts:
      • Assert that DynamicReportSettingsPage hides the Notification preference row when participant.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN.
      • Assert that DynamicNotificationPreferencePage disables editing / renders not found when the preference is 'hidden'.
      • Assert that active rooms, muted rooms, and legacy admin rooms with empty strings continue to show the row.

What alternative solutions did you explore? (Optional)

  • Modifying leaveRoom in src/libs/actions/Report/index.ts to delete report.participants[currentUserAccountID]: rejected because retaining the participant entry with 'hidden' is intentional in Expensify so workspace members keep access and can rejoin.

jpereyra243-byte avatar Nov 17 '26 19:11 jpereyra243-byte

⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

melvin-bot[bot] avatar Nov 17 '26 19:11 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f6ba4c6dde3d0fbb

jpereyra243-byte avatar Nov 17 '26 19:11 jpereyra243-byte

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 17 '26 19:11 melvin-bot[bot]

@MelvinBot implement this

bernhardoj avatar Nov 18 '26 06:11 bernhardoj

Oh wait, forgot to approve the proposal.

🎀 👀 🎀 C+ reviewed

bernhardoj avatar Nov 18 '26 06:11 bernhardoj

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

🤖 Web test steps verification results: ✅ pass

All four checks passed on dev NewDot web. Setup: created a workspace and room.

Muted room retains its notification settings button
Step Status
New room defaults to Daily notificationsHeader → Settings showed Daily.
✅
Notifications absent after leavingSettings showed only Who can post and Visibility.
Settings after leaving, with notifications absent
✅
Notifications return after rejoiningRejoining restored the Daily notification row.
✅
Muted room notifications remain editableSaved Mute, then successfully changed to Immediately.
Muted room retains its notification settings button
✅

Implemented in draft PR: Hide room notification settings after leaving, assigned to bernhardoj. Five regression tests, lint, formatting, spelling, and typecheck passed. Full Jest, Storybook, and changed-file compiler checks timed out; limitations are documented in the PR.


view run · no recording available

MelvinBot avatar Nov 18 '26 06:11 MelvinBot

@bernhardoj

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.42-2 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/107213

If no regressions arise, payment will be issued on 2026-11-26. :confetti_ball:

The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

melvin-bot[bot] avatar Nov 19 '26 19:11 melvin-bot[bot]

@bernhardoj Huh... This is 4 days overdue. Who can take care of this?

Triggered auto assignment to @mallenexpensify (Awaiting Payment)

Payment Summary

Resolving PRs:

  • https://github.com/Expensify/App/pull/107213

  • Reviewer: @bernhardoj owed $175 via NewDot

BugZero Checklist (@mallenexpensify)

  • [ ] I have confirmed assignees, roles, and Upwork contracts look correct
  • [ ] I have paid out Upwork contracts / manual NewDot requests
  • [ ] [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon

Contributor+ Checklist:

  • [x] [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to the comment on the PR: https://github.com/Expensify/App/pull/101664/changes#r4702785910 Link to the comment on the Issue: E/E issue

  • [x] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • [x] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal

Precondition:

  • joined a room

Test:

  1. Open the report settings
  2. Verify there is a "Notify me ..." setting
  3. Leave the room
  4. Open the report settings
  5. Verify there is no "Notify me ..." setting

Do we agree 👍 or 👎

bernhardoj avatar Nov 26 '26 01:11 bernhardoj

@mallenexpensify Huh... This is 4 days overdue. Who can take care of this?

Matt's AI agent:

Prep notes for the CM. This is not a payment approval. Do not request payment until the CM posts the final amount.

Ready.

Job price: $175.

  • bernhardoj (C+): 100%, via NewDot

Price basis: standard, no Help Wanted.

Next: press Caps+Y, then pay.

Evidence
  • C+ checklist by bernhardoj, 6 steps: comment
  • No TestRail case yet.
  • PR 107213 by MelvinBot, merged 2026-11-18, production 2026-11-19, approvers carlosmiceli. Videos: author 1/5, C+ 1/5.
  • Offending PR 101664 by fedirjh, production 2026-09-30, bug filed 2026-11-17: outside the window. No payee on it.

PAYPREP v1

mallenexpensify avatar Nov 30 '26 22:11 mallenexpensify