Skip to content

chore: migrate rooms.saveNotification endpoint to new API format w…#38893

Open
Rohitgiri02 wants to merge 6 commits intoRocketChat:developfrom
Rohitgiri02:migrate/rooms-saveNotification
Open

chore: migrate rooms.saveNotification endpoint to new API format w…#38893
Rohitgiri02 wants to merge 6 commits intoRocketChat:developfrom
Rohitgiri02:migrate/rooms-saveNotification

Conversation

@Rohitgiri02
Copy link

@Rohitgiri02 Rohitgiri02 commented Feb 22, 2026

Proposed changes

This PR refactors the rooms.saveNotification endpoint to use the new API.v1.post format, replacing the deprecated addRoute method. AJV schema validation has been added for both the request body and response, improving input validation and aligning with Rocket.Chat API development guidelines.

Details of Changes

  • Migrated rooms.saveNotification to the new API format.
  • Added AJV schema validation for request body (roomId, notifications) and response (success).
  • Improved input validation and response structure.
  • Removed deprecated addRoute usage for this endpoint.

Testing

  • Verified the endpoint with existing end-to-end tests in apps/meteor/tests/end-to-end/api/rooms.ts.
  • All tests pass and the endpoint behaves as expected.
  • Manual testing:
    • Send a POST request to /api/v1/rooms.saveNotification with a valid roomId and notifications object.
    • Confirm a 200 response with { success: true }.
Screenshot 2026-02-22 160623

Impact

  • Aligns with the deprecation of addRoute.
  • Ensures automatic OpenAPI specification generation.
  • Maintains backward compatibility for clients using this endpoint.

Further Comments

This refactor improves maintainability and clarity of the API codebase. No breaking changes are introduced. All dependent tests and documentation have been reviewed.

Checklist

  • I have read the Contributing Guide.
  • I have signed the CLA.
  • Lint and unit tests pass locally.
  • I have added tests that prove my fix is effective.
  • I have added necessary documentation.
  • Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • Breaking Changes

    • The public rooms.saveNotification API endpoint has been removed. Integrations using it must be updated to the new API surface.
  • Chore

    • Server-side handling for saving per-room notification settings was reorganized; notification settings continue to be persisted as before.

@Rohitgiri02 Rohitgiri02 requested review from a team as code owners February 22, 2026 10:57
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Feb 22, 2026

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

@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2026

⚠️ No Changeset found

Latest commit: 2855152

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

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

Replaced the inline rooms.saveNotification route with an exported roomsSaveNotificationEndpoint using API.v1.post. Added local request/response schemas; handler validates { roomId, notifications }, calls saveNotificationSettingsMethod, and returns { success: true }. Typings entry for the endpoint was removed.

Changes

Cohort / File(s) Summary
Server endpoint implementation
apps/meteor/app/api/server/v1/rooms.ts
Replaced inline API.v1.addRoute POST handler with exported roomsSaveNotificationEndpoint via API.v1.post. Added local saveNotificationBodySchema and saveNotificationResponseSchema, mapped standard 400/401 errors, validated roomId and notifications, and invoked saveNotificationSettingsMethod to persist settings.
REST typings
packages/rest-typings/src/v1/rooms.ts
Removed the POST '/v1/rooms.saveNotification' entry from RoomsEndpoints type definitions (public typings no longer include this endpoint).

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant API as API.v1 Endpoint
  participant Method as saveNotificationSettingsMethod
  participant DB as Database

  Client->>API: POST /v1/rooms.saveNotification\n{ roomId, notifications }
  API->>API: validate body against saveNotificationBodySchema
  API->>Method: call with { roomId, notifications }
  Method->>DB: persist notification settings
  DB-->>Method: ack
  Method-->>API: result/ack
  API-->>Client: 200 { success: true }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through endpoints, neat and bright,
Schemas snug beneath moonlight,
Notifications tucked in a row,
Saved with a flourish, soft and slow,
I twitch my nose — the routes all right.

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main change: migrating the rooms.saveNotification endpoint to the new API format, which is the core objective of this refactoring pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
apps/meteor/app/api/server/v1/rooms.ts (1)

288-303: Notification schema is looser than the Notifications type it guards.

The notifications property allows any keys with any value types (additionalProperties: true, no value-type constraint), yet at line 329 it's cast to Notifications whose fields are all optional strings with well-known keys. This means the AJV validation won't reject payloads with invalid keys or non-string values — they'll only fail deeper inside saveNotificationSettingsMethod.

Consider aligning the schema with the actual Notifications type from @rocket.chat/rest-typings:

