forked from AkkomaGang/admin-fe
Add ability to moderate user from a user's page
This commit is contained in:
parent
23054af57d
commit
1896c00946
5 changed files with 59 additions and 14 deletions
|
@ -202,6 +202,7 @@ export default {
|
||||||
disableAnySubscriptionForMultiple: 'Disallow following users at all',
|
disableAnySubscriptionForMultiple: 'Disallow following users at all',
|
||||||
requirePasswordReset: 'Require password reset on next login',
|
requirePasswordReset: 'Require password reset on next login',
|
||||||
selectUsers: 'Select users to apply actions to multiple users',
|
selectUsers: 'Select users to apply actions to multiple users',
|
||||||
|
moderateUser: 'Moderate user',
|
||||||
moderateUsers: 'Moderate multiple users',
|
moderateUsers: 'Moderate multiple users',
|
||||||
createAccount: 'Create new account',
|
createAccount: 'Create new account',
|
||||||
apply: 'apply',
|
apply: 'apply',
|
||||||
|
|
|
@ -93,6 +93,8 @@ const users = {
|
||||||
} finally {
|
} finally {
|
||||||
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch('FetchUserProfile', { userId: users[0].id, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async AddRight({ commit, dispatch, getters, state }, { users, right }) {
|
async AddRight({ commit, dispatch, getters, state }, { users, right }) {
|
||||||
|
@ -109,6 +111,8 @@ const users = {
|
||||||
} finally {
|
} finally {
|
||||||
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch('FetchUserProfile', { userId: users[0].id, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async AddTag({ commit, dispatch, getters, state }, { users, tag }) {
|
async AddTag({ commit, dispatch, getters, state }, { users, tag }) {
|
||||||
|
@ -125,6 +129,8 @@ const users = {
|
||||||
} finally {
|
} finally {
|
||||||
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch('FetchUserProfile', { userId: users[0].id, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async ClearFilters({ commit, dispatch, state }) {
|
async ClearFilters({ commit, dispatch, state }) {
|
||||||
|
@ -155,6 +161,8 @@ const users = {
|
||||||
} finally {
|
} finally {
|
||||||
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch('FetchUserProfile', { userId: users[0].id, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async ConfirmUsersEmail({ commit, dispatch, getters, state }, users) {
|
async ConfirmUsersEmail({ commit, dispatch, getters, state }, users) {
|
||||||
|
@ -196,6 +204,8 @@ const users = {
|
||||||
} finally {
|
} finally {
|
||||||
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch('FetchUserProfile', { userId: users[0].id, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async DeleteUsers({ commit, dispatch, getters, state }, users) {
|
async DeleteUsers({ commit, dispatch, getters, state }, users) {
|
||||||
|
@ -208,6 +218,8 @@ const users = {
|
||||||
const deletedUsersIds = users.map(deletedUser => deletedUser.id)
|
const deletedUsersIds = users.map(deletedUser => deletedUser.id)
|
||||||
const updatedUsers = state.fetchedUsers.filter(user => !deletedUsersIds.includes(user.id))
|
const updatedUsers = state.fetchedUsers.filter(user => !deletedUsersIds.includes(user.id))
|
||||||
commit('SET_USERS', updatedUsers)
|
commit('SET_USERS', updatedUsers)
|
||||||
|
|
||||||
|
dispatch('FetchUserProfile', { userId: users[0].id, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
|
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
|
||||||
|
@ -238,6 +250,8 @@ const users = {
|
||||||
} finally {
|
} finally {
|
||||||
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch('FetchUserProfile', { userId: users[0].id, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async RequirePasswordReset({ dispatch, getters }, user) {
|
async RequirePasswordReset({ dispatch, getters }, user) {
|
||||||
|
|
|
@ -1,9 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown :hide-on-click="false" size="small" trigger="click">
|
<el-dropdown :hide-on-click="false" size="small" trigger="click">
|
||||||
<span class="el-dropdown-link">
|
<div>
|
||||||
{{ $t('users.moderation') }}
|
<span v-if="page === 'users'" class="el-dropdown-link">
|
||||||
<i v-if="isDesktop" class="el-icon-arrow-down el-icon--right"/>
|
{{ $t('users.moderation') }}
|
||||||
</span>
|
<i v-if="isDesktop" class="el-icon-arrow-down el-icon--right"/>
|
||||||
|
</span>
|
||||||
|
<el-button v-if="page === 'userPage'" class="actions-button">
|
||||||
|
<span class="actions-button-container">
|
||||||
|
<span>
|
||||||
|
<i class="el-icon-edit" />
|
||||||
|
{{ $t('users.moderateUser') }}
|
||||||
|
</span>
|
||||||
|
<i class="el-icon-arrow-down el-icon--right"/>
|
||||||
|
</span>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="showAdminAction(user)"
|
v-if="showAdminAction(user)"
|
||||||
|
@ -100,6 +111,10 @@ export default {
|
||||||
default: function() {
|
default: function() {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
type: String,
|
||||||
|
default: 'users'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('users.actions')" fixed="right">
|
<el-table-column :label="$t('users.actions')" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<moderation-dropdown :user="scope.row"/>
|
<moderation-dropdown :user="scope.row" :page="'users'"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<main v-if="!userProfileLoading">
|
<main v-if="!userProfileLoading">
|
||||||
<header>
|
<header class="user-page-header">
|
||||||
<el-avatar :src="user.avatar" size="large" />
|
<div class="avatar-name-container">
|
||||||
<h1>{{ user.display_name }}</h1>
|
<el-avatar :src="user.avatar" size="large" />
|
||||||
|
<h1>{{ user.display_name }}</h1>
|
||||||
|
</div>
|
||||||
|
<moderation-dropdown :user="user" :page="'userPage'"/>
|
||||||
</header>
|
</header>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
|
@ -84,10 +87,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Status from '@/components/Status'
|
import Status from '@/components/Status'
|
||||||
|
import ModerationDropdown from './components/ModerationDropdown'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UsersShow',
|
name: 'UsersShow',
|
||||||
components: { Status },
|
components: { ModerationDropdown, Status },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showPrivate: false
|
showPrivate: false
|
||||||
|
@ -119,6 +123,10 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style rel='stylesheet/scss' lang='scss' scoped>
|
<style rel='stylesheet/scss' lang='scss' scoped>
|
||||||
|
.avatar-name-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
header {
|
header {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -151,7 +159,6 @@ table {
|
||||||
.no-statuses {
|
.no-statuses {
|
||||||
margin-left: 28px;
|
margin-left: 28px;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
|
|
||||||
}
|
}
|
||||||
.recent-statuses-header {
|
.recent-statuses-header {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
@ -160,16 +167,24 @@ table {
|
||||||
padding: 0 20px 0 0;
|
padding: 0 20px 0 0;
|
||||||
}
|
}
|
||||||
.show-private {
|
.show-private {
|
||||||
text-align: right;
|
width: 173px;
|
||||||
|
text-align: left;
|
||||||
line-height: 67px;
|
line-height: 67px;
|
||||||
padding-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
.recent-statuses {
|
.recent-statuses {
|
||||||
margin-left: 28px;
|
margin-left: 28px;
|
||||||
}
|
}
|
||||||
|
.user-page-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 20px;
|
||||||
|
h1 {
|
||||||
|
display: inline
|
||||||
|
}
|
||||||
|
}
|
||||||
.user-profile-card {
|
.user-profile-card {
|
||||||
margin-left: 15px;
|
margin: 0 20px;
|
||||||
margin-right: 20px;
|
|
||||||
}
|
}
|
||||||
.user-profile-table {
|
.user-profile-table {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
Loading…
Reference in a new issue