Add checking if tag policy is enabled in Reports, add ability to enable it

This commit is contained in:
Angelina Filippova 2020-10-02 00:29:56 +03:00
parent ee34707047
commit 665153c903
2 changed files with 37 additions and 2 deletions

View file

@ -15,6 +15,7 @@
{{ $t('users.deleteAccount') }}
</el-dropdown-item>
<el-dropdown-item
v-if="tagPolicyEnabled"
:divided="true"
:class="{ 'active-tag': tags.includes('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"/>
</el-dropdown-item>
<el-dropdown-item
v-if="tagPolicyEnabled"
:class="{ 'active-tag': tags.includes('mrf_tag:media-strip') }"
@click.native="toggleTag(account, 'mrf_tag:media-strip')">
{{ $t('users.stripMedia') }}
<i v-if="tags.includes('mrf_tag:media-strip')" class="el-icon-check"/>
</el-dropdown-item>
<el-dropdown-item
v-if="tagPolicyEnabled"
:class="{ 'active-tag': tags.includes('mrf_tag:force-unlisted') }"
@click.native="toggleTag(account, 'mrf_tag:force-unlisted')">
{{ $t('users.forceUnlisted') }}
<i v-if="tags.includes('mrf_tag:force-unlisted')" class="el-icon-check"/>
</el-dropdown-item>
<el-dropdown-item
v-if="tagPolicyEnabled"
:class="{ 'active-tag': tags.includes('mrf_tag:sandbox') }"
@click.native="toggleTag(account, 'mrf_tag:sandbox')">
{{ $t('users.sandbox') }}
<i v-if="tags.includes('mrf_tag:sandbox')" class="el-icon-check"/>
</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') }"
@click.native="toggleTag(account, 'mrf_tag:disable-remote-subscription')">
{{ $t('users.disableRemoteSubscription') }}
<i v-if="tags.includes('mrf_tag:disable-remote-subscription')" class="el-icon-check"/>
</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') }"
@click.native="toggleTag(account, 'mrf_tag:disable-any-subscription')">
{{ $t('users.disableAnySubscription') }}
<i v-if="tags.includes('mrf_tag:disable-any-subscription')" class="el-icon-check"/>
</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>
</template>
@ -71,11 +82,34 @@ export default {
}
},
computed: {
tagPolicyEnabled() {
return this.$store.state.users.mrfPolicies.includes('Pleroma.Web.ActivityPub.MRF.TagPolicy')
},
tags() {
return this.account.tags || []
}
},
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) {
user.deactivated
? this.$store.dispatch('ActivateUserFromReports', { user, reportId: this.reportId })

View file

@ -41,6 +41,7 @@ export default {
mounted() {
this.$store.dispatch('GetNodeInfo')
this.$store.dispatch('NeedReboot')
this.$store.dispatch('FetchTagPolicySetting')
this.$store.dispatch('FetchReports', 1)
}
}