See #890: added shortcuts for setting moderation policies directly when handling reports
This commit is contained in:
parent
77ef6d2510
commit
d5b89f01d7
|
@ -325,6 +325,10 @@ class ManageInstancePolicyFilterSet(filters.FilterSet):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_domain = filters.CharFilter("target_domain__name")
|
||||||
|
target_account_domain = filters.CharFilter("target_actor__domain__name")
|
||||||
|
target_account_username = filters.CharFilter("target_actor__preferred_username")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = moderation_models.InstancePolicy
|
model = moderation_models.InstancePolicy
|
||||||
fields = [
|
fields = [
|
||||||
|
@ -333,6 +337,9 @@ class ManageInstancePolicyFilterSet(filters.FilterSet):
|
||||||
"silence_activity",
|
"silence_activity",
|
||||||
"silence_notifications",
|
"silence_notifications",
|
||||||
"reject_media",
|
"reject_media",
|
||||||
|
"target_domain",
|
||||||
|
"target_account_domain",
|
||||||
|
"target_account_username",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
<template>
|
||||||
|
<button class="ui button" @click.prevent="show = !show">
|
||||||
|
<i class="shield icon"></i>
|
||||||
|
<slot>
|
||||||
|
<translate translate-context="Content/Moderation/Button.Label">Moderation rules…</translate>
|
||||||
|
</slot>
|
||||||
|
<modal :show.sync="show" @show="fetchData">
|
||||||
|
<div class="header">
|
||||||
|
<translate :translate-params="{obj: target}" translate-context="Popup/Moderation/Title/Verb">Manage moderation rules for %{ obj }</translate>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="description">
|
||||||
|
<div v-if="isLoading" class="ui active loader"></div>
|
||||||
|
<instance-policy-card v-else-if="obj && !showForm" :object="obj" @update="showForm = true">
|
||||||
|
<header class="ui header">
|
||||||
|
<h3>
|
||||||
|
<translate translate-context="Content/Moderation/Card.Title">This entity is subject to specific moderation rules</translate>
|
||||||
|
</h3>
|
||||||
|
</header>
|
||||||
|
</instance-policy-card>
|
||||||
|
<instance-policy-form
|
||||||
|
v-else
|
||||||
|
@cancel="showForm = false"
|
||||||
|
@save="showForm = false; result = {count: 1, results: [$event]}"
|
||||||
|
@delete="result = {count: 0, results: []}; showForm = false"
|
||||||
|
:object="obj"
|
||||||
|
:type="type"
|
||||||
|
:target="target" />
|
||||||
|
</div>
|
||||||
|
<div class="ui hidden divider"></div>
|
||||||
|
<div class="ui hidden divider"></div>
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<div class="ui deny button">
|
||||||
|
<translate translate-context="*/*/Button.Label/Verb">Close</translate>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</modal>
|
||||||
|
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
|
import InstancePolicyForm from "@/components/manage/moderation/InstancePolicyForm"
|
||||||
|
import InstancePolicyCard from "@/components/manage/moderation/InstancePolicyCard"
|
||||||
|
import Modal from '@/components/semantic/Modal'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
target: {required: true},
|
||||||
|
type: {required: true},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
InstancePolicyForm,
|
||||||
|
InstancePolicyCard,
|
||||||
|
Modal,
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
isLoading: false,
|
||||||
|
errors: [],
|
||||||
|
showForm: false,
|
||||||
|
result: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
obj () {
|
||||||
|
if (!this.result) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return this.result.results[0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchData () {
|
||||||
|
let params = {}
|
||||||
|
if (this.type === 'domain') {
|
||||||
|
params.target_domain = this.target
|
||||||
|
}
|
||||||
|
if (this.type === 'actor') {
|
||||||
|
let parts = this.target.split('@')
|
||||||
|
params.target_account_username = parts[0]
|
||||||
|
params.target_account_domain = parts[1]
|
||||||
|
}
|
||||||
|
let self = this
|
||||||
|
self.isLoading = true
|
||||||
|
axios.get('/manage/moderation/instance-policies/', {params: params}).then((response) => {
|
||||||
|
self.result = response.data
|
||||||
|
self.isLoading = false
|
||||||
|
}, error => {
|
||||||
|
self.isLoading = false
|
||||||
|
self.errors = error.backendErrors
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -135,13 +135,16 @@
|
||||||
<translate translate-context="*/*/*">{{ configs[target.type].label }}</translate>
|
<translate translate-context="*/*/*">{{ configs[target.type].label }}</translate>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="target && target.type !== 'account'">
|
<tr v-if="obj.target_owner && (!target || target.type !== 'account')">
|
||||||
<td>
|
<td>
|
||||||
<translate translate-context="*/*/*">Owner</translate>
|
<translate translate-context="*/*/*">Owner</translate>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<actor-link :admin="true" :actor="obj.target_owner"></actor-link>
|
<actor-link :admin="true" :actor="obj.target_owner"></actor-link>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<instance-policy-modal class="basic" type="actor" :target="obj.target_owner.full_username" />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="obj.target_state.is_local">
|
<tr v-if="obj.target_state.is_local">
|
||||||
<td>
|
<td>
|
||||||
|
@ -161,6 +164,9 @@
|
||||||
<td>
|
<td>
|
||||||
{{ obj.target_state.domain }}
|
{{ obj.target_state.domain }}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<instance-policy-modal class="basic" type="domain" :target="obj.target_state.domain" />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="field in targetFields" :key="field.id">
|
<tr v-for="field in targetFields" :key="field.id">
|
||||||
<td>{{ field.label }}</td>
|
<td>{{ field.label }}</td>
|
||||||
|
@ -226,6 +232,7 @@ import { diffWordsWithSpace } from 'diff'
|
||||||
import NoteForm from '@/components/manage/moderation/NoteForm'
|
import NoteForm from '@/components/manage/moderation/NoteForm'
|
||||||
import NotesThread from '@/components/manage/moderation/NotesThread'
|
import NotesThread from '@/components/manage/moderation/NotesThread'
|
||||||
import ReportCategoryDropdown from '@/components/moderation/ReportCategoryDropdown'
|
import ReportCategoryDropdown from '@/components/moderation/ReportCategoryDropdown'
|
||||||
|
import InstancePolicyModal from '@/components/manage/moderation/InstancePolicyModal'
|
||||||
import entities from '@/entities'
|
import entities from '@/entities'
|
||||||
import {setUpdate} from '@/utils'
|
import {setUpdate} from '@/utils'
|
||||||
import showdown from 'showdown'
|
import showdown from 'showdown'
|
||||||
|
@ -247,6 +254,7 @@ export default {
|
||||||
NoteForm,
|
NoteForm,
|
||||||
NotesThread,
|
NotesThread,
|
||||||
ReportCategoryDropdown,
|
ReportCategoryDropdown,
|
||||||
|
InstancePolicyModal,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -46,9 +46,11 @@ export default {
|
||||||
handler (newValue) {
|
handler (newValue) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
this.initModal()
|
this.initModal()
|
||||||
|
this.$emit('show')
|
||||||
this.control.modal('show')
|
this.control.modal('show')
|
||||||
} else {
|
} else {
|
||||||
if (this.control) {
|
if (this.control) {
|
||||||
|
this.$emit('hide')
|
||||||
this.control.modal('hide')
|
this.control.modal('hide')
|
||||||
this.control.remove()
|
this.control.remove()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue