Skip to content

fix: hidden system messages being counted on discussions - #41673

Merged
dionisio-bot[bot] merged 28 commits into
developfrom
fix/substract-hidden-sys-msgs-from-discussion-count
Aug 18, 2026
Merged

dionisio-bot[bot] merged 28 commits into
developfrom
fix/substract-hidden-sys-msgs-from-discussion-count

Conversation

@nazabucciarelli

@nazabucciarelli nazabucciarelli commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes (including videos or screenshots)

The issue is that we are not filtering out from the discussion's message count those system messages that are intended to be 'hidden', either from the global Hide_System_Messages setting or from the room preferences.

So, to address this:

Backend-side
‎Messages.ts‎ Added countVisibleByRoomIdContainingTypes model method to subtract that number to the overall room messages count. Also refreshDiscussionMetadata was modified to update the discussion metadata only if the parent message has a dlm (discussion last message timestamp) earlier than the room lm, avoiding race conditions with stale data.
‎saveRoomSettings.ts‎ Added broadcast to update discussion metadata when the changed room has prid, meaning it's a discussion.
‎updateAndNotifyParentRoomWithParentMessage.ts‎ After the extraction to a 'lib' file on the parent branch (see #41702) the updateAndNotifyParentRoomWithParentMessage method logic was changed to filter out hidden system messages.
‎propagateDiscussionMetadata.ts‎ sysMes property was added to the projection object, since it's needed for filtering them out from the overall message count in updateAndNotifyParentRoomWithParentMessage.
‎service.ts‎ I've only added sysMes to the projection, since we need that property to update the parent message count correctly in line 220, taking into account those hidden types.

Client-side:
‎EditRoomInfo.tsx‎ Added a hint on the 'Hide System Messages' option, as accorded with design and product team.
‎en.i18n.json‎ Added the key for the hint.

Issue(s)

SUP-1080 Discussion Message Count Includes Hidden System Messages

Steps to test or reproduce

Known Limitations

  • If you modify the Hide system messages global option (not the room-specific one) under Manage -> Settings -> Messages, you will notice the discussion count with those kind of system messages will not immediately update. Instead, you will have to send a regular message to recompute the count value, which is a reasonable trade-off, given that the global setting is usually configured once and adding a watcher for it to update each discussion parent message with the proper count would be a too expensive operation. Important to clarify that this doesn't happen with the room-specific setting.
  • Discussions previously with a mismatched count won't be fixed. Existing discussions will only correct their message count if the room-specific 'Hide system messages' option is updated or if a message is sent to the room.

Review in cubic

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Discussion message counts now exclude system messages hidden globally or within the discussion.
    • Counts and latest-message timestamps update when hidden-message settings change.
    • Added an explanatory hint to the room edit panel describing hidden-message counting.
  • Bug Fixes
    • Corrected discussion metadata synchronization after system-message visibility settings are updated.
  • Tests
    • Expanded coverage for visible, room-hidden, and globally hidden system messages.

@nazabucciarelli nazabucciarelli added this to the 8.8.0 milestone Aug 3, 2026
@dionisio-bot

dionisio-bot Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5fbd0ae

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

This PR includes changesets to release 6 packages
Name Type
@rocket.chat/model-typings Patch
@rocket.chat/models Patch
@rocket.chat/meteor Patch
@rocket.chat/i18n 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 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Discussion message counts now exclude hidden system messages. Counts update when hidden-message settings change. The room edit panel explains this behavior, and end-to-end tests cover visible and hidden scenarios.

Changes

Discussion message count visibility

Layer / File(s) Summary
Visible message counting
packages/model-typings/src/models/IMessagesModel.ts, packages/models/src/models/Messages.ts
Adds countVisibleByRoomIdContainingTypes and prevents stale discussion metadata updates.
Discussion metadata recalculation
apps/meteor/server/lib/messaging/discussions/..., apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts, apps/meteor/server/services/messages/service.ts, apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
Resolves hidden system-message types, recalculates discussion counts, and updates parent metadata when system-message settings change.
Room settings guidance and validation
apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx, packages/i18n/src/locales/en.i18n.json, apps/meteor/tests/end-to-end/api/rooms.ts, .changeset/sour-pugs-bow.md
Adds accessible guidance and validates visible, room-hidden, and globally hidden message-count scenarios.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RoomSettings
  participant DiscussionUpdater
  participant MessagesModel
  participant ParentRoom
  RoomSettings->>DiscussionUpdater: save hidden system-message settings
  DiscussionUpdater->>MessagesModel: count visible messages for hidden types
  MessagesModel-->>DiscussionUpdater: return visible message count
  DiscussionUpdater->>ParentRoom: refresh and notify discussion metadata
Loading

Suggested labels: type: bug

Suggested reviewers: sampaiodiego, kevlehman, tassoevan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing hidden system messages from being counted in discussions.
✨ 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)
  • SUP-1080: 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 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.25%. Comparing base (7390f47) to head (5fbd0ae).
