Move updating user validation out of validate_and_update_broadcast_message_status

As only 1 of 2 functions calling it needs that check, it's better
to perform it inside that 1 function.
This commit is contained in:
Pea Tyczynska
2022-01-19 16:06:20 +00:00
parent a4c20e8ba6
commit c2a389e81a
2 changed files with 11 additions and 12 deletions

View File

@@ -111,7 +111,7 @@ def _cancel_or_reject_broadcast(references_to_original_broadcast, service_id):
message="Broadcast message reference and service id didn't match with any existing broadcasts",
status_code=404,
)
# do we need to check if service is active?
if broadcast_message.status == BroadcastStatusType.PENDING_APPROVAL:
new_status = BroadcastStatusType.REJECTED
else:
@@ -119,8 +119,7 @@ def _cancel_or_reject_broadcast(references_to_original_broadcast, service_id):
validate_and_update_broadcast_message_status(
broadcast_message,
new_status,
updating_user=None,
from_api=True
updating_user=None
)
return broadcast_message