Suggested tighter schema
 const saveNotificationBodySchema = ajv.compile<{
     roomId: string;
-    notifications: Record<string, unknown>;
+    notifications: Notifications;
 }>({
     type: 'object',
     properties: {
-        roomId: { type: 'string' },
+        roomId: { type: 'string', minLength: 1 },
         notifications: {
             type: 'object',
-            minProperties: 1,
-            additionalProperties: true,
+            properties: {
+                disableNotifications: { type: 'string' },
+                muteGroupMentions: { type: 'string' },
+                hideUnreadStatus: { type: 'string' },
+                desktopNotifications: { type: 'string' },
+                audioNotificationValue: { type: 'string' },
+                mobilePushNotifications: { type: 'string' },
+                emailNotifications: { type: 'string' },
+            },
+            additionalProperties: false,
         },
     },
     required: ['roomId', 'notifications'],
     additionalProperties: false,
 });

This would catch invalid payloads at the validation layer and remove the need for the as Notifications type assertion on line 329.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/app/api/server/v1/rooms.ts` around lines 288 - 303, The AJV
schema saveNotificationBodySchema currently allows any keys/values for
notifications, but saveNotificationSettingsMethod casts the result to
Notifications and expects specific optional string fields; tighten the schema to
match the Notifications type from `@rocket.chat/rest-typings` by replacing
notifications: { type: 'object', minProperties: 1, additionalProperties: true }
with an explicit object schema listing the known notification keys (from
Notifications) as optional properties of type 'string' and setting
additionalProperties: false (or use patternProperties if Notifications has
dynamic keys), update the schema compile usage accordingly, and remove the
unsafe `as Notifications` assertion in saveNotificationSettingsMethod so the
runtime validation guarantees the correct shape.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3145c41 and be976b9.

📒 Files selected for processing (2)
  • apps/meteor/app/api/server/v1/rooms.ts
  • packages/rest-typings/src/v1/rooms.ts
💤 Files with no reviewable changes (1)
  • packages/rest-typings/src/v1/rooms.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/app/api/server/v1/rooms.ts
🧠 Learnings (3)
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
🧬 Code graph analysis (1)
apps/meteor/app/api/server/v1/rooms.ts (1)
packages/rest-typings/src/v1/rooms.ts (1)
  • Notifications (477-485)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer
🔇 Additional comments (1)
apps/meteor/app/api/server/v1/rooms.ts (1)

325-335: LGTM on the handler logic.

The Promise.all approach for concurrent saves is appropriate, and the all-or-nothing error semantics are reasonable. The implementation is clean and concise.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/meteor/app/api/server/v1/rooms.ts`:
- Around line 314-336: The API.v1.post(...) call for the
'rooms.saveNotification' endpoint is currently not assigned to a variable so it
isn't picked up by the RoomEndpoints type; change the call to be assigned to a
const (e.g., const saveNotification = API.v1.post(...)) using the existing
function/action block, then add that identifier (saveNotification) to the
RoomEndpoints union/type alongside the other endpoint bindings so the endpoint
is included in the generated/declared Endpoints interface; reference the
API.v1.post invocation for 'rooms.saveNotification' and the RoomEndpoints type
to locate where to add the identifier.

---

Nitpick comments:
In `@apps/meteor/app/api/server/v1/rooms.ts`:
- Around line 288-303: The AJV schema saveNotificationBodySchema currently
allows any keys/values for notifications, but saveNotificationSettingsMethod
casts the result to Notifications and expects specific optional string fields;
tighten the schema to match the Notifications type from
`@rocket.chat/rest-typings` by replacing notifications: { type: 'object',
minProperties: 1, additionalProperties: true } with an explicit object schema
listing the known notification keys (from Notifications) as optional properties
of type 'string' and setting additionalProperties: false (or use
patternProperties if Notifications has dynamic keys), update the schema compile
usage accordingly, and remove the unsafe `as Notifications` assertion in
saveNotificationSettingsMethod so the runtime validation guarantees the correct
shape.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be976b9 and 4b1f286.