⚠️ Report is 42 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41673      +/-   ##
===========================================
+ Coverage    68.69%   69.25%   +0.56%     
===========================================
  Files         4166     4234      +68     
  Lines       159310   167316    +8006     
  Branches     28285    29869    +1584     
===========================================
+ Hits        109440   115877    +6437     
- Misses       44703    46264    +1561     
- Partials      5167     5175       +8     
Flag Coverage Δ
e2e 58.91% <ø> (+0.03%) ⬆️
e2e-api 46.15% <78.94%> (+0.14%) ⬆️
unit 71.19% <100.00%> (+0.63%) ⬆️

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.

@nazabucciarelli
nazabucciarelli changed the base branch from develop to fix/discussions-msg-count August 5, 2026 20:49
@nazabucciarelli
nazabucciarelli marked this pull request as ready for review August 7, 2026 16:27
@nazabucciarelli
nazabucciarelli requested review from a team as code owners August 7, 2026 16:27

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts (1)

9-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the new implementation comments.

Lines 9-12 and Line 19 add comments in a TypeScript implementation. Remove them.

As per coding guidelines, “Avoid code comments in the implementation.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts`
around lines 9 - 20, Remove the implementation comments above
getHiddenMessageTypes and inside its mute_unmute mapping, while leaving the
function logic unchanged.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/sour-pugs-bow.md:
- Line 8: Update the release note to accurately describe global
hidden-system-message setting changes: clarify that discussion counts are
refreshed when a later regular message triggers the discussion refresh, rather
than immediately when the global setting changes. Preserve the statements about
excluding hidden message types and the room-level option hint.

In
`@apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts`:
- Around line 38-41: Update updateAndNotifyParentRoomWithParentMessage so the
awaited getDiscussionMessagesCount result cannot overwrite newer discussion
metadata: before applying or refreshing the parent message, verify that the
parent metadata is not newer than room.lm, or obtain and apply the count and
metadata from a single atomic snapshot. Preserve the existing notification flow
for valid, current metadata.

---

Nitpick comments:
In
`@apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts`:
- Around line 9-20: Remove the implementation comments above
getHiddenMessageTypes and inside its mute_unmute mapping, while leaving the
function logic unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a7dcf0fc-9a30-481f-975a-007368ed3208

📥 Commits

Reviewing files that changed from the base of the PR and between 5c79bd8 and 37a97e1.

📒 Files selected for processing (10)
  • .changeset/sour-pugs-bow.md
  • apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts
  • apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/tests/end-to-end/api/rooms.ts
  • packages/i18n/src/locales/en.i18n.json
  • packages/model-typings/src/models/IMessagesModel.ts
  • packages/models/src/models/Messages.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (1/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (3/5)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (1/4)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (2/5)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (3/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (4/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (2/4)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (5/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (4/5)
🧰 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/server/meteor-methods/rooms/saveRoomSettings.ts
  • apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx
  • packages/models/src/models/Messages.ts
  • apps/meteor/tests/end-to-end/api/rooms.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • packages/model-typings/src/models/IMessagesModel.ts
  • apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.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/server/meteor-methods/rooms/saveRoomSettings.ts
  • apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx
  • apps/meteor/tests/end-to-end/api/rooms.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts
packages/**

📄 CodeRabbit inference engine (CLAUDE.md)

Shared libraries belong in packages/, while other services belong in apps/ and ee/.

Files:

  • packages/models/src/models/Messages.ts
  • packages/i18n/src/locales/en.i18n.json
  • packages/model-typings/src/models/IMessagesModel.ts
🧠 Learnings (7)
📚 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/server/meteor-methods/rooms/saveRoomSettings.ts
  • packages/models/src/models/Messages.ts
  • apps/meteor/tests/end-to-end/api/rooms.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • packages/model-typings/src/models/IMessagesModel.ts
  • apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.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/server/meteor-methods/rooms/saveRoomSettings.ts
  • packages/models/src/models/Messages.ts
  • apps/meteor/tests/end-to-end/api/rooms.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • packages/model-typings/src/models/IMessagesModel.ts
  • apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.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/server/meteor-methods/rooms/saveRoomSettings.ts
  • apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx
  • packages/models/src/models/Messages.ts
  • apps/meteor/tests/end-to-end/api/rooms.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • packages/model-typings/src/models/IMessagesModel.ts
  • apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts
📚 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/meteor-methods/rooms/saveRoomSettings.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • apps/meteor/server/lib/messaging/discussions/updateAndNotifyParentRoomWithParentMessage.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx
📚 Learning: 2026-07-15T01:31:50.632Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 41382
File: packages/model-typings/src/models/IPushTokenModel.ts:10-10
Timestamp: 2026-07-15T01:31:50.632Z
Learning: In Rocket.Chat’s push-token model, APNs/GCM standard tokens and PushKit VoIP tokens use distinct, globally-unique token string values. As a result, when deduplicating/looking up tokens, key identity solely on `{ tokenValue, appName }` (e.g., for `findOneByTokenAndAppName`, `removeDuplicateTokens`) and do **not** include `tokenType` in the uniqueness criteria to avoid collisions between standard and VoIP tokens.

Applied to files:

  • packages/models/src/models/Messages.ts
  • packages/model-typings/src/models/IMessagesModel.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/sour-pugs-bow.md
🪛 LanguageTool
.changeset/sour-pugs-bow.md

[style] ~8-~8: ‘taking into account’ might be wordy. Consider a shorter alternative.
Context: ...essages count displayed on a discussion taking into account system messages which are hidden inside...

(EN_WORDINESS_PREMIUM_TAKING_INTO_ACCOUNT)

🔇 Additional comments (8)
packages/model-typings/src/models/IMessagesModel.ts (1)

143-143: LGTM!

packages/models/src/models/Messages.ts (1)

765-788: LGTM!

apps/meteor/server/services/messages/service.ts (1)

199-199: LGTM!

apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts (1)

42-42: LGTM!

apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts (1)

12-12: LGTM!

Also applies to: 338-340

packages/i18n/src/locales/en.i18n.json (1)

2653-2653: LGTM!

apps/meteor/client/views/room/contextualBar/Info/EditRoomInfo/EditRoomInfo.tsx (1)

478-506: LGTM!

apps/meteor/tests/end-to-end/api/rooms.ts (1)

2073-2080: LGTM!

Also applies to: 2096-2144

Comment thread .changeset/sour-pugs-bow.md Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts`:
- Around line 339-344: Refresh the room’s sysMes value after
saveRoomSystemMessages(rid, value) completes and before calling
updateAndNotifyParentRoomWithParentMessage(room), so the helper receives the
persisted hidden system-message types while retaining the existing error
handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a9cf05d-4bad-4c83-b59b-4b0231f602fd

