diff options
author | 2019-09-30 12:29:16 +0200 | |
---|---|---|
committer | 2019-09-30 12:29:16 +0200 | |
commit | 599f4b1523d76f600f19ae1b5f346d683e0183ce (patch) | |
tree | 99a76d6169c04468a5dd3194979bd2b64daf1a7f /pydis_site/apps/api/serializers.py | |
parent | Correct the Dockerfile path for azure. (diff) | |
parent | Merge branch 'master' into decoupling-warnings-and-notes (diff) |
Merge pull request #261 from python-discord/decoupling-warnings-and-notes
Migrate hidden warnings to notes and add additional validation
Diffstat (limited to 'pydis_site/apps/api/serializers.py')
-rw-r--r-- | pydis_site/apps/api/serializers.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index 5466b06b..326e20e1 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -115,9 +115,12 @@ class InfractionSerializer(ModelSerializer): raise ValidationError({'expires_at': [f'{infr_type} infractions cannot expire.']}) hidden = attrs.get('hidden') - if hidden and infr_type in ('superstar',): + if hidden and infr_type in ('superstar', 'warning'): raise ValidationError({'hidden': [f'{infr_type} infractions cannot be hidden.']}) + if not hidden and infr_type in ('note', ): + raise ValidationError({'hidden': [f'{infr_type} infractions must be hidden.']}) + return attrs |