Merge pull request #789 from vector-im/support-pl-room-creation

Support power_level_content_override option on room creation
This commit is contained in:
R Midhun Suresh 2022-07-07 17:42:19 +05:30 committed by GitHub
commit 963324c767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

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