Skip to content

fix: Forwarding messages to channels with join code#39541

Merged
dionisio-bot[bot] merged 9 commits intodevelopfrom
fix/joincode
Mar 13, 2026
Merged

fix: Forwarding messages to channels with join code#39541
dionisio-bot[bot] merged 9 commits intodevelopfrom
fix/joincode

Conversation

@KevLehman
Copy link
Copy Markdown
Member

@KevLehman KevLehman commented Mar 11, 2026

Proposed changes (including videos or screenshots)

Issue(s)

https://rocketchat.atlassian.net/browse/SUP-1000

Steps to test or reproduce

Further comments

Basically, everytime we used chat.postMessage to forward, the server was trying to re-join the user into the channel. And since the join required a code, it throwed an error...

Summary by CodeRabbit

  • Bug Fixes

    • Prevented unnecessary re-join attempts for channel members and preserved prior behavior for non-channel rooms.
    • Fixed message forwarding into password-protected rooms so forwarded messages correctly target protected channels.
  • Tests

    • Added unit tests covering room resolution, type filtering, DM handling, and join-guard behavior.
    • Added end-to-end tests validating forwarding into password-protected rooms and cleanup.
  • Chores

    • Added a changeset recording a patch release for the fix.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 11, 2026

🦋 Changeset detected

Latest commit: 12fa362

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

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch 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
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a116df35-9192-472b-acf6-10b7414311b6

📥 Commits

Reviewing files that changed from the base of the PR and between 4ba301e and 12fa362.

📒 Files selected for processing (1)
  • .changeset/new-students-attack.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/new-students-attack.md
📜 Recent review details
⏰ 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: CodeQL-Build

Walkthrough

Adds a Subscriptions lookup and guard in getRoomByNameOrIdWithOptionToJoin to avoid calling RoomService.join for channel rooms when the user already has a subscription. Adds unit tests for resolution/join scenarios and e2e tests verifying forwarding into a password-protected channel.

Changes

Cohort / File(s) Summary
Core Logic Update
apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
Import Subscriptions and add a guard that calls RoomService.join only when room.t === 'c', joinChannel === true, and no subscription exists (checked via Subscriptions.findOneByRoomIdAndUserId(room._id, user._id, { projection: { _id: 1 } })). Preserve prior behavior for non-channel rooms and existing error paths.
Unit Tests
apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
Add extensive TypeScript unit tests (Mocha/Chai/Sinon/proxyquire) covering id/name resolution, type filtering, DM resolution/creation, and the subscription-guarded join behavior with mocks/stubs for Rooms, Subscriptions, Users, RoomService, Meteor errors, and createDirectMessage.
End-to-End Tests
apps/meteor/tests/end-to-end/api/chat.ts
Add e2e scenarios that create a password-protected channel (set joinCode), verify forwarding into that protected channel using roomId arrays, assert forwarded messages land in the protected room, and ensure test cleanup removes created channels.
Changeset
.changeset/new-students-attack.md
Add a changeset noting a patch release for @rocket.chat/meteor describing the fix for forwarding messages to password-protected channels.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Func as getRoomByNameOrIdWithOptionToJoin
    participant Rooms
    participant Subs as Subscriptions
    participant RoomSvc as RoomService

    Client->>Func: request room by id/name (+ joinChannel?)
    Func->>Rooms: find room by id or name
    Func->>Subs: findOneByRoomIdAndUserId(room._id, user._id, { projection: { _id: 1 } })
    alt room.t == 'c' and joinChannel == true and no subscription
      rect rgba(0,128,0,0.5)
        Func->>RoomSvc: join(room, user)
      end
    else otherwise
      note right of Func: skip join (non-channel, joinChannel=false, or already subscribed)
    end
    Func->>Client: return resolved room / error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 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 PR title clearly and concisely describes the main fix: preventing re-join attempts when forwarding messages to channels with join codes.
Linked Issues check ✅ Passed The code changes successfully address the linked issue SUP-1000 by adding a guard to prevent re-joining already-subscribed users when forwarding to join-code-protected channels.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the join-code forwarding issue: the guard logic in getRoomByNameOrIdWithOptionToJoin, comprehensive unit tests, and end-to-end tests validating protected-room forwarding.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

📝 Coding Plan
  • Generate coding plan for human review comments

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.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 11, 2026

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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.95%. Comparing base (b29fb86) to head (12fa362).
⚠️ Report is 17 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39541      +/-   ##
===========================================
- Coverage    70.97%   70.95%   -0.03%     
===========================================
  Files         3197     3200       +3     
  Lines       113347   113502     +155     
  Branches     20571    20578       +7     
