Move config check when handling ghost invites
This commit is contained in:
@@ -71,13 +71,12 @@ class MatrixHandler(BaseMatrixHandler):
|
||||
evt: StateEvent,
|
||||
members: list[UserID],
|
||||
) -> None:
|
||||
if not invited_by.is_logged_in:
|
||||
await puppet.default_mxid_intent.leave_room(
|
||||
room_id, reason="You are not logged into this Telegram bridge"
|
||||
)
|
||||
return
|
||||
double_puppet = await pu.Puppet.get_by_custom_mxid(invited_by.mxid)
|
||||
if not double_puppet or self.az.bot_mxid in members:
|
||||
if (
|
||||
not double_puppet
|
||||
or self.az.bot_mxid in members
|
||||
or not not self.config["bridge.create_group_on_invite"]
|
||||
):
|
||||
if self.az.bot_mxid not in members:
|
||||
await puppet.default_mxid_intent.leave_room(
|
||||
room_id,
|
||||
@@ -89,7 +88,6 @@ class MatrixHandler(BaseMatrixHandler):
|
||||
"This ghost will remain inactive until a Telegram chat is created for this room.",
|
||||
)
|
||||
return
|
||||
|
||||
elif not await user_has_power_level(
|
||||
evt.room_id, double_puppet.intent, invited_by, "bridge"
|
||||
):
|
||||
@@ -97,8 +95,6 @@ class MatrixHandler(BaseMatrixHandler):
|
||||
room_id, reason="You do not have the permissions to bridge this room."
|
||||
)
|
||||
return
|
||||
elif not self.config["bridge.create_group_on_invite"]:
|
||||
return
|
||||
|
||||
await double_puppet.intent.invite_user(room_id, self.az.bot_mxid)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user