Skip to content

Node.js based forum software built for the modern web

fix: #14032, fix regression in room creation

Barış Soner Uşaklı2d49da788977
diff --git a/src/messaging/rooms.js b/src/messaging/rooms.js
index 83de1c07c7..4356775a47 100644
--- a/src/messaging/rooms.js
+++ b/src/messaging/rooms.js
@@ -110,7 +110,7 @@ module.exports = function (Messaging) {
[`chat:room:${roomId}:uids:online`, now, uid],
...(
isPublic ?
- [`chat:room:${roomId}:owners`, now, uid] :
+ [[`chat:room:${roomId}:owners`, now, uid]] :
[uid].concat(data.uids).map(uid => ([`chat:room:${roomId}:owners`, now, uid]))
),
]),
diff --git a/test/messaging.js b/test/messaging.js
index 4e2e709007..bbe310e27d 100644
--- a/test/messaging.js
+++ b/test/messaging.js
@@ -599,6 +599,20 @@ describe('Messaging Library', () => {
const { roomId } = await api.users.getPrivateRoomId({ uid: mocks.users.foo.uid }, { uid: mocks.users.herp.uid });
assert(roomId);
});
+
+ it('should create a public chat room', async () => {
+ const data = await api.chats.create({
+ uid: mocks.users.foo.uid,
+ session: {},
+ }, {
+ name: 'public room',
+ type: 'public',
+ uids: [],
+ groups: ['registered-users'],
+ });
+ assert(data.roomId);
+ assert.strictEqual(data.public, true);
+ });
});
describe('toMid', () => {