diff options
| author | 2022-11-07 21:24:46 +0100 | |
|---|---|---|
| committer | 2022-11-07 21:24:46 +0100 | |
| commit | d33310037146a7e8988a27238ff475b659ef625c (patch) | |
| tree | b1b370a5ee076a0e8e089bb5ca074154c48eacb1 /pydis_site/apps/api | |
| parent | add tests for new thread_id validation flow (diff) | |
refactor nomination validation flow
Diffstat (limited to 'pydis_site/apps/api')
| -rw-r--r-- | pydis_site/apps/api/viewsets/bot/nomination.py | 20 | 
1 files changed, 8 insertions, 12 deletions
| diff --git a/pydis_site/apps/api/viewsets/bot/nomination.py b/pydis_site/apps/api/viewsets/bot/nomination.py index ecbf217e..49c40e7c 100644 --- a/pydis_site/apps/api/viewsets/bot/nomination.py +++ b/pydis_site/apps/api/viewsets/bot/nomination.py @@ -287,19 +287,15 @@ class NominationViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge              )          # This is actually covered, but for some reason coverage don't think so. -        elif 'reviewed' in request.data:  # pragma: no cover -            # 4. We are altering the reviewed state of the nomination. -            if not instance.active: -                raise ValidationError( -                    {'reviewed': ['This field cannot be set if the nomination is inactive.']} -                ) +        elif not instance.active and 'reviewed' in request.data: +            raise ValidationError( +                {'reviewed': ['This field cannot be set if the nomination is inactive.']} +            ) -        elif 'thread_id' in request.data: -            # 5. We are altering the thread_id of the nomination. -            if not instance.active: -                raise ValidationError( -                    {'thread_id': ['This field cannot be set if the nomination is inactive.']} -                ) +        elif not instance.active and 'thread_id' in request.data: +            raise ValidationError( +                {'thread_id': ['This field cannot be set if the nomination is inactive.']} +            )          if 'reason' in request.data:              if 'actor' not in request.data: | 
