From 8b14fc6c2251c679b79e7c462783b5f1b7c48c28 Mon Sep 17 00:00:00 2001 From: Matheus Barbosa Silva <36537004+matheusbsilva137@users.noreply.github.com> Date: Tue, 22 Nov 2022 18:49:21 -0300 Subject: [PATCH] [FIX] LDAP groups to channel mapping attempts to create a new room instead of using an existing one (#27312) --- apps/meteor/app/models/server/models/Rooms.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/meteor/app/models/server/models/Rooms.js b/apps/meteor/app/models/server/models/Rooms.js index d86fb37323c2..703cf3b28ec9 100644 --- a/apps/meteor/app/models/server/models/Rooms.js +++ b/apps/meteor/app/models/server/models/Rooms.js @@ -309,7 +309,7 @@ export class Rooms extends Base { } findOneByNonValidatedName(name, options) { - const room = this.findOneByName(name, options); + const room = this.findOneByNameOrFname(name, options); if (room) { return room; } @@ -332,6 +332,21 @@ export class Rooms extends Base { return this.findOne(query, options); } + findOneByNameOrFname(name, options) { + const query = { + $or: [ + { + name, + }, + { + fname: name, + }, + ], + }; + + return this.findOne(query, options); + } + findOneByNameAndNotId(name, rid) { const query = { _id: { $ne: rid },