📒 Files selected for processing (1)
  • apps/meteor/app/api/server/v1/rooms.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/app/api/server/v1/rooms.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: UserBridge.doGetUserRoomIds in packages/apps-engine/src/server/bridges/UserBridge.ts has a bug where it implicitly returns undefined when the app lacks read permission (missing return statement in the else case of the permission check).

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
🧬 Code graph analysis (1)
apps/meteor/app/api/server/v1/rooms.ts (1)
packages/rest-typings/src/v1/rooms.ts (1)
  • Notifications (477-485)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/meteor/app/api/server/v1/rooms.ts`:
- Around line 288-303: The notifications schema is accepting arbitrary value
types (additionalProperties: true) making the runtime shape incompatible with
the Notifications type and the cast unsafe; update the ajv.compile generic from
Record<string, unknown> to Record<string, string | undefined> and change the
schema's notifications.additionalProperties to enforce strings (e.g.
additionalProperties: { type: 'string' }) so AJV validates value types, then
remove or narrow the unsafe "as Notifications" cast where notifications is
passed to saveNotificationSettingsMethod (refer to saveNotificationBodySchema,
Notifications, and saveNotificationSettingsMethod).

---

Duplicate comments:
In `@apps/meteor/app/api/server/v1/rooms.ts`:
- Line 314: RoomEndpoints is missing the rooms.saveNotification entry so the new
roomsSaveNotificationEndpoint is not exposed to the type system; add a
corresponding entry for "rooms.saveNotification" into the RoomEndpoints
interface (the endpoints map defined as RoomEndpoints) and restore/update the
matching declaration in packages/rest-typings/src/v1/rooms.ts so the exported
Endpoints include rooms.saveNotification and its correct request/response types,
ensuring the runtime handler roomsSaveNotificationEndpoint matches that key.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b1f286 and 0ca2bc2.

📒 Files selected for processing (1)
  • apps/meteor/app/api/server/v1/rooms.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/app/api/server/v1/rooms.ts
🧠 Learnings (6)
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: UserBridge.doGetUserRoomIds in packages/apps-engine/src/server/bridges/UserBridge.ts has a bug where it implicitly returns undefined when the app lacks read permission (missing return statement in the else case of the permission check).

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-11-17T14:30:36.271Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 37491
File: packages/desktop-api/src/index.ts:17-27
Timestamp: 2025-11-17T14:30:36.271Z
Learning: In the Rocket.Chat desktop API (`packages/desktop-api/src/index.ts`), the `CustomNotificationOptions` type has an optional `id` field by design. Custom notifications dispatched without an ID cannot be closed programmatically using `closeCustomNotification`, and this is intentional.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
🧬 Code graph analysis (1)
apps/meteor/app/api/server/v1/rooms.ts (1)
packages/rest-typings/src/v1/rooms.ts (1)
  • Notifications (477-485)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@apps/meteor/app/api/server/v1/rooms.ts`:
- Line 314: The new exported endpoint roomsSaveNotificationEndpoint was not
added to the RoomEndpoints union type; update the RoomEndpoints type union to
include the corresponding endpoint (e.g. add the 'rooms.saveNotification' entry
or the appropriate type literal for roomsSaveNotificationEndpoint) so the
endpoint is present in the Endpoints interface and type-safe API calls work
again; locate the RoomEndpoints union (the type that previously listed room
endpoints) and append the rooms.saveNotification member with the correct
request/response shape to match roomsSaveNotificationEndpoint.
- Around line 295-299: Add the missing roomsSaveNotificationEndpoint to the
RoomEndpoints union by appending & ExtractRoutesFromAPI<typeof
roomsSaveNotificationEndpoint> to the existing RoomEndpoints type so SDK
consumers get the endpoint types; next, tighten the notifications schema used by
saveNotificationSettingsMethod by explicitly listing allowed notification keys
(matching the optional keys on the Notifications type) instead of using
additionalProperties: { type: 'string' } so validation and typing align and
remove the unsafe cast of notifications as Notifications; update references in
saveNotificationSettingsMethod and anywhere notifications is cast so the runtime
schema and TypeScript Notifications type are consistent.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
apps/meteor/app/api/server/v1/rooms.ts (1)

314-336: ⚠️ Potential issue | 🟠 Major

roomsSaveNotificationEndpoint is missing from RoomEndpoints — endpoint absent from the Endpoints interface.

roomsSaveNotificationEndpoint is exported but never added to the RoomEndpoints type union at Line 1217. Because the REST-typings entry in packages/rest-typings/src/v1/rooms.ts was also removed, /v1/rooms.saveNotification is now completely absent from Endpoints. This breaks compile-time type-checking for all SDK and client-side callers.

The simplest fix is to assign the result and union it into RoomEndpoints:

🔒 Proposed fix
-type RoomEndpoints = ExtractRoutesFromAPI<typeof roomEndpoints>;
+type RoomEndpoints = ExtractRoutesFromAPI<typeof roomEndpoints> & ExtractRoutesFromAPI<typeof roomsSaveNotificationEndpoint>;

