more stuff added
This commit is contained in:
parent
a022ba942f
commit
064093c670
6 changed files with 101 additions and 20 deletions
|
|
@ -54,10 +54,12 @@ const AdminCard = {
|
|||
return false
|
||||
},
|
||||
is_confirmed () {
|
||||
return (this.userDetails.is_confirmed === false) || (this.just_confirmed === true)
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
return (u._original.pleroma.is_confirmed === false) || (this.just_confirmed === true)
|
||||
},
|
||||
is_approved () {
|
||||
return (this.userDetails.is_approved === false) || (this.just_approved === true)
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
return (u._original.pleroma.is_approved === false) || (this.just_approved === true)
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
@ -90,7 +92,15 @@ const AdminCard = {
|
|||
this.$store.dispatch('adminDeactivateUser', u)
|
||||
}
|
||||
},
|
||||
toggle_confirmation () {},
|
||||
confirm_user () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
this.$store.dispatch('adminConfirmUser', u)
|
||||
this.just_confirmed = true
|
||||
},
|
||||
resend_confirmation_email () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
this.$store.dispatch('adminResendConfirmationEmail', u)
|
||||
},
|
||||
toggle_approval () {},
|
||||
force_update_user () {
|
||||
this.$store.dispatch('fetchUser', this.userDetails.id)
|
||||
|
|
|
|||
|
|
@ -70,12 +70,20 @@
|
|||
>
|
||||
is moderator
|
||||
</Checkbox><br>
|
||||
<Checkbox
|
||||
:model-value="is_confirmed"
|
||||
@update:model-value="v => toggle_confirmation(v)"
|
||||
>
|
||||
<div v-if="!just_confirmed && !is_confirmed">
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="confirm_user()"
|
||||
>
|
||||
is confirmed
|
||||
</Checkbox><br>
|
||||
</button><br>
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="resend_confirmation_email()"
|
||||
>
|
||||
resend confirmation email
|
||||
</button><br>
|
||||
</div>
|
||||
<Checkbox
|
||||
:model-value="is_approved"
|
||||
@update:model-value="v => toggle_approval(v)"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ const UsersTab = {
|
|||
filters_origin: "local",
|
||||
filters_activity: "all",
|
||||
filters_permission: "all",
|
||||
filters_query: '',
|
||||
filters_name: '',
|
||||
filters_email: '',
|
||||
filters: {
|
||||
local: true,
|
||||
external: false,
|
||||
|
|
@ -30,7 +33,7 @@ const UsersTab = {
|
|||
unconfirmed: false,
|
||||
deactivated: false,
|
||||
is_admin: false,
|
||||
is_moderator: false
|
||||
is_moderator: false,
|
||||
},
|
||||
expandedUser: null,
|
||||
loading: false
|
||||
|
|
@ -106,14 +109,26 @@ const UsersTab = {
|
|||
}
|
||||
this.reset()
|
||||
},
|
||||
update_query (v) {
|
||||
this.filters_query = v
|
||||
this.reset()
|
||||
},
|
||||
update_name (v) {
|
||||
this.filters_name = v
|
||||
this.reset()
|
||||
},
|
||||
update_email (v) {
|
||||
this.filters_email = v
|
||||
this.reset()
|
||||
},
|
||||
delete_selection () {
|
||||
},
|
||||
delete_user () {},
|
||||
fetch_page (store, opts) {
|
||||
opts.query = ""
|
||||
opts.query = this.filters_query
|
||||
opts.filters = this.filters
|
||||
opts.name = ""
|
||||
opts.email = ""
|
||||
opts.name = this.filters_name
|
||||
opts.email = this.filters_email
|
||||
const users = store.dispatch('fetchAdminUsers', opts)
|
||||
return users
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,9 +8,24 @@
|
|||
<div class="setting-item">
|
||||
<h2> filter user search </h2>
|
||||
todo: query, name and email input<br>
|
||||
<input
|
||||
:model-value="filters_query"
|
||||
placeholder="query"
|
||||
@input="v => update_query(v.target.value)"
|
||||
/><br>
|
||||
<input
|
||||
:model-value="filters_name"
|
||||
placeholder="name"
|
||||
@input="v => update_name(v.target.value)"
|
||||
/><br>
|
||||
<input
|
||||
:model-value="filters_email"
|
||||
placeholder="email"
|
||||
@input="v => update_email(v.target.value)"
|
||||
/><br>
|
||||
<Select
|
||||
:model-value="filters_origin"
|
||||
@update:model-value="v => update_origin(v) "
|
||||
@update:model-value="v => update_origin(v)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
|
|
@ -30,7 +45,7 @@
|
|||
</Select>
|
||||
<Select
|
||||
:model-value="filters_activity"
|
||||
@update:model-value="v => update_activity(v) "
|
||||
@update:model-value="v => update_activity(v)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
|
|
@ -50,7 +65,7 @@
|
|||
</Select>
|
||||
<Select
|
||||
:model-value="filters_permission"
|
||||
@update:model-value="v => update_permission(v) "
|
||||
@update:model-value="v => update_permission(v)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
|
|
|
|||
|
|
@ -85,15 +85,21 @@ const adminSettingsStorage = {
|
|||
},
|
||||
adminActivateUser (store, user) {
|
||||
return store.rootState.api.backendInteractor.activateUser({ user })
|
||||
.then(res => console.log(res))
|
||||
.then(res => { const deactivated = !res.is_active; store.commit('updateActivationStatus', { user, deactivated })})
|
||||
},
|
||||
adminDeactivateUser (store, user) {
|
||||
return store.rootState.api.backendInteractor.deactivateUser({ user })
|
||||
.then(res => console.log(res))
|
||||
.then(res => { const deactivated = !res.is_active; store.commit('updateActivationStatus', { user, deactivated })})
|
||||
},
|
||||
adminDeleteUser (store, user) {
|
||||
return store.rootState.api.backendInteractor.deleteUser({ user })
|
||||
.then(res => console.log(res))
|
||||
},
|
||||
adminConfirmUser (store, user) {
|
||||
return store.rootState.api.backendInteractor.adminConfirmUser({ user })
|
||||
.then(res => store.dispatch('fetchUser', user.id))
|
||||
},
|
||||
adminResendConfirmationEmail (store, user) {
|
||||
return store.rootState.api.backendInteractor.adminResendConfirmationEmail({ user })
|
||||
},
|
||||
loadFrontendsStuff ({ rootState, commit }) {
|
||||
rootState.api.backendInteractor.fetchAvailableFrontends()
|
||||
|
|
|
|||
|
|
@ -137,9 +137,11 @@ const PLEROMA_ADMIN_USERS_URL = ({page, pageSize, filters = {}, query = '', name
|
|||
return `/api/v1/pleroma/admin/users?page=${page}&page_size=${pageSize}&filters=${filters_str}&query=${query}&name=${name}&email=${email}`
|
||||
}
|
||||
const PLEROMA_ADMIN_MODIFY_GROUP_URL = (nickname, group) => `/api/v1/pleroma/admin/users/${nickname}/permission_group/${group}`
|
||||
const PLEROMA_ADMIN_DELETE_USERS_URL = '/api/v1/pleroma/admin/users'
|
||||
/*const PLEROMA_ADMIN_DELETE_USERS_URL = '/api/v1/pleroma/admin/users'
|
||||
const PLEROMA_ADMIN_ACTIVATE_USER_URL = '/api/v1/pleroma/admin/users/activate'
|
||||
const PLEROMA_ADMIN_DEACTIVATE_USER_URL = '/api/v1/pleroma/admin/users/deactivate'
|
||||
const PLEROMA_ADMIN_DEACTIVATE_USER_URL = '/api/v1/pleroma/admin/users/deactivate'*/
|
||||
const PLEROMA_ADMIN_CONFIRM_USER_URL = '/api/v1/pleroma/admin/users/confirm_email'
|
||||
const PLEROMA_ADMIN_RESEND_CONFIRMATION_EMAIL_URL = '/api/v1/pleroma/admin/users/resend_confirmation_email'
|
||||
|
||||
const PLEROMA_EMOJI_RELOAD_URL = '/api/pleroma/admin/reload_emoji'
|
||||
const PLEROMA_EMOJI_IMPORT_FS_URL = '/api/pleroma/emoji/packs/import'
|
||||
|
|
@ -1508,6 +1510,29 @@ const adminRemoveUserFromModeratorGroup = ({ user, credentials }) => {
|
|||
})
|
||||
}
|
||||
|
||||
const adminConfirmUser = ({user: { screen_name: nickname }, credentials }) => {
|
||||
const url = PLEROMA_ADMIN_CONFIRM_USER_URL
|
||||
console.log('confirming')
|
||||
return promisedRequest({url: url,
|
||||
credentials,
|
||||
method: 'PATCH',
|
||||
payload: {
|
||||
nicknames: [nickname]
|
||||
}
|
||||
}).then(res => console.log('response', res))
|
||||
}
|
||||
|
||||
const adminResendConfirmationEmail = ({user: { screen_name: nickname }, credentials }) => {
|
||||
const url = PLEROMA_ADMIN_RESEND_CONFIRMATION_EMAIL_URL
|
||||
return promisedRequest({url: url,
|
||||
credentials,
|
||||
method: 'PATCH',
|
||||
payload: {
|
||||
nicknames: [nickname]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const announcementToPayload = ({ content, startsAt, endsAt, allDay }) => {
|
||||
const payload = { content }
|
||||
|
||||
|
|
@ -2185,6 +2210,8 @@ const apiService = {
|
|||
adminRemoveUserFromAdminGroup,
|
||||
adminAddUserToModeratorGroup,
|
||||
adminRemoveUserFromModeratorGroup,
|
||||
adminConfirmUser,
|
||||
adminResendConfirmationEmail,
|
||||
}
|
||||
|
||||
export default apiService
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue