Sync new power system to newly created rooms

This commit is contained in:
Cadence Ember 2024-08-26 01:42:56 +12:00
commit b8793dae0f
4 changed files with 11 additions and 4 deletions

View file

@ -142,6 +142,8 @@ async function channelToKState(channel, guild) {
const everyonePermissions = utils.getPermissions([], guild.roles, undefined, channel.permission_overwrites)
const everyoneCanMentionEveryone = utils.hasAllPermissions(everyonePermissions, ["MentionEveryone"])
const globalAdmins = select("member_power", ["mxid", "power_level"], {room_id: "*"}).all()
const channelKState = {
"m.room.name/": {name: convertedName},
"m.room.topic/": {topic: convertedTopic},
@ -161,7 +163,7 @@ async function channelToKState(channel, guild) {
notifications: {
room: everyoneCanMentionEveryone ? 0 : 20
},
users: reg.ooye.invite.reduce((a, c) => (a[c] = 100, a), {})
users: globalAdmins.reduce((a, c) => (a[c.mxid] = c.power_level, a), {})
},
"chat.schildi.hide_ui/read_receipts": {
hidden: true