Also applies to: 1217-1221

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/app/api/server/v1/rooms.ts` around lines 314 - 336,
roomsSaveNotificationEndpoint is exported but not included in the RoomEndpoints
union, so the /v1/rooms.saveNotification endpoint is missing from the Endpoints
types; fix by assigning the handler export to a const (e.g., const
roomsSaveNotificationEndpoint = API.v1.post(...)) and then add that symbol to
the RoomEndpoints union type (include roomsSaveNotificationEndpoint in the union
where RoomEndpoints is defined) so the endpoint appears in the REST typings and
TypeScript type-checking for SDK/client callers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@apps/meteor/app/api/server/v1/rooms.ts`:
- Around line 314-336: roomsSaveNotificationEndpoint is exported but not
included in the RoomEndpoints union, so the /v1/rooms.saveNotification endpoint
is missing from the Endpoints types; fix by assigning the handler export to a
const (e.g., const roomsSaveNotificationEndpoint = API.v1.post(...)) and then
add that symbol to the RoomEndpoints union type (include
roomsSaveNotificationEndpoint in the union where RoomEndpoints is defined) so
the endpoint appears in the REST typings and TypeScript type-checking for
SDK/client callers.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ca2bc2 and a4a25f7.

📒 Files selected for processing (2)
  • apps/meteor/app/api/server/v1/rooms.ts
  • packages/rest-typings/src/v1/rooms.ts
💤 Files with no reviewable changes (1)
  • packages/rest-typings/src/v1/rooms.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/app/api/server/v1/rooms.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:01.522Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:06.802Z
Learning: In Rocket.Chat PR reviews, maintain strict scope boundaries—when a PR is focused on a specific endpoint (e.g., rooms.favorite), avoid reviewing or suggesting changes to other endpoints that were incidentally refactored (e.g., rooms.invite) unless explicitly requested by maintainers.
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2026-02-24T19:09:01.522Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:01.522Z
Learning: In Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1, avoid introducing logic changes. Only perform scope-tight changes that preserve behavior; style-only cleanups (e.g., removing inline comments) may be deferred to follow-ups to keep the migration PR focused.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2026-02-23T17:53:06.802Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:06.802Z
Learning: During PR reviews that touch endpoint files under apps/meteor/app/api/server/v1, enforce strict scope: if a PR targets a specific endpoint (e.g., rooms.favorite), do not propose changes to unrelated endpoints (e.g., rooms.invite) unless maintainers explicitly request them. Focus feedback on the touched endpoint's behavior, API surface, and related tests; avoid broad cross-endpoint changes in the same PR unless requested.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: UserBridge.doGetUserRoomIds in packages/apps-engine/src/server/bridges/UserBridge.ts has a bug where it implicitly returns undefined when the app lacks read permission (missing return statement in the else case of the permission check).

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2026-02-24T19:36:47.551Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:47.551Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
📚 Learning: 2025-11-17T14:30:36.271Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 37491
File: packages/desktop-api/src/index.ts:17-27
Timestamp: 2025-11-17T14:30:36.271Z
Learning: In the Rocket.Chat desktop API (`packages/desktop-api/src/index.ts`), the `CustomNotificationOptions` type has an optional `id` field by design. Custom notifications dispatched without an ID cannot be closed programmatically using `closeCustomNotification`, and this is intentional.

Applied to files:

  • apps/meteor/app/api/server/v1/rooms.ts
🧬 Code graph analysis (1)
apps/meteor/app/api/server/v1/rooms.ts (1)
packages/rest-typings/src/v1/rooms.ts (1)
  • Notifications (476-484)

@ggazzo ggazzo added this to the 8.3.0 milestone Feb 25, 2026
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Feb 25, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Feb 25, 2026
ggazzo
ggazzo previously approved these changes Feb 25, 2026
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.67%. Comparing base (813d57a) to head (2855152).
⚠️ Report is 6 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #38893   +/-   ##
========================================
  Coverage    70.67%   70.67%           
========================================
  Files         3190     3190           
  Lines       112740   112732    -8     
  Branches     20389    20401   +12     
========================================
- Hits         79678    79673    -5     
+ Misses       31014    31010    -4     
- Partials      2048     2049    +1     
Flag Coverage Δ
unit 71.25% <ø> (+<0.01%) ⬆️

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.

auto-merge was automatically disabled February 25, 2026 15:51

Head branch was pushed to by a user without write access

@dionisio-bot dionisio-bot bot enabled auto-merge February 25, 2026 15:51
@ggazzo ggazzo changed the title refactor: migrate rooms.saveNotification endpoint to new API format w… chore: migrate rooms.saveNotification endpoint to new API format w… Feb 25, 2026
@ggazzo
Copy link
Member

ggazzo commented Feb 25, 2026

please run lint and ts tests on your machine before pushing.

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

Labels

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: chore

Projects

Development

Successfully merging this pull request may close these issues.

2 participants