parent
c1ccfcb546
commit
db8ff5caec
|
@ -66,6 +66,11 @@ class RelayPlugin:
|
||||||
relay_group = self.get_relay_group(message.chat.id)
|
relay_group = self.get_relay_group(message.chat.id)
|
||||||
relay_group.send_text(f"Sending Message failed:\n\n{error}")
|
relay_group.send_text(f"Sending Message failed:\n\n{error}")
|
||||||
|
|
||||||
|
@account_hookimpl
|
||||||
|
def ac_member_removed(self, chat, contact, actor, message):
|
||||||
|
if chat == self.crew:
|
||||||
|
self.offboard(contact)
|
||||||
|
|
||||||
@account_hookimpl
|
@account_hookimpl
|
||||||
def ac_incoming_message(self, message: deltachat.Message):
|
def ac_incoming_message(self, message: deltachat.Message):
|
||||||
"""This method is called on every incoming message and decides what to do with it."""
|
"""This method is called on every incoming message and decides what to do with it."""
|
||||||
|
@ -262,3 +267,7 @@ class RelayPlugin:
|
||||||
if mapping[0] == outside_id:
|
if mapping[0] == outside_id:
|
||||||
return self.account.get_chat_by_id(mapping[1])
|
return self.account.get_chat_by_id(mapping[1])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def offboard(self, ex_admin):
|
||||||
|
for mapping in self.kvstore.get("relays"):
|
||||||
|
self.account.get_chat_by_id(mapping[1]).remove_contact(ex_admin)
|
||||||
|
|
|
@ -156,6 +156,13 @@ def test_relay_group_forwarding(relaycrew, outsider):
|
||||||
for msg in chat.get_messages():
|
for msg in chat.get_messages():
|
||||||
assert "This is the relay group for" not in msg.text
|
assert "This is the relay group for" not in msg.text
|
||||||
|
|
||||||
|
# user leaves crew
|
||||||
|
get_user_crew(user).remove_contact(user)
|
||||||
|
# make sure they are also offboarded from relay group
|
||||||
|
user._evtracker.wait_next_incoming_message()
|
||||||
|
for contact in bot_relay_group.get_contacts():
|
||||||
|
assert user.get_config("addr") != contact.addr
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.timeout(TIMEOUT)
|
@pytest.mark.timeout(TIMEOUT)
|
||||||
def test_default_outside_help(relaycrew, outsider):
|
def test_default_outside_help(relaycrew, outsider):
|
||||||
|
|
Loading…
Reference in a new issue