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).
This commit is contained in:
Erik Johnston 2020-10-23 10:41:32 +01:00 committed by GitHub
parent 054a6b9538
commit db9ef792f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 13 deletions

View file

@ -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.