Iterate over list of tags to render tags menu when moderating users form Reports

This commit is contained in:
Angelina Filippova 2020-11-08 21:17:01 +03:00
parent 5ed0a6f7f4
commit fdbd5fdaf8
2 changed files with 30 additions and 44 deletions

View file

@ -14,49 +14,17 @@
@click.native="handleDeletion(account)"> @click.native="handleDeletion(account)">
{{ $t('users.deleteAccount') }} {{ $t('users.deleteAccount') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item divided/>
v-if="tagPolicyEnabled" <div v-if="tagPolicyEnabled">
:divided="true" <el-dropdown-item
:class="{ 'active-tag': tags.includes('mrf_tag:media-force-nsfw') }" v-for="option in tags"
@click.native="toggleTag(account, 'mrf_tag:media-force-nsfw')"> :key="option.tag"
{{ $t('users.forceNsfw') }} :class="{ 'active-tag': account.tags.includes(option.tag) }"
<i v-if="tags.includes('mrf_tag:media-force-nsfw')" class="el-icon-check"/> @click.native="toggleTag(account, option.tag)">
</el-dropdown-item> {{ option.label }}
<el-dropdown-item <i v-if="account.tags.includes(option.tag)" class="el-icon-check"/>
v-if="tagPolicyEnabled" </el-dropdown-item>
:class="{ 'active-tag': tags.includes('mrf_tag:media-strip') }" </div>
@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="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="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 <el-dropdown-item
v-if="!tagPolicyEnabled" v-if="!tagPolicyEnabled"
divided divided
@ -82,11 +50,28 @@ export default {
} }
}, },
computed: { computed: {
mapTags() {
return {
'mrf_tag:media-force-nsfw': 'Force posts to be NSFW',
'mrf_tag:media-strip': 'Force posts to not have media',
'mrf_tag:force-unlisted': 'Force posts to be unlisted',
'mrf_tag:sandbox': 'Force posts to be followers-only',
'mrf_tag:verified': 'Verified',
'mrf_tag:disable-remote-subscription': 'Disallow following user from remote instances',
'mrf_tag:disable-any-subscription': 'Disallow following user at all'
}
},
tagPolicyEnabled() { tagPolicyEnabled() {
return this.$store.state.users.mrfPolicies.includes('Pleroma.Web.ActivityPub.MRF.TagPolicy') return this.$store.state.users.mrfPolicies.includes('Pleroma.Web.ActivityPub.MRF.TagPolicy')
}, },
tags() { tags() {
return this.account.tags || [] return this.$store.state.users.tags.map(tag => {
if (this.mapTags[tag]) {
return { tag, label: this.mapTags[tag] }
} else {
return { tag, label: tag.charAt(0).toUpperCase() + tag.slice(1) }
}
}, {})
} }
}, },
methods: { methods: {

View file

@ -43,6 +43,7 @@ export default {
this.$store.dispatch('NeedReboot') this.$store.dispatch('NeedReboot')
this.$store.dispatch('FetchTagPolicySetting') this.$store.dispatch('FetchTagPolicySetting')
this.$store.dispatch('FetchReports', 1) this.$store.dispatch('FetchReports', 1)
this.$store.dispatch('ListTags')
} }
} }
</script> </script>