===========================================
+ Hits         80450    80537      +87     
- Misses       30843    30912      +69     
+ Partials      2054     2053       -1     
Flag Coverage Δ
e2e 60.44% <ø> (-0.06%) ⬇️
e2e-api 48.17% <ø> (-0.11%) ⬇️
unit 71.65% <100.00%> (-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.

@KevLehman KevLehman marked this pull request as ready for review March 11, 2026 19:18
@KevLehman KevLehman requested a review from a team as a code owner March 11, 2026 19:18
Copy link
Copy Markdown
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.

2 issues found across 3 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/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts">

<violation number="1" location="apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts:91">
P2: Avoid querying `Subscriptions` unless channel auto-join is actually needed; this currently adds an unnecessary DB read on every call.</violation>
</file>

<file name="apps/meteor/tests/end-to-end/api/chat.ts">

<violation number="1" location="apps/meteor/tests/end-to-end/api/chat.ts:626">
P2: The forwarded message link is malformed and hardcoded to localhost, which can make this regression test miss the forwarding code path and fail in non-local test environments.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown
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: 2

🧹 Nitpick comments (1)
apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts (1)

90-92: Defer the subscription lookup until the channel-join branch.

The new comment just repeats the condition, and the findOneByRoomIdAndUserId call now runs even when joinChannel is false or the room is not a channel.

♻️ Suggested cleanup
-	// If the user is already in the channel, this will do nothing.
-	const sub = await Subscriptions.findOneByRoomIdAndUserId(room._id, user._id);
-	if (room.t === 'c' && joinChannel && !sub) {
-		await Room.join({ room, user });
-	}
+	if (room.t === 'c' && joinChannel) {
+		const sub = await Subscriptions.findOneByRoomIdAndUserId(room._id, user._id);
+		if (!sub) {
+			await Room.join({ room, user });
+		}
+	}

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

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

In `@apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts`
around lines 90 - 92, The subscription lookup
Subscriptions.findOneByRoomIdAndUserId is executed unconditionally but only used
when room.t === 'c' and joinChannel is true; move the call into the channel-join
branch (the if that checks room.t === 'c' && joinChannel) so sub is only fetched
when needed, remove the now-redundant comment, and ensure the variable name sub
is declared/awaited inside that branch in the getRoomByNameOrIdWithOptionToJoin
function.
🤖 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/tests/end-to-end/api/chat.ts`:
- Around line 621-632: The test currently posts a malformed hardcoded link and
only asserts the destination room, so update the request to build the forward
URL from the configured site URL (use the app's site config variable such as
process.env.SITE_URL or the app settings value) and include the missing closing
“)”; then assert that a real forward was created by checking a forward-specific
artifact on forwardResponse (for example assert the returned message object
includes the parsed/forwarded payload referencing originalMessageId or an
attachments/forward flag rather than just message.rid). Locate the call that
performs api('chat.postMessage') and the response variable forwardResponse, fix
the link construction using protectedChannel.name and originalMessageId, and
replace the weak assertion on message.rid with an assertion that the message
contains the parsed forward metadata (attachment/forward field or reference to
originalMessageId).

In
`@apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts`:
- Line 95: The proxyquire path passed to mock.noCallThru().load currently points
to '.../meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts'
which resolves to the wrong root; update the module path string used in the
mock.noCallThru().load call to include the missing 'apps/' segment so it points
to
'.../apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts'
(i.e., correct the relative path inside the load(...) invocation so the test
loads the real module under apps/meteor/app).

---

Nitpick comments:
In `@apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts`:
- Around line 90-92: The subscription lookup
Subscriptions.findOneByRoomIdAndUserId is executed unconditionally but only used
when room.t === 'c' and joinChannel is true; move the call into the channel-join
branch (the if that checks room.t === 'c' && joinChannel) so sub is only fetched
when needed, remove the now-redundant comment, and ensure the variable name sub
is declared/awaited inside that branch in the getRoomByNameOrIdWithOptionToJoin
function.
🪄 Autofix (Beta)

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

Run ID: 10a0e665-5b6e-44f4-be37-4c32ad476242

📥 Commits

Reviewing files that changed from the base of the PR and between b29fb86 and c33f79f.

📒 Files selected for processing (3)
  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/end-to-end/api/chat.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
📜 Review details
⏰ 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 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/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
  • apps/meteor/tests/end-to-end/api/chat.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/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
🧠 Learnings (23)
📚 Learning: 2026-03-09T18:39:21.178Z
Learnt from: Harxhit
Repo: RocketChat/Rocket.Chat PR: 39476
File: apps/meteor/server/methods/addAllUserToRoom.ts:0-0
Timestamp: 2026-03-09T18:39:21.178Z
Learning: In apps/meteor/server/methods/addAllUserToRoom.ts, the implementation uses a single cursor pass (Users.find(userFilter).batchSize(100)) that collects both the full user objects (collectedUsers: IUser[]) and their usernames (usernames: string[]) in one iteration. `beforeAddUserToRoom` is then called once with the full usernames batch (preserving batch-validation semantics), and the subsequent subscription/message processing loop iterates over the same stable `collectedUsers` array — no second DB query is made. This avoids any race condition between validation and processing while preserving the original batch-validation behavior.

Applied to files:

  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.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: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings by mapping subscription documents to room IDs, never undefined, even when user has no room subscriptions.

Applied to files:

  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.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/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
  • apps/meteor/tests/end-to-end/api/chat.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: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings (mapping subscription documents to room IDs), never undefined, even when user has no room subscriptions.

Applied to files:

  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.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/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/end-to-end/api/chat.ts
📚 Learning: 2025-12-09T20:01:07.355Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 37532
File: ee/packages/federation-matrix/src/FederationMatrix.ts:920-927
Timestamp: 2025-12-09T20:01:07.355Z
Learning: In Rocket.Chat's federation invite handling (ee/packages/federation-matrix/src/FederationMatrix.ts), when a user rejects an invite via federationSDK.rejectInvite(), the subscription cleanup happens automatically through an event-driven flow: Matrix emits a leave event back, which is processed by handleLeave() in ee/packages/federation-matrix/src/events/member.ts, and that function calls Room.performUserRemoval() to clean up the subscription. No explicit cleanup is needed in the reject branch of handleInvite() because the leave event handler takes care of it.
<!-- </add_learning>

Applied to files:

  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.

Applied to files:

  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.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/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
📚 Learning: 2026-03-10T08:13:52.153Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39414
File: apps/meteor/app/api/server/v1/rooms.ts:1241-1297
Timestamp: 2026-03-10T08:13:52.153Z
Learning: In the RocketChat/Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1/rooms.ts, the pattern `ajv.compile<void>({...})` is intentionally used for the 200 response schema even when the endpoint returns `{ success: true }`. This is an established convention across all migrated endpoints (rooms.leave, rooms.favorite, rooms.delete, rooms.muteUser, rooms.unmuteUser). Do not flag this as a type mismatch during reviews of these migration PRs.

Applied to files:

  • apps/meteor/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.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/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
  • apps/meteor/tests/end-to-end/api/chat.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/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
  • apps/meteor/tests/end-to-end/api/chat.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
  • apps/meteor/tests/end-to-end/api/chat.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/unit/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.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/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.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/app/lib/server/functions/getRoomByNameOrIdWithOptionToJoin.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/end-to-end/api/chat.ts
📚 Learning: 2026-02-24T19:36:55.089Z
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:55.089Z
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/tests/end-to-end/api/chat.ts
📚 Learning: 2025-09-16T13:33:49.237Z
Learnt from: cardoso
Repo: RocketChat/Rocket.Chat PR: 36890
File: apps/meteor/tests/e2e/e2e-encryption/e2ee-otr.spec.ts:21-26
Timestamp: 2025-09-16T13:33:49.237Z
Learning: In Rocket.Chat test files, the im.delete API endpoint accepts either a `roomId` parameter (requiring the actual DM room _id) or a `username` parameter (for the DM partner's username). It does not accept slug-like constructions such as concatenating usernames together.

Applied to files:

  • apps/meteor/tests/end-to-end/api/chat.ts
📚 Learning: 2026-02-24T19:16:35.307Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 39003
File: apps/meteor/client/lib/chats/flows/sendMessage.ts:39-45
Timestamp: 2026-02-24T19:16:35.307Z
Learning: In apps/meteor/client/lib/chats/flows/sendMessage.ts, when sdk.call('sendMessage', ...) throws an error, the message is intentionally left with temp: true (not deleted or cleaned up) to support a future retry UI feature. This allows users to retry sending failed messages rather than losing them.

Applied to files:

  • apps/meteor/tests/end-to-end/api/chat.ts
🪛 Biome (2.4.6)
apps/meteor/tests/end-to-end/api/chat.ts

[error] 35-51: Duplicate before hook found.

(lint/suspicious/noDuplicateTestHooks)

@KevLehman KevLehman added this to the 8.3.0 milestone Mar 12, 2026
@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Mar 12, 2026
@dionisio-bot dionisio-bot bot removed the stat: QA assured Means it has been tested and approved by a company insider label Mar 12, 2026
@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Mar 12, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Mar 12, 2026
@dionisio-bot dionisio-bot bot enabled auto-merge March 12, 2026 21:10
@dionisio-bot dionisio-bot bot added this pull request to the merge queue Mar 13, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 13, 2026
@KevLehman KevLehman modified the milestone: 8.3.0 Mar 13, 2026
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Mar 13, 2026
@KevLehman KevLehman added this to the 8.3.0 milestone Mar 13, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Mar 13, 2026
@dionisio-bot dionisio-bot bot added this pull request to the merge queue Mar 13, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 13, 2026
@KevLehman KevLehman removed this from the 8.3.0 milestone Mar 13, 2026
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Mar 13, 2026
@KevLehman KevLehman added this to the 8.3.0 milestone Mar 13, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Mar 13, 2026
@dionisio-bot dionisio-bot bot added this pull request to the merge queue Mar 13, 2026
Merged via the queue into develop with commit cfcff99 Mar 13, 2026
46 checks passed
@dionisio-bot dionisio-bot bot deleted the fix/joincode branch March 13, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-security-review 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.

2 participants