Invite all users sent in initial group create action

This commit is contained in:
Tulir Asokan
2017-11-30 20:42:07 +02:00
parent ee62b9cd7e
commit 437dee0ddb
+14 -10
View File
@@ -146,16 +146,7 @@ class Portal {
switch (evt.action._) {
case "messageActionChatCreate":
await this.createMatrixRoom(evt.source, { invite: [evt.source.matrixUser.userID] })
break
case "messageActionChatDeleteUser":
matrixUser = await this.app.getMatrixUserByTelegramID(evt.action.user_id)
if (matrixUser) {
matrixUser.leave(this)
this.kick(matrixUser.userID, "Left Telegram chat")
}
telegramUser = await this.app.getTelegramUser(evt.action.user_id)
telegramUser.intent.leave(this.roomID)
break
// Falls through to invite everyone in initial user list
case "messageActionChatAddUser":
for (const userID of evt.action.users) {
matrixUser = await this.app.getMatrixUserByTelegramID(userID)
@@ -167,6 +158,19 @@ class Portal {
telegramUser.intent.join(this.roomID)
}
break
case "messageActionChannelCreate":
// Channels don't send initial user lists 3:<
await this.createMatrixRoom(evt.source, { invite: [evt.source.matrixUser.userID] })
break
case "messageActionChatDeleteUser":
matrixUser = await this.app.getMatrixUserByTelegramID(evt.action.user_id)
if (matrixUser) {
matrixUser.leave(this)
this.kick(matrixUser.userID, "Left Telegram chat")
}
telegramUser = await this.app.getTelegramUser(evt.action.user_id)
telegramUser.intent.leave(this.roomID)
break
default:
console.log("Unhandled service message of type", evt.action._)
console.log(evt.action)