Skip to content
Snippets Groups Projects
Commit 58f61499 authored by Haelwenn's avatar Haelwenn
Browse files

userProfile.js: call only with right privileges or when admin

Additionally this disables displaying chats when godmode is off.

Related: https://git.pleroma.social/pleroma/admin-fe/-/issues/185
parent aa4656bb
No related branches found
No related tags found
3 merge requests!326Mergeback: 2.5.0,!315Handle moderation privileges,!282Release/2.5.0
Pipeline #43004 passed
......@@ -41,8 +41,12 @@ const userProfile = {
commit('SET_USER', userResponse.data)
commit('SET_USER_PROFILE_LOADING', false)
dispatch('FetchUserStatuses', { userId, godmode })
dispatch('FetchUserChats', { userId })
if (getters.roles.includes('admin') || getters.privileges.includes('messages_read')) {
dispatch('FetchUserStatuses', { userId, godmode })
if (!godmode) {
dispatch('FetchUserChats', { userId })
}
}
},
FetchUserStatuses({ commit, dispatch, getters }, { userId, godmode }) {
commit('SET_STATUSES_LOADING', true)
......@@ -61,8 +65,10 @@ const userProfile = {
commit('SET_CHATS_LOADING', false)
},
async FetchUserCredentials({ commit, getters }, { nickname }) {
const userResponse = await fetchUserCredentials(nickname, getters.authHost, getters.token)
commit('SET_USER_CREDENTIALS', userResponse.data)
if (getters.roles.includes('admin') || getters.privileges.includes('users_manage_credentials')) {
const userResponse = await fetchUserCredentials(nickname, getters.authHost, getters.token)
commit('SET_USER_CREDENTIALS', userResponse.data)
}
},
SetStatuses({ commit }, statuses) {
commit('SET_STATUSES', statuses)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment