Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/angry-apes-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/models': patch
'@rocket.chat/meteor': patch
---

Enable room search by Cyrillic characters in channel names (e.g. "тест").
27 changes: 27 additions & 0 deletions apps/meteor/tests/end-to-end/api/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2120,6 +2120,18 @@ describe('[Rooms]', () => {
});

describe('[/rooms.autocomplete.channelAndPrivate]', () => {
let testChannel: IRoom;

before(async () => {
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 });
});

it('should return an error when the required parameter "selector" is not provided', (done) => {
void request
.get(api('rooms.autocomplete.channelAndPrivate'))
Expand All @@ -2146,6 +2158,21 @@ describe('[Rooms]', () => {
})
.end(done);
});
it('should return the rooms with cyrillic characters in channel name', (done) => {
void request
.get(api('rooms.autocomplete.channelAndPrivate'))
.query({ selector: '{ "name": "тест" }' })
.set(credentials)
.expect('Content-Type', 'application/json')
.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).to.have.lengthOf(1);
expect(res.body.items[0].fname).to.be.equal('тест');
})
.end(done);
});
});

describe('[/rooms.autocomplete.channelAndPrivate.withPagination]', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/models/src/models/Rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class RoomsRaw extends BaseRaw<IRoom> implements IRoomsModel {
t: {
$in: ['c', 'p'],
},
name: nameRegex,
$and: [{ $or: [{ name: nameRegex }, { fname: nameRegex }] }, { federated: { $ne: true } }, { archived: { $ne: true } }],
$or: [
{
teamId: {
Expand All @@ -318,7 +318,6 @@ export class RoomsRaw extends BaseRaw<IRoom> implements IRoomsModel {
},
],
prid: { $exists: false },
$and: [{ federated: { $ne: true } }, { archived: { $ne: true } }],
};

return this.find(query, options);
Expand Down
Loading