aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/models
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2022-10-01 19:48:25 +0300
committerGravatar mbaruh <[email protected]>2022-10-01 19:48:25 +0300
commit1970a3651db1e1a4f2ef92c85a0a733fa23fa6f0 (patch)
tree39f2254b44519ad8f4e5e21ff6d1fdfeb0500c15 /pydis_site/apps/api/models
parentFix send_alert not being added correctly in serializers (diff)
Bring back enabled categories
There needs to be a way to only enable a filter in a specific category, so this setting now fulfills that role. Disabled channels can be used to disable a filter in a specific channel within the category.
Diffstat (limited to 'pydis_site/apps/api/models')
-rw-r--r--pydis_site/apps/api/models/bot/filters.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/pydis_site/apps/api/models/bot/filters.py b/pydis_site/apps/api/models/bot/filters.py
index 1fb9707d..95a10e42 100644
--- a/pydis_site/apps/api/models/bot/filters.py
+++ b/pydis_site/apps/api/models/bot/filters.py
@@ -84,11 +84,6 @@ class FilterList(FilterSettingsMixin):
help_text="Whether an alert should be sent.",
)
# Where a filter should apply.
- #
- # The resolution is done in the following order:
- # - enabled_channels
- # - disabled_categories
- # - disabled_channels
enabled_channels = ArrayField(
models.CharField(max_length=100),
help_text="Channels in which to run the filter even if it's disabled in the category."
@@ -97,6 +92,10 @@ class FilterList(FilterSettingsMixin):
models.CharField(max_length=100),
help_text="Channels in which to not run the filter."
)
+ enabled_categories = ArrayField(
+ models.CharField(max_length=100),
+ help_text="The only categories in which to run the filter."
+ )
disabled_categories = ArrayField(
models.CharField(max_length=100),
help_text="Categories in which to not run the filter."
@@ -165,6 +164,11 @@ class FilterBase(FilterSettingsMixin):
models.CharField(max_length=100),
help_text="Channels in which to not run the filter.", null=True
)
+ enabled_categories = ArrayField(
+ models.CharField(max_length=100),
+ help_text="The only categories in which to run the filter.",
+ null=True
+ )
disabled_categories = ArrayField(
models.CharField(max_length=100),
help_text="Categories in which to not run the filter.",