Support power_level_content_override

This commit is contained in:
RMidhunSuresh 2022-07-07 17:17:05 +05:30
parent e42e76a21c
commit cd9e00b847

View file

@ -37,7 +37,8 @@ type CreateRoomPayload = {
invite?: string[]; invite?: string[];
room_alias_name?: string; room_alias_name?: string;
creation_content?: {"m.federate": boolean}; creation_content?: {"m.federate": boolean};
initial_state: {type: string; state_key: string; content: Record<string, any>}[] initial_state: { type: string; state_key: string; content: Record<string, any> }[];
power_level_content_override?: Record<string, any>;
} }
type ImageInfo = { type ImageInfo = {
@ -62,6 +63,7 @@ type Options = {
invites?: string[]; invites?: string[];
avatar?: Avatar; avatar?: Avatar;
alias?: string; alias?: string;
powerLevelContentOverride?: Record<string, any>;
} }
function defaultE2EEStatusForType(type: RoomType): boolean { function defaultE2EEStatusForType(type: RoomType): boolean {
@ -151,6 +153,9 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> {
"m.federate": false "m.federate": false
}; };
} }
if (this.options.powerLevelContentOverride) {
createOptions.power_level_content_override = this.options.powerLevelContentOverride;
}
if (this.isEncrypted) { if (this.isEncrypted) {
createOptions.initial_state.push(createRoomEncryptionEvent()); createOptions.initial_state.push(createRoomEncryptionEvent());
} }