📥 Commits

Reviewing files that changed from the base of the PR and between fc75846 and cbf78e8.

📒 Files selected for processing (2)
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
  • apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/server/hooks/messages/propagateDiscussionMetadata.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (4)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/server/meteor-methods/rooms/saveRoomSettings.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/server/meteor-methods/rooms/saveRoomSettings.ts
🧠 Learnings (4)
📚 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/server/meteor-methods/rooms/saveRoomSettings.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/server/meteor-methods/rooms/saveRoomSettings.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/server/meteor-methods/rooms/saveRoomSettings.ts
📚 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/meteor-methods/rooms/saveRoomSettings.ts
🔇 Additional comments (1)
apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts (1)

12-12: LGTM!

Comment thread apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts

@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.

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/models/src/models/Messages.ts (1)

1574-1578: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep implementation comments out of this file.

Move this contract description to the model interface or project documentation. Keep packages/models/src/models/Messages.ts concise.

As per coding guidelines, avoid code comments in the implementation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/models/src/models/Messages.ts` around lines 1574 - 1578, Remove the
implementation comment immediately above Messages.refreshDiscussionMetadata and
preserve the method signature and behavior. Relocate the contract description to
the corresponding model interface or project documentation, keeping
packages/models/src/models/Messages.ts free of explanatory implementation
comments.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/models/src/models/Messages.ts`:
- Around line 1578-1584: Update refreshDiscussionMetadata so the stale-update
predicate remains enforced when room.lm is absent: either require a defined lm
before performing the update or add an explicit no-timestamp predicate that
prevents overwriting a newer dlm. Preserve the existing guard for rooms with lm
and ensure older metadata cannot be applied.

