This commit is contained in:
zandercymatics 2024-02-27 11:35:52 -07:00
parent db8c363d43
commit 3268fa44db
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -1148,9 +1148,9 @@ class DomainApplicationAdmin(ListHeaderAdmin):
original_is_approved_and_current_is_not = (
original_obj.status == models.DomainApplication.ApplicationStatus.APPROVED,
obj.status != models.DomainApplication.ApplicationStatus.APPROVED
obj.status != models.DomainApplication.ApplicationStatus.APPROVED,
)
if (original_is_approved_and_current_is_not and not obj.domain_is_not_active()):
if original_is_approved_and_current_is_not and not obj.domain_is_not_active():
# If an admin tried to set an approved application to
# another status and the related domain is already
# active, shortcut the action and throw a friendly
@ -1158,10 +1158,7 @@ class DomainApplicationAdmin(ListHeaderAdmin):
# shortcut or not as the rules are duplicated on the model,
# but the error would be an ugly Django error screen.
error_message = "This action is not permitted. The domain is already active."
elif (
obj.status == models.DomainApplication.ApplicationStatus.REJECTED
and not obj.rejection_reason
):
elif obj.status == models.DomainApplication.ApplicationStatus.REJECTED and not obj.rejection_reason:
# This condition should never be triggered.
# The opposite of this condition is acceptable (rejected -> other status and rejection_reason)
# because we clean up the rejection reason in the transition in the model.
@ -1179,9 +1176,7 @@ class DomainApplicationAdmin(ListHeaderAdmin):
try:
selected_method()
except ApplicationStatusError as err:
logger.warning(
f"User error encountered when trying to change status: {err}"
)
logger.warning(f"An error encountered when trying to change status: {err}")
error_message = err.message
if error_message is not None: