diff --git a/front/src/components/common/Tooltip.vue b/front/src/components/common/Tooltip.vue new file mode 100644 index 000000000..d9ba4c13c --- /dev/null +++ b/front/src/components/common/Tooltip.vue @@ -0,0 +1,12 @@ + + + + + diff --git a/front/src/components/globals.js b/front/src/components/globals.js index d5a1fb4a4..99e57095c 100644 --- a/front/src/components/globals.js +++ b/front/src/components/globals.js @@ -40,5 +40,9 @@ import AjaxButton from '@/components/common/AjaxButton' Vue.component('ajax-button', AjaxButton) +import Tooltip from '@/components/common/Tooltip' + +Vue.component('tooltip', Tooltip) + export default {} diff --git a/front/src/components/manage/moderation/InstancePolicyCard.vue b/front/src/components/manage/moderation/InstancePolicyCard.vue new file mode 100644 index 000000000..c7d115856 --- /dev/null +++ b/front/src/components/manage/moderation/InstancePolicyCard.vue @@ -0,0 +1,72 @@ + + + + + + {{ object.actor }} + + + Enabled + + + + Paused + + + + Rule + + + Block everything + + + + + Silence activity + + + + Silence notifications + + + + Reject media + + + + + + + Reason + + + + + + Update + + + + + + + diff --git a/front/src/components/manage/moderation/InstancePolicyForm.vue b/front/src/components/manage/moderation/InstancePolicyForm.vue new file mode 100644 index 000000000..d3c8d6d6e --- /dev/null +++ b/front/src/components/manage/moderation/InstancePolicyForm.vue @@ -0,0 +1,212 @@ + + + + Update moderation rule + Add a new moderation rule + + + Error while creating rule + + {{ error }} + + + + + Reason + + + + + + + + + Block everything + + + + + + Or customize your rule + + + + + + + {{ labels[config.id].label }} + + + + + + + + + Enabled + Disabled + + + + + + + Cancel + + + Update + Create + + + Delete + + Delete this moderation rule? + + + This action is irreversible. + + + Delete moderation rule + + + + + + + + diff --git a/front/src/style/_main.scss b/front/src/style/_main.scss index 1ce8144c6..0c165c76f 100644 --- a/front/src/style/_main.scss +++ b/front/src/style/_main.scss @@ -255,7 +255,11 @@ button.reset { [data-tooltip]::after { white-space: normal; - width: 300px; - max-width: 300px; + width: 500px; + max-width: 500px; z-index: 999; } + +label .tooltip { + margin-left: 1em; +} diff --git a/front/src/views/admin/moderation/DomainsDetail.vue b/front/src/views/admin/moderation/DomainsDetail.vue index 1adb1c305..f5f9643c8 100644 --- a/front/src/views/admin/moderation/DomainsDetail.vue +++ b/front/src/views/admin/moderation/DomainsDetail.vue @@ -5,19 +5,61 @@ - - - - - {{ object.name }} - - - Open website - - - + + + + + + + {{ object.name }} + + + Open website + + + + + - + + + + + + + + + + + + + + + + + You don't have any rule in place for this domain. + + + Moderation policies help you control how your instance interact with a given domain or account. + Add a moderation policy + + + + + This domain is subject to specific moderation rules + + + + + + @@ -244,15 +286,25 @@ import axios from "axios" import logger from "@/logging" import lodash from '@/lodash' +import InstancePolicyForm from "@/components/manage/moderation/InstancePolicyForm" +import InstancePolicyCard from "@/components/manage/moderation/InstancePolicyCard" + export default { props: ["id"], + components: { + InstancePolicyForm, + InstancePolicyCard, + }, data() { return { lodash, isLoading: true, isLoadingStats: false, + isLoadingPolicy: false, + policy: null, object: null, stats: null, + showPolicyForm: false, permissions: [], } }, @@ -268,6 +320,9 @@ export default { axios.get(url).then(response => { self.object = response.data self.isLoading = false + if (self.object.instance_policy) { + self.fetchPolicy(self.object.instance_policy) + } }) }, fetchStats() { @@ -279,10 +334,23 @@ export default { self.isLoadingStats = false }) }, + fetchPolicy(id) { + var self = this + this.isLoadingPolicy = true + let url = `manage/moderation/instance-policies/${id}/` + axios.get(url).then(response => { + self.policy = response.data + self.isLoadingPolicy = false + }) + }, refreshNodeInfo (data) { this.object.nodeinfo = data this.object.nodeinfo_fetch_date = new Date() }, + updatePolicy (policy) { + this.policy = policy + this.showPolicyForm = false + } }, computed: { labels() { @@ -299,4 +367,7 @@ export default {
+ + {{ object.actor }} + + + Enabled + + + + Paused + +
Rule
+ + Block everything +
Reason
+ Delete this moderation rule? +
+ This action is irreversible. +
+ Delete moderation rule +
Moderation policies help you control how your instance interact with a given domain or account.