---

Nitpick comments:
In `@packages/models/src/models/Messages.ts`:
- Around line 1574-1578: Remove the implementation comment immediately above
Messages.refreshDiscussionMetadata and preserve the method signature and
behavior. Relocate the contract description to the corresponding model interface
or project documentation, keeping packages/models/src/models/Messages.ts free of
explanatory implementation comments.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fef9996a-8510-44eb-8d94-01f6fd4f0bb2

📥 Commits

Reviewing files that changed from the base of the PR and between cbf78e8 and 6045efc.

📒 Files selected for processing (2)
  • apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts
  • packages/models/src/models/Messages.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (2)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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:

  • packages/models/src/models/Messages.ts
packages/**

📄 CodeRabbit inference engine (CLAUDE.md)

Shared libraries belong in packages/, while other services belong in apps/ and ee/.

Files:

  • packages/models/src/models/Messages.ts
🧠 Learnings (4)
📚 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:

  • packages/models/src/models/Messages.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:

  • packages/models/src/models/Messages.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:

  • packages/models/src/models/Messages.ts
📚 Learning: 2026-07-15T01:31:50.632Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 41382
File: packages/model-typings/src/models/IPushTokenModel.ts:10-10
Timestamp: 2026-07-15T01:31:50.632Z
Learning: In Rocket.Chat’s push-token model, APNs/GCM standard tokens and PushKit VoIP tokens use distinct, globally-unique token string values. As a result, when deduplicating/looking up tokens, key identity solely on `{ tokenValue, appName }` (e.g., for `findOneByTokenAndAppName`, `removeDuplicateTokens`) and do **not** include `tokenType` in the uniqueness criteria to avoid collisions between standard and VoIP tokens.

Applied to files:

  • packages/models/src/models/Messages.ts
🔇 Additional comments (1)
packages/models/src/models/Messages.ts (1)

765-775: LGTM!

Comment thread packages/models/src/models/Messages.ts
cardoso
cardoso previously approved these changes Aug 14, 2026

@cardoso cardoso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two caveats/questions: were the frontend changes necessary to be in this PR? I see the tests assert 0 and 1, are we really covered with those?

tassoevan
tassoevan previously approved these changes Aug 14, 2026
KevLehman
KevLehman previously approved these changes Aug 17, 2026
@FragaKrummenauer FragaKrummenauer added the stat: QA assured Means it has been tested and approved by a company insider label Aug 18, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Aug 18, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Aug 18, 2026
Merged via the queue into develop with commit 8984df8 Aug 18, 2026
56 checks passed
@dionisio-bot
dionisio-bot Bot deleted the fix/substract-hidden-sys-msgs-from-discussion-count branch August 18, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-blocked stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants