mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-12 05:02:58 +02:00
Per-guild presence sync settings
On by default for existing and small guilds. Off for new large guilds. Can be toggled either way.
This commit is contained in:
parent
69e3d64905
commit
0f435e930e
8 changed files with 56 additions and 7 deletions
|
@ -31,6 +31,8 @@ async function createSpace(guild, kstate) {
|
|||
const topic = kstate["m.room.topic/"]?.topic || undefined
|
||||
assert(name)
|
||||
|
||||
const memberCount = guild["member_count"] ?? guild.approximate_member_count ?? 0
|
||||
const enablePresenceByDefault = +(memberCount < 150) // could increase this later on if it doesn't cause any problems
|
||||
const globalAdmins = select("member_power", "mxid", {room_id: "*"}).pluck().all()
|
||||
|
||||
const roomID = await createRoom.postApplyPowerLevels(kstate, async kstate => {
|
||||
|
@ -50,7 +52,7 @@ async function createSpace(guild, kstate) {
|
|||
initial_state: await ks.kstateToState(kstate)
|
||||
})
|
||||
})
|
||||
db.prepare("INSERT INTO guild_space (guild_id, space_id) VALUES (?, ?)").run(guild.id, roomID)
|
||||
db.prepare("INSERT INTO guild_space (guild_id, space_id, presence) VALUES (?, ?, ?)").run(guild.id, roomID, enablePresenceByDefault)
|
||||
return roomID
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue