diff --git a/api/config/settings/common.py b/api/config/settings/common.py index 8f2e00ade..455a5822e 100644 --- a/api/config/settings/common.py +++ b/api/config/settings/common.py @@ -46,7 +46,7 @@ logging.config.dictConfig( }, "loggers": { "funkwhale_api": { - "level": LOGLEVEL, + "level": logging.getLevelName("LOGLEVEL"), "handlers": ["console"], # required to avoid double logging with root logger "propagate": False, diff --git a/api/funkwhale_api/manage/filters.py b/api/funkwhale_api/manage/filters.py index 984b83133..9e20a6af4 100644 --- a/api/funkwhale_api/manage/filters.py +++ b/api/funkwhale_api/manage/filters.py @@ -237,10 +237,20 @@ class ManageUploadFilterSet(filters.FilterSet): class ManageDomainFilterSet(filters.FilterSet): q = fields.SearchFilter(search_fields=["name"]) + allowed = filters.BooleanFilter() class Meta: model = federation_models.Domain - fields = ["name"] + fields = ["name", "allowed"] + + def filter_allowed(self, qs, value): + """ + If value=false, we want to include object with value=null as well + """ + if value: + return qs.filter(allowed=True) + else: + return qs.filter(allowed__in=[False, None]) class ManageActorFilterSet(filters.FilterSet): diff --git a/api/funkwhale_api/moderation/dynamic_preferences_registry.py b/api/funkwhale_api/moderation/dynamic_preferences_registry.py index 8d8237cbb..04a732f4d 100644 --- a/api/funkwhale_api/moderation/dynamic_preferences_registry.py +++ b/api/funkwhale_api/moderation/dynamic_preferences_registry.py @@ -19,8 +19,8 @@ class AllowListPublic(types.BooleanPreference): name = "allow_list_public" verbose_name = "Publish your allowed-domains list" help_text = ( - "If enabled, everyone will be able to retrieve the list of domains you allowed. ", + "If enabled, everyone will be able to retrieve the list of domains you allowed. " "This is useful on open setups, to help people decide if they want to join your pod, or to " - "make your moderation policy public.", + "make your moderation policy public." ) default = False diff --git a/front/src/components/manage/moderation/DomainsTable.vue b/front/src/components/manage/moderation/DomainsTable.vue index 544d91156..08fff4cc5 100644 --- a/front/src/components/manage/moderation/DomainsTable.vue +++ b/front/src/components/manage/moderation/DomainsTable.vue @@ -6,6 +6,14 @@ +
+ + +
+
+ + +
- + @@ -32,12 +36,14 @@ import axios from 'axios' import DomainsTable from "@/components/manage/moderation/DomainsTable" export default { + props: ['allowListEnabled'], components: { DomainsTable }, data () { return { domainName: '', + domainAllowed: this.allowListEnabled ? true : null, isCreating: false, errors: [] } @@ -54,7 +60,7 @@ export default { let self = this this.isCreating = true this.errors = [] - axios.post('manage/federation/domains/', {name: this.domainName}).then((response) => { + axios.post('manage/federation/domains/', {name: this.domainName, allowed: this.domainAllowed}).then((response) => { this.isCreating = false this.$router.push({ name: "manage.moderation.domains.detail",