Bridge read-only status to Matrix when creating room
This commit is contained in:
parent
aa6bdc7818
commit
8bef004a46
@ -341,7 +341,7 @@ class Portal(DBPortal, BasePortal):
|
||||
if self.config["bridge.encryption.default"] and self.matrix.e2ee:
|
||||
self.encrypted = True
|
||||
initial_state.append({
|
||||
"type": "m.room.encryption",
|
||||
"type": str(EventType.ROOM_ENCRYPTION),
|
||||
"content": {"algorithm": "m.megolm.v1.aes-sha2"},
|
||||
})
|
||||
if self.is_direct:
|
||||
@ -353,6 +353,20 @@ class Portal(DBPortal, BasePortal):
|
||||
"type": "m.room.related_groups",
|
||||
"content": {"groups": [self.config["appservice.community_id"]]},
|
||||
})
|
||||
initial_state.append({
|
||||
"type": str(EventType.ROOM_POWER_LEVELS),
|
||||
"content": {
|
||||
"users": {
|
||||
self.az.bot_mxid: 100,
|
||||
self.main_intent.mxid: 9001,
|
||||
},
|
||||
"events": {},
|
||||
"events_default": 100 if info.readonly else 0,
|
||||
"state_default": 50,
|
||||
"invite": 50,
|
||||
"redact": 0
|
||||
}
|
||||
})
|
||||
|
||||
# We lock backfill lock here so any messages that come between the room being created
|
||||
# and the initial backfill finishing wouldn't be bridged before the backfill messages.
|
||||
|
@ -41,6 +41,7 @@ class Participant(SerializableAttrs['Participant']):
|
||||
@dataclass
|
||||
class ChatInfo(ChatListInfo, SerializableAttrs['ChatInfo']):
|
||||
participants: List[Participant]
|
||||
readonly: bool
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -181,6 +181,7 @@ export default class MessagesPuppeteer {
|
||||
* @typedef ChatInfo
|
||||
* @type object
|
||||
* @property {[Participant]} participants
|
||||
* @property {boolean} readonly
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -256,6 +257,7 @@ export default class MessagesPuppeteer {
|
||||
await this.page.click("mw-conversation-menu button")
|
||||
await this.page.waitForSelector(".mat-menu-panel button.mat-menu-item.details",
|
||||
{ timeout: 500 })
|
||||
const readonly = await this.page.$("mw-conversation-container .compose-readonly") !== null
|
||||
// There's a 250ms animation and I don't know how to wait for it properly
|
||||
await sleep(250)
|
||||
await this.page.click(".mat-menu-panel button.mat-menu-item.details")
|
||||
@ -267,6 +269,7 @@ export default class MessagesPuppeteer {
|
||||
await this.page.click("mws-dialog mat-dialog-actions button.confirm")
|
||||
return {
|
||||
participants,
|
||||
readonly,
|
||||
...await this.page.$eval(this._listItemSelector(id),
|
||||
elem => window.__mautrixController.parseChatListItem(elem)),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user