confirmation: Rename confusing activate_object parameter.

This commit is contained in:
Tim Abbott 2022-07-19 12:08:19 -07:00
parent fa7700df11
commit 495671cca0
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ ConfirmationObjT = Union[MultiuseInvite, PreregistrationUser, EmailChangeStatus,
def get_object_from_key(
confirmation_key: str, confirmation_types: List[int], activate_object: bool = True
confirmation_key: str, confirmation_types: List[int], mark_object_used: bool = True
) -> ConfirmationObjT:
# Confirmation keys used to be 40 characters
if len(confirmation_key) not in (24, 40):
@ -67,7 +67,7 @@ def get_object_from_key(
obj = confirmation.content_object
assert obj is not None
if activate_object and hasattr(obj, "status"):
if mark_object_used and hasattr(obj, "status"):
obj.status = getattr(settings, "STATUS_USED", 1)
obj.save(update_fields=["status"])
return obj

View File

@ -136,7 +136,7 @@ def check_prereg_key(request: HttpRequest, confirmation_key: str) -> Preregistra
Confirmation.REALM_CREATION,
]
prereg_user = get_object_from_key(confirmation_key, confirmation_types, activate_object=False)
prereg_user = get_object_from_key(confirmation_key, confirmation_types, mark_object_used=False)
assert isinstance(prereg_user, PreregistrationUser)
if prereg_user.status in [