Fixup and add some logging

This commit is contained in:
Brendan Abolivier 2019-09-27 15:13:39 +01:00
parent 5257a2fb1c
commit 72a2708ac6
No known key found for this signature in database
GPG Key ID: 1E015C145F1916CD

View File

@ -122,7 +122,7 @@ class DeactivateAccountHandler(BaseHandler):
# Reject all pending invites for the user, so that it doesn't show up in the # Reject all pending invites for the user, so that it doesn't show up in the
# invitees list of rooms. # invitees list of rooms.
self._reject_pending_invites_for_user(user_id) yield self._reject_pending_invites_for_user(user_id)
# Remove all information on the user from the account_validity table. # Remove all information on the user from the account_validity table.
if self._account_validity_enabled: if self._account_validity_enabled:
@ -133,6 +133,7 @@ class DeactivateAccountHandler(BaseHandler):
return identity_server_supports_unbinding return identity_server_supports_unbinding
@defer.inlineCallbacks
def _reject_pending_invites_for_user(self, user_id): def _reject_pending_invites_for_user(self, user_id):
"""Reject pending invites addressed to a given user ID. """Reject pending invites addressed to a given user ID.
@ -142,6 +143,8 @@ class DeactivateAccountHandler(BaseHandler):
user = UserID.from_string(user_id) user = UserID.from_string(user_id)
pending_invites = yield self.store.get_invited_rooms_for_user(user_id) pending_invites = yield self.store.get_invited_rooms_for_user(user_id)
logger.info(pending_invites)
for room in pending_invites: for room in pending_invites:
try: try:
yield self._room_member_handler.update_membership( yield self._room_member_handler.update_membership(
@ -152,6 +155,11 @@ class DeactivateAccountHandler(BaseHandler):
ratelimit=False, ratelimit=False,
require_consent=False, require_consent=False,
) )
logger.info(
"Rejected invite for user %r in room %r",
user_id,
room.room_id,
)
except Exception: except Exception:
logger.exception( logger.exception(
"Failed to reject invite for user %r in room %r:" "Failed to reject invite for user %r in room %r:"