From 675ec273fe9e7fc52769c85eaaa95bc9fe1b7a89 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Fri, 13 May 2022 11:48:47 +0530 Subject: [PATCH] Fix room type with federation allowded --- src/matrix/room/RoomBeingCreated.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/RoomBeingCreated.ts b/src/matrix/room/RoomBeingCreated.ts index 9fe8c31e..f825c163 100644 --- a/src/matrix/room/RoomBeingCreated.ts +++ b/src/matrix/room/RoomBeingCreated.ts @@ -36,7 +36,7 @@ type CreateRoomPayload = { topic?: string; invite?: string[]; room_alias_name?: string; - creation_content?: {"m.federate": boolean, type?: string}; + creation_content?: {"m.federate"?: boolean, type?: string}; initial_state: {type: string; state_key: string; content: Record}[] power_level_content_override?: any; } @@ -150,12 +150,15 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> { if (this.options.alias) { createOptions.room_alias_name = this.options.alias; } - if (this.options.isFederationDisabled === true) { + if (this.options.type !== undefined) { createOptions.creation_content = { type: this.options.type === RoomType.World ? "org.matrix.msc3815.world" : undefined, - "m.federate": false }; } + if (this.options.isFederationDisabled === true) { + if (createOptions.creation_content === undefined) createOptions.creation_content = {}; + createOptions.creation_content["m.federate"] = false; + } if (this.isEncrypted) { createOptions.initial_state.push(createRoomEncryptionEvent()); }