diff --git a/src/api/__mocks__/users.js b/src/api/__mocks__/users.js
index 39d08100..646a5dd3 100644
--- a/src/api/__mocks__/users.js
+++ b/src/api/__mocks__/users.js
@@ -1,4 +1,4 @@
-export const users = [
+export let users = [
{ active: true, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [] },
{ active: true, deactivated: false, id: '10', nickname: 'bob', local: false, external: true, roles: { admin: false, moderator: false }, tags: ['sandbox'] },
{ active: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['strip_media'] }
@@ -69,3 +69,9 @@ export async function tagUser(nickname, tag, authHost, token) {
export async function untagUser(nickname, tag, authHost, token) {
return Promise.resolve()
}
+
+export async function createNewAccount(nickname, email, password, authHost, token) {
+ const newUser = { active: true, deactivated: false, id: '15', nickname, local: true, external: false, roles: { admin: false, moderator: false }, tags: [] }
+ users = [...users, newUser]
+ return Promise.resolve()
+}
diff --git a/src/api/users.js b/src/api/users.js
index cdf6476c..a751302a 100644
--- a/src/api/users.js
+++ b/src/api/users.js
@@ -2,33 +2,6 @@ import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'
-export async function fetchUsers(filters, authHost, token, page = 1) {
- return await request({
- baseURL: baseName(authHost),
- url: `/api/pleroma/admin/users?page=${page}&filters=${filters}`,
- method: 'get',
- headers: authHeaders(token)
- })
-}
-
-export async function toggleUserActivation(nickname, authHost, token) {
- return await request({
- baseURL: baseName(authHost),
- url: `/api/pleroma/admin/users/${nickname}/toggle_activation`,
- method: 'patch',
- headers: authHeaders(token)
- })
-}
-
-export async function searchUsers(query, filters, authHost, token, page = 1) {
- return await request({
- baseURL: baseName(authHost),
- url: `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`,
- method: 'get',
- headers: authHeaders(token)
- })
-}
-
export async function addRight(nickname, right, authHost, token) {
return await request({
baseURL: baseName(authHost),
@@ -38,6 +11,16 @@ export async function addRight(nickname, right, authHost, token) {
})
}
+export async function createNewAccount(nickname, email, password, authHost, token) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: '/api/pleroma/admin/users',
+ method: 'post',
+ headers: authHeaders(token),
+ data: { nickname, email, password }
+ })
+}
+
export async function deleteRight(nickname, right, authHost, token) {
return await request({
baseURL: baseName(authHost),
@@ -56,6 +39,24 @@ export async function deleteUser(nickname, authHost, token) {
})
}
+export async function fetchUsers(filters, authHost, token, page = 1) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: `/api/pleroma/admin/users?page=${page}&filters=${filters}`,
+ method: 'get',
+ headers: authHeaders(token)
+ })
+}
+
+export async function searchUsers(query, filters, authHost, token, page = 1) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`,
+ method: 'get',
+ headers: authHeaders(token)
+ })
+}
+
export async function tagUser(nicknames, tags, authHost, token) {
return await request({
baseURL: baseName(authHost),
@@ -66,6 +67,15 @@ export async function tagUser(nicknames, tags, authHost, token) {
})
}
+export async function toggleUserActivation(nickname, authHost, token) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: `/api/pleroma/admin/users/${nickname}/toggle_activation`,
+ method: 'patch',
+ headers: authHeaders(token)
+ })
+}
+
export async function untagUser(nicknames, tags, authHost, token) {
return await request({
baseURL: baseName(authHost),
diff --git a/src/lang/en.js b/src/lang/en.js
index 137426d4..0897740f 100644
--- a/src/lang/en.js
+++ b/src/lang/en.js
@@ -182,16 +182,46 @@ export default {
revokeModerator: 'Revoke Moderator',
grantModerator: 'Grant Moderator',
activateAccount: 'Activate Account',
+ activateAccounts: 'Activate Accounts',
deactivateAccount: 'Deactivate Account',
+ deactivateAccounts: 'Deactivate Accounts',
deleteAccount: 'Delete Account',
+ deleteAccounts: 'Delete Accounts',
forceNsfw: 'Force posts to be NSFW',
stripMedia: 'Force posts not to have media',
forceUnlisted: 'Force posts to be unlisted',
sandbox: 'Force posts to be followers-only',
disableRemoteSubscription: 'Disallow following user from remote instances',
+ disableRemoteSubscriptionForMultiple: 'Disallow following users from remote instances',
disableAnySubscription: 'Disallow following user at all',
+ disableAnySubscriptionForMultiple: 'Disallow following users at all',
selectUsers: 'Select users to apply actions to multiple users',
- moderateUsers: 'Moderate multiple users'
+ moderateUsers: 'Moderate multiple users',
+ createAccount: 'Create new user account',
+ apply: 'apply',
+ remove: 'remove',
+ grantRightConfirmation: 'Are you sure you want to grant {right} rights to all selected users?',
+ revokeRightConfirmation: 'Are you sure you want to revoke {right} rights from all selected users?',
+ activateMultipleUsersConfirmation: 'Are you sure you want to activate accounts of all selected users?',
+ deactivateMultipleUsersConfirmation: 'Are you sure you want to deactivate accounts of all selected users?',
+ deleteMultipleUsersConfirmation: 'Are you sure you want to delete accounts of all selected users?',
+ addTagForMultipleUsersConfirmation: 'Are you sure you want to apply tag to all selected users?',
+ removeTagFromMultipleUsersConfirmation: 'Are you sure you want to remove tag from all selected users?',
+ ok: 'Okay',
+ completed: 'Completed',
+ cancel: 'Cancel',
+ canceled: 'Canceled',
+ username: 'Username',
+ email: 'E-mail',
+ password: 'Password',
+ create: 'Create',
+ submitFormError: 'There are errors on the form. Please fix them before continuing.',
+ emptyEmailError: 'Please input the e-mail',
+ invalidEmailError: 'Please input valid e-mail',
+ emptyPasswordError: 'Please input the password',
+ emptyNicknameError: 'Please input the username',
+ invalidNicknameError: 'Username can include "a-z", "A-Z" and "0-9" characters'
+
},
usersFilter: {
inputPlaceholder: 'Select filter',
diff --git a/src/store/modules/users.js b/src/store/modules/users.js
index 22c450d6..80fb0c22 100644
--- a/src/store/modules/users.js
+++ b/src/store/modules/users.js
@@ -1,4 +1,4 @@
-import { addRight, fetchUsers, deleteRight, deleteUser, searchUsers, tagUser, toggleUserActivation, untagUser } from '@/api/users'
+import { addRight, createNewAccount, fetchUsers, deleteRight, deleteUser, searchUsers, tagUser, toggleUserActivation, untagUser } from '@/api/users'
const users = {
state: {
@@ -61,6 +61,10 @@ const users = {
commit('CLEAR_USERS_FILTERS')
dispatch('SearchUsers', { query: state.searchQuery, page: 1 })
},
+ async CreateNewAccount({ dispatch, getters, state }, { nickname, email, password }) {
+ await createNewAccount(nickname, email, password, getters.authHost, getters.token)
+ dispatch('FetchUsers', { page: state.currentPage })
+ },
async DeleteUser({ commit, getters }, user) {
await deleteUser(user.nickname, getters.authHost, getters.token)
const updatedUser = { ...user, deactivated: true }
@@ -83,7 +87,7 @@ const users = {
async SearchUsers({ commit, dispatch, state, getters }, { query, page }) {
if (query.length === 0) {
commit('SET_SEARCH_QUERY', query)
- dispatch('FetchUsers', page)
+ dispatch('FetchUsers', { page })
} else {
commit('SET_LOADING', true)
commit('SET_SEARCH_QUERY', query)
diff --git a/src/views/users/components/DropdownActionsMenu.vue b/src/views/users/components/MultipleUsersMenu.vue
similarity index 79%
rename from src/views/users/components/DropdownActionsMenu.vue
rename to src/views/users/components/MultipleUsersMenu.vue
index e310ed6f..96b76ace 100644
--- a/src/views/users/components/DropdownActionsMenu.vue
+++ b/src/views/users/components/MultipleUsersMenu.vue
@@ -29,22 +29,26 @@