forked from AkkomaGang/admin-fe
Add checking if tag policy is enabled in Reports, add ability to enable it
This commit is contained in:
parent
ee34707047
commit
665153c903
2 changed files with 37 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
||||||
{{ $t('users.deleteAccount') }}
|
{{ $t('users.deleteAccount') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
|
v-if="tagPolicyEnabled"
|
||||||
:divided="true"
|
:divided="true"
|
||||||
:class="{ 'active-tag': tags.includes('mrf_tag:media-force-nsfw') }"
|
:class="{ 'active-tag': tags.includes('mrf_tag:media-force-nsfw') }"
|
||||||
@click.native="toggleTag(account, 'mrf_tag:media-force-nsfw')">
|
@click.native="toggleTag(account, 'mrf_tag:media-force-nsfw')">
|
||||||
|
@ -22,37 +23,47 @@
|
||||||
<i v-if="tags.includes('mrf_tag:media-force-nsfw')" class="el-icon-check"/>
|
<i v-if="tags.includes('mrf_tag:media-force-nsfw')" class="el-icon-check"/>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
|
v-if="tagPolicyEnabled"
|
||||||
:class="{ 'active-tag': tags.includes('mrf_tag:media-strip') }"
|
:class="{ 'active-tag': tags.includes('mrf_tag:media-strip') }"
|
||||||
@click.native="toggleTag(account, 'mrf_tag:media-strip')">
|
@click.native="toggleTag(account, 'mrf_tag:media-strip')">
|
||||||
{{ $t('users.stripMedia') }}
|
{{ $t('users.stripMedia') }}
|
||||||
<i v-if="tags.includes('mrf_tag:media-strip')" class="el-icon-check"/>
|
<i v-if="tags.includes('mrf_tag:media-strip')" class="el-icon-check"/>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
|
v-if="tagPolicyEnabled"
|
||||||
:class="{ 'active-tag': tags.includes('mrf_tag:force-unlisted') }"
|
:class="{ 'active-tag': tags.includes('mrf_tag:force-unlisted') }"
|
||||||
@click.native="toggleTag(account, 'mrf_tag:force-unlisted')">
|
@click.native="toggleTag(account, 'mrf_tag:force-unlisted')">
|
||||||
{{ $t('users.forceUnlisted') }}
|
{{ $t('users.forceUnlisted') }}
|
||||||
<i v-if="tags.includes('mrf_tag:force-unlisted')" class="el-icon-check"/>
|
<i v-if="tags.includes('mrf_tag:force-unlisted')" class="el-icon-check"/>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
|
v-if="tagPolicyEnabled"
|
||||||
:class="{ 'active-tag': tags.includes('mrf_tag:sandbox') }"
|
:class="{ 'active-tag': tags.includes('mrf_tag:sandbox') }"
|
||||||
@click.native="toggleTag(account, 'mrf_tag:sandbox')">
|
@click.native="toggleTag(account, 'mrf_tag:sandbox')">
|
||||||
{{ $t('users.sandbox') }}
|
{{ $t('users.sandbox') }}
|
||||||
<i v-if="tags.includes('mrf_tag:sandbox')" class="el-icon-check"/>
|
<i v-if="tags.includes('mrf_tag:sandbox')" class="el-icon-check"/>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="account.local"
|
v-if="tagPolicyEnabled && account.local"
|
||||||
:class="{ 'active-tag': tags.includes('mrf_tag:disable-remote-subscription') }"
|
:class="{ 'active-tag': tags.includes('mrf_tag:disable-remote-subscription') }"
|
||||||
@click.native="toggleTag(account, 'mrf_tag:disable-remote-subscription')">
|
@click.native="toggleTag(account, 'mrf_tag:disable-remote-subscription')">
|
||||||
{{ $t('users.disableRemoteSubscription') }}
|
{{ $t('users.disableRemoteSubscription') }}
|
||||||
<i v-if="tags.includes('mrf_tag:disable-remote-subscription')" class="el-icon-check"/>
|
<i v-if="tags.includes('mrf_tag:disable-remote-subscription')" class="el-icon-check"/>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="account.local"
|
v-if="tagPolicyEnabled && account.local"
|
||||||
:class="{ 'active-tag': tags.includes('mrf_tag:disable-any-subscription') }"
|
:class="{ 'active-tag': tags.includes('mrf_tag:disable-any-subscription') }"
|
||||||
@click.native="toggleTag(account, 'mrf_tag:disable-any-subscription')">
|
@click.native="toggleTag(account, 'mrf_tag:disable-any-subscription')">
|
||||||
{{ $t('users.disableAnySubscription') }}
|
{{ $t('users.disableAnySubscription') }}
|
||||||
<i v-if="tags.includes('mrf_tag:disable-any-subscription')" class="el-icon-check"/>
|
<i v-if="tags.includes('mrf_tag:disable-any-subscription')" class="el-icon-check"/>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item
|
||||||
|
v-if="!tagPolicyEnabled"
|
||||||
|
divided
|
||||||
|
class="no-hover"
|
||||||
|
@click.native="enableTagPolicy">
|
||||||
|
{{ $t('users.enableTagPolicy') }}
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
@ -71,11 +82,34 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
tagPolicyEnabled() {
|
||||||
|
return this.$store.state.users.mrfPolicies.includes('Pleroma.Web.ActivityPub.MRF.TagPolicy')
|
||||||
|
},
|
||||||
tags() {
|
tags() {
|
||||||
return this.account.tags || []
|
return this.account.tags || []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
enableTagPolicy() {
|
||||||
|
this.$confirm(
|
||||||
|
this.$t('users.confirmEnablingTagPolicy'),
|
||||||
|
{
|
||||||
|
confirmButtonText: 'Yes',
|
||||||
|
cancelButtonText: 'Cancel',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: this.$t('users.enableTagPolicySuccessMessage')
|
||||||
|
})
|
||||||
|
this.$store.dispatch('EnableTagPolicy')
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: 'Canceled'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
handleDeactivation(user) {
|
handleDeactivation(user) {
|
||||||
user.deactivated
|
user.deactivated
|
||||||
? this.$store.dispatch('ActivateUserFromReports', { user, reportId: this.reportId })
|
? this.$store.dispatch('ActivateUserFromReports', { user, reportId: this.reportId })
|
||||||
|
|
|
@ -41,6 +41,7 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.dispatch('GetNodeInfo')
|
this.$store.dispatch('GetNodeInfo')
|
||||||
this.$store.dispatch('NeedReboot')
|
this.$store.dispatch('NeedReboot')
|
||||||
|
this.$store.dispatch('FetchTagPolicySetting')
|
||||||
this.$store.dispatch('FetchReports', 1)
|
this.$store.dispatch('FetchReports', 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue