Skip to content

fix: User mute and unmute system messages displayed when hidden - #41751

Open
jessicaschelly wants to merge 1 commit into
developfrom
fix/hide-mute-unmute-system-messages
Open

fix: User mute and unmute system messages displayed when hidden#41751
jessicaschelly wants to merge 1 commit into
developfrom
fix/hide-mute-unmute-system-messages

Conversation

@jessicaschelly

@jessicaschelly jessicaschelly commented Aug 11, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Fixes user mute and unmute system messages remaining visible in rooms configured to hide them.

The room setting stores the grouped mute_unmute type, while mute and unmute events are stored as user-muted and user-unmuted. This change normalizes the grouped type in both client-side filtering and server-loaded message history, and adds regression coverage for both paths.

Issue(s)

CORE-2536

Steps to test or reproduce

  1. Open a room and go to its settings.
  2. Enable Hide System Messages and select User muted / unmuted.
  3. Mute another user.
  4. Verify that the mute system message is not displayed.
  5. Unmute the same user.
  6. Verify that the unmute system message is not displayed.
  7. Reload the room and confirm that both messages remain hidden.

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Fixed hidden system-message settings so muted and unmuted user notifications no longer remain visible in rooms configured to hide them.
    • Improved handling of room-specific hidden-message preferences.
  • Tests

    • Added coverage verifying correct filtering of mute and unmute notifications.

@dionisio-bot

dionisio-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f1aecce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d3aed8a2-979b-4a53-bf30-a7fc17b9cf61

📥 Commits

Reviewing files that changed from the base of the PR and between 15a251c and f1aecce.

📒 Files selected for processing (4)
  • .changeset/quiet-users-hide.md
  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
  • apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts
  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
  • apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts
  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
apps/meteor/**

📄 CodeRabbit inference engine (CLAUDE.md)

The main Rocket.Chat Meteor application resides in apps/meteor/; place its application code there rather than in other monorepo areas.

Files:

  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
  • apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts
  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
🧠 Learnings (9)
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
  • apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts
  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
  • apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts
  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/client/views/room/MessageList/hooks/useMessages.ts
  • apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts
  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/quiet-users-hide.md
📚 Learning: 2026-08-05T22:02:59.828Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 41707
File: apps/meteor/server/hooks/messages/processThreads.ts:66-68
Timestamp: 2026-08-05T22:02:59.828Z
Learning: In Rocket.Chat Meteor server code, `callbacks.runAsync` returns its input item rather than the asynchronous callback promise. Callers of `afterReadMessages` must invoke `callbacks.runAsync` without awaiting it, keeping read-receipt I/O off the message-send path; this includes `apps/meteor/server/hooks/messages/processThreads.ts`.

Applied to files:

  • apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
🔇 Additional comments (4)
apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts (1)

4-9: LGTM!

apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts (1)

10-10: LGTM!

Also applies to: 23-38, 94-94, 104-104

apps/meteor/client/views/room/MessageList/hooks/useMessages.ts (1)

15-21: LGTM!

.changeset/quiet-users-hide.md (1)

1-5: LGTM!


Walkthrough

The change normalizes mute_unmute into user-muted and user-unmuted in server hidden-message resolution and client message merging. Unit tests cover room-specific configurations and grouped message expansion.

Changes

System message visibility

Layer / File(s) Summary
Server hidden-message normalization
apps/meteor/server/lib/messaging/getHiddenSystemMessages.ts, apps/meteor/tests/unit/server/lib/messaging/getHiddenSystemMessage.spec.ts
The server selects room.sysMes when it is an array, then expands mute_unmute into user-muted and user-unmuted. Unit tests cover the normalized and unchanged room configurations.
Client message merge normalization
apps/meteor/client/views/room/MessageList/hooks/useMessages.ts, .changeset/quiet-users-hide.md
The client expands grouped mute and unmute messages before deduplication. The changeset records the patch release note.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f1aec

This localized change normalizes mute/unmute system-message filtering for hidden-message settings and adds regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested labels: type: bug

Suggested reviewers: cardoso, dnouv, dougfabris

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the fix for visible user mute and unmute system messages when rooms hide them.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2536: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.70%. Comparing base (e3e1e35) to head (f1aecce).
⚠️ Report is 21 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #41751   +/-   ##
========================================
  Coverage    68.69%   68.70%           
========================================
  Files         4166     4167    +1     
  Lines       159382   159437   +55     
  Branches     28219    28258   +39     
========================================
+ Hits        109493   109538   +45     
- Misses       44730    44734    +4     
- Partials      5159     5165    +6     
Flag Coverage Δ
e2e 58.89% <50.00%> (-0.02%) ⬇️
e2e-api 46.01% <50.00%> (+0.28%) ⬆️
unit 70.56% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jessicaschelly
jessicaschelly marked this pull request as ready for review August 14, 2026 16:56
@jessicaschelly
jessicaschelly requested review from a team as code owners August 14, 2026 16:56

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/meteor/client/views/room/MessageList/hooks/useMessages.ts">

<violation number="1" location="apps/meteor/client/views/room/MessageList/hooks/useMessages.ts:18">
P3: The mute/unmute grouped-type expansion (`mute_unmute` → `['user-muted', 'user-unmuted']`) is now written twice in this PR (here in `mergeHideSysMessages` and identically in `getHiddenSystemMessages`), even though `server/lib/systemMessage/hideSystemMessage.ts` already centralizes this logic with `isMutedUnmuted`. Extract one shared helper (e.g. `normalizeHiddenSystemMessages`) and reuse it on both client and server so the mapping can't drift when more grouped types are added.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

return Array.from(
new Set(
[...sysMesArray1, ...sysMesArray2].flatMap((messageType): MessageTypesValues[] =>
messageType === 'mute_unmute' ? ['user-muted', 'user-unmuted'] : [messageType],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The mute/unmute grouped-type expansion (mute_unmute['user-muted', 'user-unmuted']) is now written twice in this PR (here in mergeHideSysMessages and identically in getHiddenSystemMessages), even though server/lib/systemMessage/hideSystemMessage.ts already centralizes this logic with isMutedUnmuted. Extract one shared helper (e.g. normalizeHiddenSystemMessages) and reuse it on both client and server so the mapping can't drift when more grouped types are added.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/client/views/room/MessageList/hooks/useMessages.ts, line 18:

<comment>The mute/unmute grouped-type expansion (`mute_unmute` → `['user-muted', 'user-unmuted']`) is now written twice in this PR (here in `mergeHideSysMessages` and identically in `getHiddenSystemMessages`), even though `server/lib/systemMessage/hideSystemMessage.ts` already centralizes this logic with `isMutedUnmuted`. Extract one shared helper (e.g. `normalizeHiddenSystemMessages`) and reuse it on both client and server so the mapping can't drift when more grouped types are added.</comment>

<file context>
@@ -12,7 +12,13 @@ const mergeHideSysMessages = (
+	return Array.from(
+		new Set(
+			[...sysMesArray1, ...sysMesArray2].flatMap((messageType): MessageTypesValues[] =>
+				messageType === 'mute_unmute' ? ['user-muted', 'user-unmuted'] : [messageType],
+			),
+		),
</file context>

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.

1 participant