aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/models/bot
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/apps/api/models/bot')
-rw-r--r--pydis_site/apps/api/models/bot/filters.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/pydis_site/apps/api/models/bot/filters.py b/pydis_site/apps/api/models/bot/filters.py
index 472354f8..3a1f3c6a 100644
--- a/pydis_site/apps/api/models/bot/filters.py
+++ b/pydis_site/apps/api/models/bot/filters.py
@@ -56,11 +56,6 @@ class FilterSettingsMixin(models.Model):
help_text="The duration of the infraction. Null if permanent."
)
- def clean(self):
- """Validate infraction fields as whole."""
- if (self.infraction_duration or self.infraction_reason) and not self.infraction_type:
- raise ValidationError("Infraction type is required if setting infraction duration or reason.")
-
class Meta:
"""Metaclass for settings mixin."""
@@ -113,20 +108,6 @@ class FilterList(FilterSettingsMixin):
allowed_channels = ArrayField(models.IntegerField())
allowed_categories = ArrayField(models.IntegerField())
- def clean(self):
- """Do not allow duplicates in allowed and disallowed lists."""
- # Still run infraction fields validation
- super().clean()
-
- channels_collection = self.allowed_channels + self.disallowed_channels
- categories_collection = self.allowed_categories + self.disallowed_categories
-
- if len(channels_collection) != len(set(channels_collection)):
- raise ValidationError("Allowed and disallowed channels lists contain duplicates.")
-
- if len(categories_collection) != len(set(categories_collection)):
- raise ValidationError("Allowed and disallowed categories lists contain duplicates.")
-
class Meta:
"""Constrain name and list_type unique."""
@@ -181,20 +162,5 @@ class Filter(FilterSettingsMixin):
allowed_channels = ArrayField(models.IntegerField(), null=True)
allowed_categories = ArrayField(models.IntegerField(), null=True)
- def clean(self):
- """Do not allow duplicates in allowed and disallowed lists."""
- # Still run infraction fields validation
- super().clean()
-
- if self.allowed_channels is not None or self.disallowed_channels is not None:
- channels_collection = self.allowed_channels + self.disallowed_channels
- if len(channels_collection) != len(set(channels_collection)):
- raise ValidationError("Allowed and disallowed channels lists contain duplicates.")
-
- if self.allowed_categories is not None or self.disallowed_categories is not None:
- categories_collection = self.allowed_categories + self.disallowed_categories
- if len(categories_collection) != len(set(categories_collection)):
- raise ValidationError("Allowed and disallowed categories lists contain duplicates.")
-
def __str__(self) -> str:
return f"Filter {self.content!r}"