Mark messages as read after someone talked about it in a relay group
fix #15
This commit is contained in:
parent
9c40e5f3af
commit
3f09be5b25
|
@ -156,6 +156,7 @@ class RelayPlugin:
|
||||||
else:
|
else:
|
||||||
logging.debug("Ignoring message, just the crew chatting")
|
logging.debug("Ignoring message, just the crew chatting")
|
||||||
else:
|
else:
|
||||||
|
self.mark_last_messages_read(message.chat)
|
||||||
logging.debug("Ignoring message, just the crew chatting")
|
logging.debug("Ignoring message, just the crew chatting")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -277,3 +278,12 @@ class RelayPlugin:
|
||||||
relay_group = self.account.get_chat_by_id(mapping[1])
|
relay_group = self.account.get_chat_by_id(mapping[1])
|
||||||
if ex_admin in relay_group.get_contacts():
|
if ex_admin in relay_group.get_contacts():
|
||||||
relay_group.remove_contact(ex_admin)
|
relay_group.remove_contact(ex_admin)
|
||||||
|
|
||||||
|
def mark_last_messages_read(self, relay_group: deltachat.Chat) -> None:
|
||||||
|
"""Mark the last incoming messages as read for a corresponding relay group.
|
||||||
|
|
||||||
|
:param relay_group: the relay group in which the messages which should marked read were forwarded.
|
||||||
|
"""
|
||||||
|
outside_chat = self.get_outside_chat(relay_group.id)
|
||||||
|
for msg in outside_chat.get_messages():
|
||||||
|
msg.mark_seen()
|
||||||
|
|
|
@ -103,6 +103,7 @@ def test_relay_group_forwarding(relaycrew, outsider):
|
||||||
message_from_outsider = bot._evtracker.wait_next_incoming_message()
|
message_from_outsider = bot._evtracker.wait_next_incoming_message()
|
||||||
bot_outside_chat = message_from_outsider.chat
|
bot_outside_chat = message_from_outsider.chat
|
||||||
assert not bot.relayplugin.is_relay_group(bot_outside_chat)
|
assert not bot.relayplugin.is_relay_group(bot_outside_chat)
|
||||||
|
assert message_from_outsider.is_in_fresh()
|
||||||
|
|
||||||
# get relay group
|
# get relay group
|
||||||
user_forwarded_message_from_outsider = user._evtracker.wait_next_incoming_message()
|
user_forwarded_message_from_outsider = user._evtracker.wait_next_incoming_message()
|
||||||
|
@ -132,6 +133,7 @@ def test_relay_group_forwarding(relaycrew, outsider):
|
||||||
user._dc_context, user_relay_group.id, user_direct_reply._dc_msg
|
user._dc_context, user_relay_group.id, user_direct_reply._dc_msg
|
||||||
)
|
)
|
||||||
assert sent_id == user_direct_reply.id
|
assert sent_id == user_direct_reply.id
|
||||||
|
assert message_from_outsider.is_in_seen()
|
||||||
|
|
||||||
# check that direct reply was forwarded to outsider
|
# check that direct reply was forwarded to outsider
|
||||||
outsider_direct_reply = outsider._evtracker.wait_next_incoming_message()
|
outsider_direct_reply = outsider._evtracker.wait_next_incoming_message()
|
||||||
|
|
Loading…
Reference in a new issue