Fix email notifications for invites without local state. (#8627)
This can happen if e.g. the room invited into is no longer on the
server (or if all users left the room).
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/push/test_email.py b/tests/push/test_email.py
index 55545d9341..d9993e6245 100644
--- a/tests/push/test_email.py
+++ b/tests/push/test_email.py
@@ -131,6 +131,35 @@ class EmailPusherTests(HomeserverTestCase):
# We should get emailed about that message
self._check_for_mail()
+ def test_invite_sends_email(self):
+ # Create a room and invite the user to it
+ room = self.helper.create_room_as(self.others[0].id, tok=self.others[0].token)
+ self.helper.invite(
+ room=room,
+ src=self.others[0].id,
+ tok=self.others[0].token,
+ targ=self.user_id,
+ )
+
+ # We should get emailed about the invite
+ self._check_for_mail()
+
+ def test_invite_to_empty_room_sends_email(self):
+ # Create a room and invite the user to it
+ room = self.helper.create_room_as(self.others[0].id, tok=self.others[0].token)
+ self.helper.invite(
+ room=room,
+ src=self.others[0].id,
+ tok=self.others[0].token,
+ targ=self.user_id,
+ )
+
+ # Then have the original user leave
+ self.helper.leave(room, self.others[0].id, tok=self.others[0].token)
+
+ # We should get emailed about the invite
+ self._check_for_mail()
+
def test_multiple_members_email(self):
# We want to test multiple notifications, so we pause processing of push
# while we send messages.
|