mirror of https://github.com/zulip/zulip.git
get_object_from_key: Make mark_object_used an obligatory kwarg.
This commit is contained in:
parent
dcc03a453a
commit
f787ddc7d2
|
@ -50,7 +50,7 @@ ConfirmationObjT = Union[MultiuseInvite, PreregistrationUser, EmailChangeStatus,
|
|||
|
||||
|
||||
def get_object_from_key(
|
||||
confirmation_key: str, confirmation_types: List[int], mark_object_used: bool = True
|
||||
confirmation_key: str, confirmation_types: List[int], *, mark_object_used: bool
|
||||
) -> ConfirmationObjT:
|
||||
"""Access a confirmation object from one of the provided confirmation
|
||||
types with the provided key.
|
||||
|
|
|
@ -2123,7 +2123,7 @@ so we didn't send them an invitation. We did send invitations to everyone else!"
|
|||
|
||||
# Mainly a test of get_object_from_key, rather than of the invitation pathway
|
||||
with self.assertRaises(ConfirmationKeyException) as cm:
|
||||
get_object_from_key(registration_key, [Confirmation.INVITATION])
|
||||
get_object_from_key(registration_key, [Confirmation.INVITATION], mark_object_used=True)
|
||||
self.assertEqual(cm.exception.error_type, ConfirmationKeyException.DOES_NOT_EXIST)
|
||||
|
||||
# Verify that using the wrong type doesn't work in the main confirm code path
|
||||
|
|
|
@ -62,7 +62,9 @@ AVATAR_CHANGES_DISABLED_ERROR = gettext_lazy("Avatar changes are disabled in thi
|
|||
|
||||
def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpResponse:
|
||||
try:
|
||||
email_change_object = get_object_from_key(confirmation_key, [Confirmation.EMAIL_CHANGE])
|
||||
email_change_object = get_object_from_key(
|
||||
confirmation_key, [Confirmation.EMAIL_CHANGE], mark_object_used=True
|
||||
)
|
||||
except ConfirmationKeyException as exception:
|
||||
return render_confirmation_key_error(request, exception)
|
||||
|
||||
|
|
Loading…
Reference in New Issue