Enabled instance policies on actors
This commit is contained in:
parent
bb1d5e4cbc
commit
378572d8bb
|
@ -5,26 +5,68 @@
|
||||||
</div>
|
</div>
|
||||||
<template v-if="object">
|
<template v-if="object">
|
||||||
<section :class="['ui', 'head', 'vertical', 'stripe', 'segment']" v-title="object.full_username">
|
<section :class="['ui', 'head', 'vertical', 'stripe', 'segment']" v-title="object.full_username">
|
||||||
<div class="segment-content">
|
<div class="ui stackable two column grid">
|
||||||
<h2 class="ui header">
|
<div class="ui column">
|
||||||
<i class="circular inverted user icon"></i>
|
<div class="segment-content">
|
||||||
<div class="content">
|
<h2 class="ui header">
|
||||||
{{ object.full_username }}
|
<i class="circular inverted user icon"></i>
|
||||||
<div class="sub header">
|
<div class="content">
|
||||||
<template v-if="object.user">
|
{{ object.full_username }}
|
||||||
<span class="ui tiny teal icon label">
|
<div class="sub header">
|
||||||
<i class="home icon"></i>
|
<template v-if="object.user">
|
||||||
<translate>Local account</translate>
|
<span class="ui tiny teal icon label">
|
||||||
</span>
|
<i class="home icon"></i>
|
||||||
|
<translate>Local account</translate>
|
||||||
</template>
|
</span>
|
||||||
<a :href="object.url || object.fid" target="_blank" rel="noopener noreferrer">
|
|
||||||
<translate>Open profile</translate>
|
</template>
|
||||||
<i class="external icon"></i>
|
<a :href="object.url || object.fid" target="_blank" rel="noopener noreferrer">
|
||||||
</a>
|
<translate>Open profile</translate>
|
||||||
</div>
|
<i class="external icon"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</div>
|
||||||
|
<div class="ui column">
|
||||||
|
<div v-if="!object.user" class="ui compact clearing placeholder segment">
|
||||||
|
<template v-if="isLoadingPolicy">
|
||||||
|
<div class="paragraph">
|
||||||
|
<div class="line"></div>
|
||||||
|
<div class="line"></div>
|
||||||
|
<div class="line"></div>
|
||||||
|
<div class="line"></div>
|
||||||
|
<div class="line"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="!policy && !showPolicyForm">
|
||||||
|
<header class="ui header">
|
||||||
|
<h3>
|
||||||
|
<i class="shield icon"></i>
|
||||||
|
<translate>You don't have any rule in place for this account.</translate>
|
||||||
|
</h3>
|
||||||
|
</header>
|
||||||
|
<p><translate>Moderation policies help you control how your instance interact with a given domain or account.</translate></p>
|
||||||
|
<button @click="showPolicyForm = true" class="ui primary button">Add a moderation policy</button>
|
||||||
|
</template>
|
||||||
|
<instance-policy-card v-else-if="policy && !showPolicyForm" :object="policy" @update="showPolicyForm = true">
|
||||||
|
<header class="ui header">
|
||||||
|
<h3>
|
||||||
|
<translate>This domain is subject to specific moderation rules</translate>
|
||||||
|
</h3>
|
||||||
|
</header>
|
||||||
|
</instance-policy-card>
|
||||||
|
<instance-policy-form
|
||||||
|
v-else-if="showPolicyForm"
|
||||||
|
@cancel="showPolicyForm = false"
|
||||||
|
@save="updatePolicy"
|
||||||
|
@delete="policy = null; showPolicyForm = false"
|
||||||
|
:object="policy"
|
||||||
|
type="actor"
|
||||||
|
:target="object.full_username" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<div class="ui vertical stripe segment">
|
<div class="ui vertical stripe segment">
|
||||||
|
@ -309,15 +351,24 @@ import logger from "@/logging"
|
||||||
import lodash from '@/lodash'
|
import lodash from '@/lodash'
|
||||||
import $ from "jquery"
|
import $ from "jquery"
|
||||||
|
|
||||||
|
import InstancePolicyForm from "@/components/manage/moderation/InstancePolicyForm"
|
||||||
|
import InstancePolicyCard from "@/components/manage/moderation/InstancePolicyCard"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ["id"],
|
props: ["id"],
|
||||||
|
components: {
|
||||||
|
InstancePolicyForm,
|
||||||
|
InstancePolicyCard,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lodash,
|
lodash,
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
isLoadingStats: false,
|
isLoadingStats: false,
|
||||||
|
isLoadingPolicy: false,
|
||||||
object: null,
|
object: null,
|
||||||
stats: null,
|
stats: null,
|
||||||
|
showPolicyForm: false,
|
||||||
permissions: [],
|
permissions: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -333,6 +384,9 @@ export default {
|
||||||
axios.get(url).then(response => {
|
axios.get(url).then(response => {
|
||||||
self.object = response.data
|
self.object = response.data
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
|
if (self.object.instance_policy) {
|
||||||
|
self.fetchPolicy(self.object.instance_policy)
|
||||||
|
}
|
||||||
if (response.data.user) {
|
if (response.data.user) {
|
||||||
self.allPermissions.forEach(p => {
|
self.allPermissions.forEach(p => {
|
||||||
if (self.object.user.permissions[p.code]) {
|
if (self.object.user.permissions[p.code]) {
|
||||||
|
@ -342,6 +396,15 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
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
|
||||||
|
})
|
||||||
|
},
|
||||||
fetchStats() {
|
fetchStats() {
|
||||||
var self = this
|
var self = this
|
||||||
this.isLoadingStats = true
|
this.isLoadingStats = true
|
||||||
|
@ -423,4 +486,7 @@ export default {
|
||||||
|
|
||||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.placeholder.segment {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue