mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 12:22:50 +02:00
Store invites in database
This commit is contained in:
parent
f9be1e39a1
commit
978eb40e1d
3 changed files with 24 additions and 0 deletions
|
@ -214,6 +214,14 @@ sync.addTemporaryListener(as, "type:m.room.member", guard("m.room.member",
|
|||
*/
|
||||
async event => {
|
||||
if (event.state_key[0] !== "@") return
|
||||
|
||||
if (event.content.membership === "invite" && event.state_key === `@${reg.sender_localpart}:${reg.ooye.server_name}`) {
|
||||
// We were invited to a room. We should join, and register the invite details for future reference in web.
|
||||
await api.joinRoom(event.room_id)
|
||||
const creation = await api.getStateEvent(event.room_id, "m.room.create", "")
|
||||
db.prepare("INSERT OR IGNORE INTO invite (mxid, room_id, type) VALUES (?, ?, ?)").run(event.sender, event.room_id, creation.type || null)
|
||||
}
|
||||
|
||||
if (utils.eventSenderIsFromDiscord(event.state_key)) return
|
||||
|
||||
if (event.content.membership === "leave" || event.content.membership === "ban") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue