Save tag policy status in state
This commit is contained in:
parent
c18f167a12
commit
0fa2d2f267
2 changed files with 15 additions and 0 deletions
|
@ -19,12 +19,14 @@ import {
|
|||
resendConfirmationEmail,
|
||||
updateUserCredentials
|
||||
} from '@/api/users'
|
||||
import { fetchSettings } from '@/api/settings'
|
||||
|
||||
const users = {
|
||||
state: {
|
||||
fetchedUsers: [],
|
||||
loading: true,
|
||||
searchQuery: '',
|
||||
tagPolicyEnabled: true,
|
||||
totalUsersCount: 0,
|
||||
currentPage: 1,
|
||||
pageSize: 50,
|
||||
|
@ -78,6 +80,9 @@ const users = {
|
|||
SET_SEARCH_QUERY: (state, query) => {
|
||||
state.searchQuery = query
|
||||
},
|
||||
SET_TAG_POLICY: (state, policyEnabled) => {
|
||||
state.tagPolicyEnabled = policyEnabled
|
||||
},
|
||||
SET_USERS_FILTERS: (state, filters) => {
|
||||
state.filters = filters
|
||||
}
|
||||
|
@ -206,6 +211,15 @@ const users = {
|
|||
}
|
||||
dispatch('SuccessMessage')
|
||||
},
|
||||
async FetchTagPolicySetting({ commit, getters }) {
|
||||
const { data } = await fetchSettings(getters.authHost, getters.token)
|
||||
const tagPolicyEnabled = 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)
|
||||
},
|
||||
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
|
||||
commit('SET_LOADING', true)
|
||||
const filters = Object.keys(state.filters).filter(filter => state.filters[filter]).join()
|
||||
|
|
|
@ -198,6 +198,7 @@ export default {
|
|||
},
|
||||
mounted: function() {
|
||||
this.$store.dispatch('NeedReboot')
|
||||
this.$store.dispatch('FetchTagPolicySetting')
|
||||
this.$store.dispatch('FetchUsers', { page: 1 })
|
||||
},
|
||||
destroyed() {
|
||||
|
|
Loading…
Reference in a new issue