Skip to content

Conversation

@yash-rajpal
Copy link
Member

@yash-rajpal yash-rajpal commented Sep 3, 2025

Proposed changes (including videos or screenshots)

Currently room names having Cyrillic characters (e.g., тест) in channel name are not searchable.

Issue(s)

Steps to test or reproduce

  • Create a new channel with a name containing only Cyrillic characters (e.g., тест) or a mix of Latin and Cyrillic characters (e.g., test тест).
  • From any channel, click the "More" (three dots) menu and select "Discussion."
  • In the "Create discussion" modal that appears, click into the "Parent channel or team" search box.
  • Attempt to search for the channel created in step 1 using its Cyrillic name (тест).

Before

image

After

image

Further comments

SUP-819

Summary by CodeRabbit

  • New Features

    • Room search now supports Cyrillic characters in channel names (e.g., “тест”), improving discoverability in autocomplete and search.
  • Tests

    • Added end-to-end tests verifying autocomplete and search behavior for channels with Cyrillic names, including validation of required parameters and expected results.
  • Chores

    • Patched dependencies to enable the improved search behavior.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 3, 2025

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 Sep 3, 2025

🦋 Changeset detected

Latest commit: 0922022

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

This PR includes changesets to release 39 packages
Name Type
@rocket.chat/models Patch
@rocket.chat/meteor Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core 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/stream-hub-service Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker 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/ddp-client Patch
@rocket.chat/freeswitch 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/web-ui-registration Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip 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

@yash-rajpal yash-rajpal marked this pull request as ready for review September 3, 2025 17:45
@yash-rajpal yash-rajpal requested review from a team as code owners September 3, 2025 17:45
@yash-rajpal yash-rajpal added this to the 7.11.0 milestone Sep 3, 2025
@yash-rajpal yash-rajpal added the stat: QA assured Means it has been tested and approved by a company insider label Sep 3, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 3, 2025
@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.24%. Comparing base (6876409) to head (0922022).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #36861      +/-   ##
===========================================
- Coverage    66.26%   66.24%   -0.03%     
===========================================
  Files         3339     3340       +1     
  Lines       113726   113726              
  Branches     21170    21140      -30     
===========================================
- Hits         75365    75342      -23     
- Misses       35673    35698      +25     
+ Partials      2688     2686       -2     
Flag Coverage Δ
e2e 57.71% <ø> (+<0.01%) ⬆️
unit 70.97% <ø> (-0.04%) ⬇️

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.

Copy link
Member

@abhinavkrin abhinavkrin left a comment

Choose a reason for hiding this comment

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

Screenshot 2025-09-05 at 1 38 48 PM I am not able to create a channel with Cyrillic characters

@debdutdeb
Copy link
Member

@abhinavkrin I think there's a setting that needs to be toggled

Copy link
Contributor

@ricardogarim ricardogarim left a comment

Choose a reason for hiding this comment

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

hey @yash-rajpal, noticed during testing that if a room name starts with cyrillic characters (e.g. тест) it shows up fine in search. but if the name mixes character types (e.g. test тест), searching just for тест doesn’t return it. might be related to the regex being used in search.

@yash-rajpal
Copy link
Member Author

yash-rajpal commented Sep 5, 2025

@ricardogarim

just curious, what’s the reasoning behind skipping archived and federated rooms?

These conditions for skipping archived and federated channels were already there, I just merged the previous $and condition with my code for matching name and fname.

For the search only working if initials of room name matching, check the regex here.
This has been the behavior since ever. If today a room exists with a name "test hello", it is only searchable if user searches using "test", it won't come up if user searches using "hello". My PR just keeps up with this unusual behavior.

@tassoevan
Copy link
Contributor

This has been the behavior since ever. If today a room exists with a name "test hello", it is only searchable if user searches using "test", it won't come up if user searches using "hello".

I'm almost sure it was a "perf thing".

@yash-rajpal yash-rajpal dismissed ricardogarim’s stale review September 10, 2025 06:29

Addressed the review.

@yash-rajpal yash-rajpal removed the stat: ready to merge PR tested and approved waiting for merge label Sep 10, 2025
@yash-rajpal yash-rajpal removed the request for review from ricardogarim September 10, 2025 06:31
@yash-rajpal yash-rajpal added the stat: ready to merge PR tested and approved waiting for merge label Sep 10, 2025
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Sep 10, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

