From 23054af57d88c5486e5a314d6084de7a84455019 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Mon, 27 Jan 2020 15:05:51 +0300 Subject: [PATCH] Extract moderation menu into a separate component --- .../users/components/ModerationDropdown.vue | 155 ++++++++++++++++++ src/views/users/index.vue | 139 +--------------- 2 files changed, 160 insertions(+), 134 deletions(-) create mode 100644 src/views/users/components/ModerationDropdown.vue diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue new file mode 100644 index 00000000..1a06559f --- /dev/null +++ b/src/views/users/components/ModerationDropdown.vue @@ -0,0 +1,155 @@ + + + diff --git a/src/views/users/index.vue b/src/views/users/index.vue index 4cb24199..1ac63789 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -66,96 +66,7 @@ @@ -191,13 +102,15 @@ import numeral from 'numeral' import UsersFilter from './components/UsersFilter' import MultipleUsersMenu from './components/MultipleUsersMenu' import NewAccountDialog from './components/NewAccountDialog' +import ModerationDropdown from './components/ModerationDropdown' export default { name: 'Users', components: { - UsersFilter, + NewAccountDialog, + ModerationDropdown, MultipleUsersMenu, - NewAccountDialog + UsersFilter }, data() { return { @@ -264,29 +177,6 @@ export default { getFirstLetter(str) { return str.charAt(0).toUpperCase() }, - getPasswordResetToken(nickname) { - this.resetPasswordDialogOpen = true - this.$store.dispatch('GetPasswordResetToken', nickname) - }, - requirePasswordReset(nickname) { - const mailerEnabled = this.$store.state.user.nodeInfo.metadata.mailerEnabled - - if (!mailerEnabled) { - this.$alert(this.$t('users.mailerMustBeEnabled'), 'Error', { type: 'error' }) - - return - } - - this.$store.dispatch('RequirePasswordReset', { nickname }) - }, - toggleActivation(user) { - user.deactivated - ? this.$store.dispatch('ActivateUsers', [user]) - : this.$store.dispatch('DeactivateUsers', [user]) - }, - handleDeletion(user) { - this.$store.dispatch('DeleteUsers', [user]) - }, handlePageChange(page) { const searchQuery = this.$store.state.users.searchQuery if (searchQuery === '') { @@ -302,27 +192,8 @@ export default { this.resetPasswordDialogOpen = false this.$store.dispatch('RemovePasswordToken') }, - showAdminAction({ local, id }) { - return local && this.showDeactivatedButton(id) - }, showDeactivatedButton(id) { return this.$store.state.user.id !== id - }, - toggleTag(user, tag) { - user.tags.includes(tag) - ? this.$store.dispatch('RemoveTag', { users: [user], tag }) - : this.$store.dispatch('AddTag', { users: [user], tag }) - }, - toggleUserRight(user, right) { - user.roles[right] - ? this.$store.dispatch('DeleteRight', { users: [user], right }) - : this.$store.dispatch('AddRight', { users: [user], right }) - }, - handleEmailConfirmation(user) { - this.$store.dispatch('ConfirmUsersEmail', [user]) - }, - handleConfirmationResend(user) { - this.$store.dispatch('ResendConfirmationEmail', [user]) } } }