Disable tags actions in moderation dropdown when TagPolicy is disabled

This commit is contained in:
Angelina Filippova 2020-08-27 01:36:02 +03:00
parent 0fa2d2f267
commit d19aef2e94
3 changed files with 19 additions and 5 deletions

View file

@ -26,7 +26,7 @@ const users = {
fetchedUsers: [],
loading: true,
searchQuery: '',
tagPolicyEnabled: true,
tagPolicyDisabled: false,
totalUsersCount: 0,
currentPage: 1,
pageSize: 50,
@ -80,8 +80,8 @@ const users = {
SET_SEARCH_QUERY: (state, query) => {
state.searchQuery = query
},
SET_TAG_POLICY: (state, policyEnabled) => {
state.tagPolicyEnabled = policyEnabled
SET_TAG_POLICY: (state, policyDisabled) => {
state.tagPolicyDisabled = policyDisabled
},
SET_USERS_FILTERS: (state, filters) => {
state.filters = filters
@ -213,12 +213,12 @@ const users = {
},
async FetchTagPolicySetting({ commit, getters }) {
const { data } = await fetchSettings(getters.authHost, getters.token)
const tagPolicyEnabled = data.configs
const tagPolicyDisabled = !data.configs
.find(el => el.key === ':mrf').value
.find(el => el.tuple[0] === ':policies').tuple[1]
.includes('Pleroma.Web.ActivityPub.MRF.TagPolicy')
commit('SET_TAG_POLICY', tagPolicyEnabled)
commit('SET_TAG_POLICY', tagPolicyDisabled)
},
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
commit('SET_LOADING', true)

View file

@ -68,6 +68,7 @@
{{ $t('users.resendConfirmation') }}
</el-dropdown-item>
<el-dropdown-item
:disabled="tagPolicyDisabled"
:divided="showAdminAction(user)"
:class="{ 'active-tag': user.tags.includes('mrf_tag:media-force-nsfw') }"
@click.native="toggleTag(user, 'mrf_tag:media-force-nsfw')">
@ -75,18 +76,21 @@
<i v-if="user.tags.includes('mrf_tag:media-force-nsfw')" class="el-icon-check"/>
</el-dropdown-item>
<el-dropdown-item
:disabled="tagPolicyDisabled"
:class="{ 'active-tag': user.tags.includes('mrf_tag:media-strip') }"
@click.native="toggleTag(user, 'mrf_tag:media-strip')">
{{ $t('users.stripMedia') }}
<i v-if="user.tags.includes('mrf_tag:media-strip')" class="el-icon-check"/>
</el-dropdown-item>
<el-dropdown-item
:disabled="tagPolicyDisabled"
:class="{ 'active-tag': user.tags.includes('mrf_tag:force-unlisted') }"
@click.native="toggleTag(user, 'mrf_tag:force-unlisted')">
{{ $t('users.forceUnlisted') }}
<i v-if="user.tags.includes('mrf_tag:force-unlisted')" class="el-icon-check"/>
</el-dropdown-item>
<el-dropdown-item
:disabled="tagPolicyDisabled"
:class="{ 'active-tag': user.tags.includes('mrf_tag:sandbox') }"
@click.native="toggleTag(user, 'mrf_tag:sandbox')">
{{ $t('users.sandbox') }}
@ -94,6 +98,7 @@
</el-dropdown-item>
<el-dropdown-item
v-if="user.local"
:disabled="tagPolicyDisabled"
:class="{ 'active-tag': user.tags.includes('mrf_tag:disable-remote-subscription') }"
@click.native="toggleTag(user, 'mrf_tag:disable-remote-subscription')">
{{ $t('users.disableRemoteSubscription') }}
@ -101,6 +106,7 @@
</el-dropdown-item>
<el-dropdown-item
v-if="user.local"
:disabled="tagPolicyDisabled"
:class="{ 'active-tag': user.tags.includes('mrf_tag:disable-any-subscription') }"
@click.native="toggleTag(user, 'mrf_tag:disable-any-subscription')">
{{ $t('users.disableAnySubscription') }}
@ -161,6 +167,9 @@ export default {
},
isDesktop() {
return this.$store.state.app.device === 'desktop'
},
tagPolicyDisabled() {
return this.$store.state.users.tagPolicyDisabled
}
},
methods: {

View file

@ -276,6 +276,11 @@ export default {
margin: 7px 0 0 15px;
}
}
.active-tag.is-disabled {
.el-icon-check {
color: #bbb;
}
}
.el-dropdown-link:hover {
cursor: pointer;
color: #409EFF;