Walkthrough

Adds a changeset bumping @rocket.chat/models and @rocket.chat/meteor to patch versions. Modifies Rooms query to match name or fname with a regex while excluding federated/archived rooms. Introduces end-to-end API tests validating Cyrillic channel-name autocomplete; includes setup/teardown and duplicated test blocks.

Changes

Cohort / File(s) Summary
Dependency bump (changeset)
.changeset/angry-apes-double.md
Adds patch version bumps for @rocket.chat/models and @rocket.chat/meteor; notes Cyrillic room search enablement via dependency updates.
E2E tests for Cyrillic autocomplete
apps/meteor/tests/end-to-end/api/rooms.ts
Adds tests for rooms.autocomplete.channelAndPrivate to handle Cyrillic names; includes env toggles, channel creation/deletion; validates missing selector error and successful match; scenario duplicated in two describe blocks.
Rooms query update
packages/models/src/models/Rooms.ts
Updates findRoomsWithoutDiscussionsByRoomIds to match name OR fname via nameRegex and consolidate federated !== true and archived !== true in the same $and; other filters unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant API as rooms.autocomplete.channelAndPrivate
  participant Service as Rooms Service
  participant DB as Rooms Collection

  Client->>API: GET autocomplete (selector with query text)
  API->>Service: request rooms by query
  Service->>DB: findRoomsWithoutDiscussionsByRoomIds({<br/> ids/t filters,<br/> t in [c,p],<br/> $and: [ { $or: [name~regex, fname~regex] }, {federated: {$ne: true}}, {archived: {$ne: true}} ],<br/> team/prid conditions })
  DB-->>Service: matching rooms
  Service-->>API: rooms list
  API-->>Client: response (supports Cyrillic matches)
  note over API,Service: New behavior: regex applies to both name and fname
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately describes the primary feature introduced by the changeset—enabling search for rooms with Cyrillic characters in their names—without extraneous details or noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I twitch my whiskers, type with glee,
“тест” now hops through search for me! 🐇
Names or fnames, both in view,
Queries sift the tried-and-true.
With patches patched and tests that sing,
Cyrillic rooms now do their thing.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/room-autocomplete-cyrillic-name

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

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/models/src/models/Rooms.ts (1)

333-358: Ensure parity: paginated variant should also match fname and exclude archived/federated

findPaginatedRoomsWithoutDiscussionsByRoomIds still filters by name only and doesn’t exclude archived. This can make /rooms.autocomplete.channelAndPrivate.withPagination behave differently from the non-paginated endpoint for Cyrillic names and archived rooms.

Suggested refactor:

-		const nameRegex = new RegExp(`^${escapeRegExp(name).trim()}`, 'i');
+		const nameRegex = new RegExp(`^${escapeRegExp(name).trim()}`, 'i');

 		const query: Filter<IRoom> = {
 			_id: {
 				$in: roomIds,
 			},
 			t: {
 				$in: ['c', 'p'],
 			},
-			name: nameRegex,
+			$and: [
+				{ $or: [{ name: nameRegex }, { fname: nameRegex }] },
+				{ federated: { $ne: true } },
+				{ archived: { $ne: true } },
+			],
 			$or: [
 				{
 					teamId: {
 						$exists: false,
 					},
 				},
 				{
 					teamId: {
 						$exists: true,
 					},
 					_id: {
 						$in: roomIds,
 					},
 				},
 			],
 			prid: { $exists: false },
-			$and: [{ $or: [{ federated: { $exists: false } }, { federated: false }] }],
 		};
♻️ Duplicate comments (1)
apps/meteor/tests/end-to-end/api/rooms.ts (1)

2161-2175: Add negative cases: archived and federated rooms should not appear

Past feedback asked for this—adding assertions will protect against regressions.

Example additions (archive case; adjust API as needed for federated mark):

 it('should return the rooms with cyrillic characters in channel name', (done) => {
   …
 });
+
+it('should not return archived rooms', async () => {
+  await request.post(api('channels.archive')).set(credentials).send({ roomId: testChannel._id }).expect(200);
+  await request
+    .get(api('rooms.autocomplete.channelAndPrivate'))
+    .query({ selector: '{ "name": "тест" }' })
+    .set(credentials)
+    .expect(200)
+    .expect((res) => {
+      expect(res.body.items).to.have.lengthOf(0);
+    });
+});

