From e9f9fe81013b87baee62f8dc671b5a9904d1dfca Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Mon, 1 Feb 2021 19:01:40 +0000 Subject: [PATCH] be stricter on broadcast message area validation even if there is a json struct, make sure it actually contains polygons, or we'll send to the entire country. --- app/broadcast_message/rest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/broadcast_message/rest.py b/app/broadcast_message/rest.py index b79cba07e..74abd132f 100644 --- a/app/broadcast_message/rest.py +++ b/app/broadcast_message/rest.py @@ -56,7 +56,7 @@ def _update_broadcast_message(broadcast_message, new_status, updating_user): f'User {updating_user.id} cannot approve their own broadcast_message {broadcast_message.id}', status_code=400 ) - elif not broadcast_message.areas: + elif len(broadcast_message.areas['simple_polygons']) == 0: raise InvalidRequest( f'broadcast_message {broadcast_message.id} has no selected areas and so cannot be broadcasted.', status_code=400