I can also draft a federated-room setup if there’s a supported API/path in this suite.

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

295-296: Optional: add Unicode flag to regex for robust case-insensitive matching

Using iu can improve correctness for non-Latin scripts’ case-folding. Low risk, but keep if consistent with the rest of the codebase.

-const nameRegex = new RegExp(`^${escapeRegExp(name).trim()}`, 'i');
+const nameRegex = new RegExp(`^${escapeRegExp(name).trim()}`, 'iu');
apps/meteor/tests/end-to-end/api/rooms.ts (2)

2130-2133: Restore original setting value to avoid suite cross-talk

Capture the prior value in before and restore it in after instead of hardcoding true.

-	before(async () => {
-		await updateSetting('UI_Allow_room_names_with_special_chars', true);
-		testChannel = (await createRoom({ type: 'c', name: 'тест' })).body.channel;
-	});
+	let originalSpecialCharsSetting: SettingValue;
+	before(async () => {
+		originalSpecialCharsSetting = await getSettingValueById('UI_Allow_room_names_with_special_chars');
+		await updateSetting('UI_Allow_room_names_with_special_chars', true);
+		testChannel = (await createRoom({ type: 'c', name: 'тест' })).body.channel;
+	});

-	after(async () => {
-		await updateSetting('UI_Allow_room_names_with_special_chars', true);
-		await deleteRoom({ type: 'c', roomId: testChannel._id });
-	});
+	after(async () => {
+		await updateSetting('UI_Allow_room_names_with_special_chars', Boolean(originalSpecialCharsSetting));
+		await deleteRoom({ type: 'c', roomId: testChannel._id });
+	});

2178-2224: Also verify Cyrillic search in the paginated endpoint

Once the model parity is in place, add the same Cyrillic assertion here to keep endpoints consistent.

 it('should return the rooms to fill auto complete', (done) => {
   …
 });
+
+it('should return rooms with cyrillic names (with pagination)', (done) => {
+  void request
+    .get(api('rooms.autocomplete.channelAndPrivate.withPagination'))
+    .query({ selector: '{ "name": "тест" }' })
+    .set(credentials)
+    .expect(200)
+    .expect((res) => {
+      expect(res.body).to.have.property('success', true);
+      expect(res.body).to.have.property('items').and.to.be.an('array');
+      expect(res.body.items.find((i: any) => i.fname === 'тест')).to.exist;
+    })
+    .end(done);
+});
.changeset/angry-apes-double.md (1)

6-6: Good, concise changeset

Optional: reference SUP-819 in the note to aid traceability.

-Enable room search by Cyrillic characters in channel names (e.g. "тест").
+Enable room search by Cyrillic characters in channel names (e.g., “тест”). Related: SUP-819.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6876409 and 0922022.

📒 Files selected for processing (3)
  • .changeset/angry-apes-double.md (1 hunks)
  • apps/meteor/tests/end-to-end/api/rooms.ts (2 hunks)
  • packages/models/src/models/Rooms.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/tests/end-to-end/api/rooms.ts (3)
apps/meteor/app/lib/server/functions/createRoom.ts (1)
  • createRoom (120-278)
apps/meteor/tests/e2e/utils/create-target-channel.ts (1)
  • deleteRoom (48-50)
apps/meteor/tests/data/api-data.ts (1)
  • credentials (39-42)
⏰ 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). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (2)
packages/models/src/models/Rooms.ts (1)

304-304: Cyrillic match + archived/federated filters look good

Matching on both name/fname with a start-anchored regex and excluding federated/archived rooms aligns with the intended behavior and keeps the “first token only” optimization.

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

2123-2133: Great targeted coverage for Cyrillic search

Enables the setting, creates a Cyrillic-named room, and exercises the endpoint—nice.

@yash-rajpal yash-rajpal added the stat: ready to merge PR tested and approved waiting for merge label Sep 10, 2025
@kodiakhq kodiakhq bot merged commit c102712 into develop Sep 10, 2025
52 checks passed
@kodiakhq kodiakhq bot deleted the fix/room-autocomplete-cyrillic-name branch September 10, 2025 07:50
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants