using snake case now, cleaned up some code and style
This commit is contained in:
parent
138dc71b9f
commit
d491bccec4
11 changed files with 354 additions and 352 deletions
|
|
@ -5,44 +5,44 @@ const PageList = {
|
|||
SelectableList
|
||||
},
|
||||
props: {
|
||||
boxOnly: {
|
||||
box_only: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
pageSize: {
|
||||
page_size: {
|
||||
type: Number,
|
||||
default: 50
|
||||
},
|
||||
fetchPage: {
|
||||
fetch_page: {
|
||||
type: Function,
|
||||
default: async () => []
|
||||
},
|
||||
singlePage: {
|
||||
single_page: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
pageIndex: 1,
|
||||
page_index: 1,
|
||||
items: [],
|
||||
canLoadMore: true,
|
||||
can_load_more: true,
|
||||
gliter: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reset () {
|
||||
this.canLoadMore = true
|
||||
this.pageIndex = 1
|
||||
this.can_load_more = true
|
||||
this.page_index = 1
|
||||
this.items = []
|
||||
this.loadMore() // load one page
|
||||
this.load_more() // load one page
|
||||
},
|
||||
loadMore () {
|
||||
load_more () {
|
||||
this.gliter++
|
||||
const iter = this.gliter
|
||||
this.fetchPage(this.$store, {
|
||||
page: this.pageIndex++,
|
||||
pageSize: this.pageSize
|
||||
this.fetch_page(this.$store, {
|
||||
page: this.page_index++,
|
||||
page_size: this.page_size
|
||||
}).then((items) => {
|
||||
// ignore if another request was already dispatched
|
||||
if (iter == this.gliter) {
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
/>
|
||||
</template>
|
||||
</SelectableList>
|
||||
<div v-if="!singlePage">
|
||||
<div v-if="!single_page">
|
||||
<button
|
||||
v-if="canLoadMore"
|
||||
v-if="can_load_more"
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="loadMore"
|
||||
@click="load_more"
|
||||
>
|
||||
{{ $t('page_list.load_more') }}
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import PageList from 'src/components/page_list/page_list.vue'
|
|||
import AdminStatusCard from 'src/components/settings_modal/admin_tabs/admin_status_card.vue'
|
||||
|
||||
const AdminCard = {
|
||||
props: ['userDetails'],
|
||||
props: ['user_details'],
|
||||
data () {
|
||||
return {
|
||||
progress: false,
|
||||
|
|
@ -21,45 +21,45 @@ const AdminCard = {
|
|||
return typeof(this.user) !== 'undefined'
|
||||
},
|
||||
user () {
|
||||
return this.$store.getters.findUser(this.userDetails.id)
|
||||
return this.$store.getters.findUser(this.user_details.id)
|
||||
},
|
||||
relationship () {
|
||||
return this.$store.getters.relationship(this.userDetails.id)
|
||||
return this.$store.getters.relationship(this.user_details.id)
|
||||
},
|
||||
is_local () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
if (typeof(u) !== 'undefined') {
|
||||
return u.is_local === true
|
||||
}
|
||||
return false
|
||||
},
|
||||
is_admin () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
if (typeof(u) !== 'undefined') {
|
||||
return u.rights.admin === true
|
||||
}
|
||||
return false
|
||||
},
|
||||
is_moderator () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
if (typeof(u) !== 'undefined') {
|
||||
return u.rights.moderator === true
|
||||
}
|
||||
return false
|
||||
},
|
||||
is_activated () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
if (typeof(u) !== 'undefined') {
|
||||
return u.deactivated === false
|
||||
}
|
||||
return false
|
||||
},
|
||||
is_confirmed () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
return (u._original.pleroma.is_confirmed === true) || (this.just_confirmed === true)
|
||||
},
|
||||
is_approved () {
|
||||
return (this.userDetails._original.is_approved === true) || (this.just_approved === true)
|
||||
return (this.user_details._original.is_approved === true) || (this.just_approved === true)
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
@ -70,7 +70,7 @@ const AdminCard = {
|
|||
},
|
||||
methods: {
|
||||
toggle_admin (v) {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
if (v === true) {
|
||||
this.$store.dispatch('adminAddUserToAdminGroup', u)
|
||||
} else {
|
||||
|
|
@ -78,7 +78,7 @@ const AdminCard = {
|
|||
}
|
||||
},
|
||||
toggle_moderator (v) {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
if (v === true) {
|
||||
this.$store.dispatch('adminAddUserToModeratorGroup', u)
|
||||
} else {
|
||||
|
|
@ -86,7 +86,7 @@ const AdminCard = {
|
|||
}
|
||||
},
|
||||
toggle_activation (v) {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
if (v === true) {
|
||||
this.$store.dispatch('adminActivateUser', u)
|
||||
} else {
|
||||
|
|
@ -94,30 +94,30 @@ const AdminCard = {
|
|||
}
|
||||
},
|
||||
confirm_user () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
this.$store.dispatch('adminConfirmUser', u)
|
||||
this.just_confirmed = true
|
||||
},
|
||||
resend_confirmation_email () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
this.$store.dispatch('adminResendConfirmationEmail', u)
|
||||
},
|
||||
toggle_approval () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
this.$store.dispatch('adminApproveUser', u)
|
||||
},
|
||||
force_update_user () {
|
||||
this.$store.dispatch('fetchUser', this.userDetails.id)
|
||||
this.$store.dispatch('fetchUser', this.user_details.id)
|
||||
},
|
||||
delete_user () {
|
||||
if (!this.just_deleted) {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
this.$store.dispatch('adminDeleteUser', u)
|
||||
this.just_deleted = true
|
||||
}
|
||||
},
|
||||
fetch_statuses (store, opts) {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
const u = this.$store.getters.findUser(this.user_details.id)
|
||||
const res = store.dispatch('adminListStatuses', { user: u, opts: { page_size: opts.pageSize, godmode: true, with_reblogs: true}})
|
||||
return Promise.resolve(res.then(r => r.activities))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,145 +1,144 @@
|
|||
<!-- eslint-disable -->
|
||||
<template>
|
||||
<div v-if="!just_deleted">
|
||||
<div
|
||||
v-if="!isLoaded"
|
||||
>
|
||||
<div v-if="!isLoaded">
|
||||
{{ $t('admin_dash.users.loading_user') }}
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
>
|
||||
<div v-if="userDetails.id !== this.$store.state.users.currentUser.id">
|
||||
<BasicUserCard :user="user" />
|
||||
<div v-if="!top_level_expanded">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="top_level_expanded = true"
|
||||
>
|
||||
{{ $t('admin_dash.users.expand_user') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="setting-item"
|
||||
v-else
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="top_level_expanded = false"
|
||||
>
|
||||
{{ $t('admin_dash.users.collapse_user') }}
|
||||
</button><br>
|
||||
<div v-if="is_local">
|
||||
<Checkbox
|
||||
:model-value="is_admin"
|
||||
@update:model-value="v => toggle_admin(v)"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_admin') }}
|
||||
</Checkbox><br>
|
||||
<Checkbox
|
||||
:model-value="is_moderator"
|
||||
@update:model-value="v => toggle_moderator(v)"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_moderator') }}
|
||||
</Checkbox><br>
|
||||
<div v-if="!just_confirmed && !is_confirmed">
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="confirm_user()"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_confirmed') }}
|
||||
</button><br>
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="resend_confirmation_email()"
|
||||
>
|
||||
{{ $t('admin_dash.users.resend_confirmation_email') }}
|
||||
</button><br>
|
||||
</div>
|
||||
<div v-if="!is_approved">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="toggle_approval(true)"
|
||||
>
|
||||
{{ $t('admin_dash.users.approve') }}
|
||||
</button><br>
|
||||
</div>
|
||||
</div>
|
||||
<Checkbox
|
||||
:model-value="is_activated"
|
||||
@update:model-value="v => toggle_activation(v)"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_active') }}
|
||||
</Checkbox><br>
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="delete_user()"
|
||||
>
|
||||
{{ $t('admin_dash.users.delete_user') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="!timeline_expanded">
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="timeline_expanded = true"
|
||||
>
|
||||
{{ $t('admin_dash.users.expand_timeline') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="setting-item"
|
||||
v-else
|
||||
>
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="timeline_expanded = false"
|
||||
>
|
||||
{{ $t('admin_dash.users.collapse_timeline') }}
|
||||
</button>
|
||||
<PageList
|
||||
ref="timelineList"
|
||||
:refresh="true"
|
||||
:get-key="i => i"
|
||||
:box-only="true"
|
||||
:page-size="20"
|
||||
:single-page="true"
|
||||
:fetch-page="(store, opts) => this.fetch_statuses(store, opts)"
|
||||
>
|
||||
<template #item="{item}">
|
||||
<AdminStatusCard :status-details="item" />
|
||||
</template>
|
||||
</PageList>
|
||||
</div>
|
||||
<div v-if="!json_expanded"
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="json_expanded = true"
|
||||
>
|
||||
{{ $t('admin_dash.users.expand_raw_info') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="setting-item"
|
||||
v-else
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="user_details.id !== $store.state.users.currentUser.id">
|
||||
<BasicUserCard :user="user" />
|
||||
<div v-if="!top_level_expanded">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="top_level_expanded = true"
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="json_expanded = false"
|
||||
>
|
||||
{{ $t('admin_dash.users.collapse_raw_info') }}
|
||||
</button>
|
||||
<h2> database </h2>
|
||||
<pre> {{ JSON.stringify(user, null, 2) }} </pre>
|
||||
<h2> details </h2>
|
||||
<pre> {{ JSON.stringify(this.userDetails, null, 2) }} </pre>
|
||||
</div>
|
||||
{{ $t('admin_dash.users.expand_user') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="setting-item"
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="top_level_expanded = false"
|
||||
>
|
||||
{{ $t('admin_dash.users.collapse_user') }}
|
||||
</button><br>
|
||||
<div v-if="is_local">
|
||||
<Checkbox
|
||||
:model-value="is_admin"
|
||||
@update:model-value="v => toggle_admin(v)"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_admin') }}
|
||||
</Checkbox><br>
|
||||
<Checkbox
|
||||
:model-value="is_moderator"
|
||||
@update:model-value="v => toggle_moderator(v)"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_moderator') }}
|
||||
</Checkbox><br>
|
||||
<div v-if="!just_confirmed && !is_confirmed">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="confirm_user()"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_confirmed') }}
|
||||
</button><br>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="resend_confirmation_email()"
|
||||
>
|
||||
{{ $t('admin_dash.users.resend_confirmation_email') }}
|
||||
</button><br>
|
||||
</div>
|
||||
<div v-if="!is_approved">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="toggle_approval(true)"
|
||||
>
|
||||
{{ $t('admin_dash.users.approve') }}
|
||||
</button><br>
|
||||
</div>
|
||||
</div>
|
||||
<Checkbox
|
||||
:model-value="is_activated"
|
||||
@update:model-value="v => toggle_activation(v)"
|
||||
>
|
||||
{{ $t('admin_dash.users.is_active') }}
|
||||
</Checkbox><br>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="delete_user()"
|
||||
>
|
||||
{{ $t('admin_dash.users.delete_user') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="!timeline_expanded">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="timeline_expanded = true"
|
||||
>
|
||||
{{ $t('admin_dash.users.expand_timeline') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="setting-item"
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="timeline_expanded = false"
|
||||
>
|
||||
{{ $t('admin_dash.users.collapse_timeline') }}
|
||||
</button>
|
||||
<PageList
|
||||
ref="timelineList"
|
||||
:refresh="true"
|
||||
:get-key="i => i"
|
||||
:box_only="true"
|
||||
:page_size="20"
|
||||
:single_page="true"
|
||||
:fetch_page="(store, opts) => fetch_statuses(store, opts)"
|
||||
>
|
||||
<template #item="{item}">
|
||||
<AdminStatusCard :status_details="item" />
|
||||
</template>
|
||||
</PageList>
|
||||
</div>
|
||||
<div v-if="!json_expanded">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="json_expanded = true"
|
||||
>
|
||||
{{ $t('admin_dash.users.expand_raw_info') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="setting-item"
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="json_expanded = false"
|
||||
>
|
||||
{{ $t('admin_dash.users.collapse_raw_info') }}
|
||||
</button>
|
||||
<h2> {{ $t('admin_dash.users.title_database') }} </h2>
|
||||
<pre> {{ JSON.stringify(user, null, 2) }} </pre>
|
||||
<h2> {{ $t('admin_dash.users.title_details') }} </h2>
|
||||
<pre> {{ JSON.stringify(user_details, null, 2) }} </pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -4,27 +4,27 @@ import StatusBody from 'src/components/status_body/status_body.vue'
|
|||
import { parseStatus } from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||
|
||||
const AdminStatusCard = {
|
||||
props: ['statusDetails'],
|
||||
props: ['status_details'],
|
||||
data () {
|
||||
return {
|
||||
json_expanded: false,
|
||||
statusCache: undefined,
|
||||
status_cache: undefined,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
is_sensitive () {
|
||||
return this.statusDetails.sensitive === true
|
||||
return this.status_details.sensitive === true
|
||||
},
|
||||
visibility () {
|
||||
return this.statusDetails.visibility
|
||||
return this.status_details.visibility
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
change_sensitivity (v) {
|
||||
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.statusDetails.id, sensitive: v }}).then(res => parseStatus(res)).then(p => p).then(s => this.statusCache = s)
|
||||
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.status_details.id, sensitive: v }}).then(res => parseStatus(res)).then(s => this.status_cache = s)
|
||||
},
|
||||
change_visibility (v) {
|
||||
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.statusDetails.id, visibility: v }}).then(res => parseStatus(res)).then(p => p).then(s => this.statusCache = s)
|
||||
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.status_details.id, visibility: v }}).then(res => parseStatus(res)).then(s => this.status_cache = s)
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
@ -33,7 +33,7 @@ const AdminStatusCard = {
|
|||
StatusBody,
|
||||
},
|
||||
mounted () {
|
||||
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.statusDetails.id }}).then(res => parseStatus(res)).then(p => p).then(s => this.statusCache = s)
|
||||
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.status_details.id }}).then(res => parseStatus(res)).then(s => this.status_cache = s)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<template>
|
||||
<div class="setting-item">
|
||||
<h2> {{ $t('admin_dash.users.title_info') }}: </h2>
|
||||
<span> {{ $t('admin_dash.users.status_id') }}: {{ statusDetails.id }} </span>
|
||||
<span> {{ $t('admin_dash.users.created_at') }}: {{ statusDetails.created_at }} </span>
|
||||
<span v-if="typeof(statusDetails.edited_at) !== 'undefined'"> {{ $t('admin_dash.users.edited_at') }}: {{ statusDetails.edited_at }} </span>
|
||||
<span> {{ $t('admin_dash.users.status_id') }}: {{ status_details.id }} </span>
|
||||
<span> {{ $t('admin_dash.users.created_at') }}: {{ status_details.created_at }} </span>
|
||||
<span v-if="typeof(status_details.edited_at) !== 'undefined'"> {{ $t('admin_dash.users.edited_at') }}: {{ status_details.edited_at }} </span>
|
||||
<h2> {{ $t('admin_dash.users.title_content') }}: </h2>
|
||||
<div>
|
||||
<StatusBody
|
||||
v-if="typeof(statusCache) !== 'undefined'"
|
||||
:status="statusCache"
|
||||
v-if="typeof(status_cache) !== 'undefined'"
|
||||
:status="status_cache"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
{{ $t('admin_dash.users.scope_direct') }}
|
||||
</option>
|
||||
</Select><br>
|
||||
<a :href="statusDetails.url"> {{ $t('admin_dash.users.link_source') }} </a>
|
||||
<a :href="status_details.url"> {{ $t('admin_dash.users.link_source') }} </a>
|
||||
<div v-if="!json_expanded">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
|
|
@ -67,8 +67,8 @@
|
|||
>
|
||||
{{ $t('admin_dash.users.collapse_raw_info') }}
|
||||
</button>
|
||||
<h2> details </h2>
|
||||
<pre> {{ JSON.stringify(statusDetails, null, 2) }} </pre>
|
||||
<h2> {{ $t('admin_dash.users.title_details') }} </h2>
|
||||
<pre> {{ JSON.stringify(status_details, null, 2) }} </pre>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -7,147 +7,137 @@ import PageList from 'src/components/page_list/page_list.vue'
|
|||
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
|
||||
|
||||
const UsersTab = {
|
||||
provide () {
|
||||
return {
|
||||
defaultDraftMode: true,
|
||||
defaultSource: 'admin'
|
||||
provide () {
|
||||
return {
|
||||
defaultDraftMode: true,
|
||||
defaultSource: 'admin'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
/* filters must match the filter options below initially, or the ui is gonna have a computer moment
|
||||
* no, i won't fix this
|
||||
* */
|
||||
filters_origin: 'local',
|
||||
filters_activity: 'all',
|
||||
filters_permission: 'all',
|
||||
filters_query: '',
|
||||
filters_name: '',
|
||||
filters_email: '',
|
||||
filters: {
|
||||
local: false,
|
||||
external: false,
|
||||
active: false,
|
||||
need_approval: false,
|
||||
unconfirmed: false,
|
||||
deactivated: false,
|
||||
is_admin: false,
|
||||
is_moderator: false,
|
||||
},
|
||||
expandedUser: null,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Checkbox,
|
||||
Select,
|
||||
BasicUserCard,
|
||||
PageList,
|
||||
ProgressButton,
|
||||
AdminCard,
|
||||
TabSwitcher,
|
||||
},
|
||||
methods: {
|
||||
update_origin (v) {
|
||||
switch (v) {
|
||||
case 'local':
|
||||
this.filters.local = true
|
||||
this.filters.external = false
|
||||
break;
|
||||
case 'external':
|
||||
this.filters.local = false
|
||||
this.filters.external = true
|
||||
break;
|
||||
default:
|
||||
case 'all':
|
||||
this.filters.local = false
|
||||
this.filters.external = false
|
||||
break;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
/* filters must match the filter options below initially, or the ui is gonna have a computer moment
|
||||
* no, i won't fix this
|
||||
* */
|
||||
filters_origin: "all",
|
||||
filters_activity: "all",
|
||||
filters_permission: "all",
|
||||
filters_query: "",
|
||||
filters_name: "",
|
||||
filters_email: "",
|
||||
filters: {
|
||||
local: false,
|
||||
external: false,
|
||||
active: false,
|
||||
need_approval: false,
|
||||
unconfirmed: false,
|
||||
deactivated: false,
|
||||
is_admin: false,
|
||||
is_moderator: false,
|
||||
},
|
||||
expandedUser: null,
|
||||
loading: false
|
||||
this.reset()
|
||||
},
|
||||
update_activity (v) {
|
||||
switch (v) {
|
||||
case 'active':
|
||||
this.filters.active = true
|
||||
this.filters.deactivated = false
|
||||
break;
|
||||
case 'deactivated':
|
||||
this.filters.active = false
|
||||
this.filters.deactivated = true
|
||||
break;
|
||||
default:
|
||||
case 'all':
|
||||
this.filters.active = false
|
||||
this.filters.deactivated = false
|
||||
break;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Checkbox,
|
||||
Select,
|
||||
BasicUserCard,
|
||||
PageList,
|
||||
ProgressButton,
|
||||
AdminCard,
|
||||
TabSwitcher,
|
||||
},
|
||||
methods: {
|
||||
update_origin (v) {
|
||||
switch (v) {
|
||||
case 'local':
|
||||
this.filters.local = true
|
||||
this.filters.external = false
|
||||
break;
|
||||
case 'external':
|
||||
this.filters.local = false
|
||||
this.filters.external = true
|
||||
break;
|
||||
default:
|
||||
case 'all':
|
||||
this.filters.local = false
|
||||
this.filters.external = false
|
||||
break;
|
||||
}
|
||||
this.reset()
|
||||
},
|
||||
update_activity (v) {
|
||||
switch (v) {
|
||||
case 'active':
|
||||
this.filters.active = true
|
||||
this.filters.deactivated = false
|
||||
break;
|
||||
case 'deactivated':
|
||||
this.filters.active = false
|
||||
this.filters.deactivated = true
|
||||
break;
|
||||
default:
|
||||
case 'all':
|
||||
this.filters.active = false
|
||||
this.filters.deactivated = false
|
||||
break;
|
||||
}
|
||||
this.reset()
|
||||
},
|
||||
update_permission (v) {
|
||||
switch (v) {
|
||||
case 'admin':
|
||||
this.filters.is_admin = true
|
||||
this.filters.is_moderator = false
|
||||
break;
|
||||
case 'moderator':
|
||||
this.filters.is_admin = false
|
||||
this.filters.is_moderator = true
|
||||
break;
|
||||
case 'modsnadmins':
|
||||
this.filters.is_admin = true
|
||||
this.filters.is_moderator = true
|
||||
break;
|
||||
default:
|
||||
case 'all':
|
||||
this.filters.is_admin = false
|
||||
this.filters.is_moderator = false
|
||||
break;
|
||||
}
|
||||
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_user () {},
|
||||
fetch_page (store, opts) {
|
||||
opts.query = this.filters_query
|
||||
opts.filters = this.filters
|
||||
opts.name = this.filters_name
|
||||
opts.email = this.filters_email
|
||||
const users = store.dispatch('fetchAdminUsers', opts)
|
||||
return users
|
||||
},
|
||||
reset () {
|
||||
this.$refs.userList.reset()
|
||||
},
|
||||
toggleLocal () {
|
||||
this.filters.local = !this.filters.local
|
||||
this.reset()
|
||||
},
|
||||
activate_selection () {
|
||||
const s = this.$refs.userList.selected()
|
||||
s.forEach(u => this.$store.dispatch('adminActivateUser', this.$store.getters.findUser(u.id)))
|
||||
},
|
||||
deactivate_selection () {
|
||||
const s = this.$refs.userList.selected()
|
||||
s.forEach(u => this.$store.dispatch('adminDeactivateUser', this.$store.getters.findUser(u.id)))
|
||||
},
|
||||
delete_selection () {
|
||||
const s = this.$refs.userList.selected()
|
||||
s.forEach(u => this.$store.dispatch('adminDeleteUser', this.$store.getters.findUser(u.id)))
|
||||
this.reset()
|
||||
this.reset()
|
||||
},
|
||||
update_permission (v) {
|
||||
switch (v) {
|
||||
case 'admin':
|
||||
this.filters.is_admin = true
|
||||
this.filters.is_moderator = false
|
||||
break;
|
||||
case 'moderator':
|
||||
this.filters.is_admin = false
|
||||
this.filters.is_moderator = true
|
||||
break;
|
||||
case 'modsnadmins':
|
||||
this.filters.is_admin = true
|
||||
this.filters.is_moderator = true
|
||||
break;
|
||||
default:
|
||||
case 'all':
|
||||
this.filters.is_admin = false
|
||||
this.filters.is_moderator = false
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.reset()
|
||||
},
|
||||
fetch_page (store, opts) {
|
||||
const users = store.dispatch('fetchAdminUsers', { ...opts, ...{
|
||||
query: this.filters_query,
|
||||
filters: this.filters,
|
||||
name: this.filters_name,
|
||||
email: this.filters_email
|
||||
}})
|
||||
return users
|
||||
},
|
||||
reset () {
|
||||
this.$refs.userList.reset()
|
||||
},
|
||||
activate_selection () {
|
||||
const s = this.$refs.userList.selected()
|
||||
s.forEach(u => this.$store.dispatch('adminActivateUser', this.$store.getters.findUser(u.id)))
|
||||
},
|
||||
deactivate_selection () {
|
||||
const s = this.$refs.userList.selected()
|
||||
s.forEach(u => this.$store.dispatch('adminDeactivateUser', this.$store.getters.findUser(u.id)))
|
||||
},
|
||||
delete_selection () {
|
||||
const s = this.$refs.userList.selected()
|
||||
s.forEach(u => this.$store.dispatch('adminDeleteUser', this.$store.getters.findUser(u.id)))
|
||||
this.reset()
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
/* make sure init state is correct */
|
||||
this.update_origin(this.filters_origin)
|
||||
this.update_activity(this.filters_activity)
|
||||
this.update_permission(this.filters_permission)
|
||||
}
|
||||
}
|
||||
|
||||
export default UsersTab
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
.user-tab {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.stacked-container {
|
||||
/* vite:stylelint complains about this, saying it's not important.
|
||||
this is a mistake: it is important, so vite:stylelint should shut up */
|
||||
display: flex !important;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,24 +2,28 @@
|
|||
<div :label="$t('admin_dash.users.management')">
|
||||
<div class="setting-item">
|
||||
<h2> filter user search </h2>
|
||||
<input
|
||||
v-model="filters_query"
|
||||
:placeholder="$t('admin_dash.users.placeholder_query')"
|
||||
class="input string-input"
|
||||
@input="v => update_query(v.target.value)"
|
||||
><br>
|
||||
<input
|
||||
v-model="filters_name"
|
||||
:placeholder="$t('admin_dash.users.placeholder_name')"
|
||||
class="input string-input"
|
||||
@input="v => update_name(v.target.value)"
|
||||
><br>
|
||||
<input
|
||||
v-model="filters_email"
|
||||
:placeholder="$t('admin_dash.users.placeholder_email')"
|
||||
class="input string-input"
|
||||
@input="v => update_email(v.target.value)"
|
||||
><br>
|
||||
<div
|
||||
class="stacked-container"
|
||||
>
|
||||
<input
|
||||
v-model="filters_query"
|
||||
:placeholder="$t('admin_dash.users.placeholder_query')"
|
||||
class="input string-input"
|
||||
@input="reset()"
|
||||
>
|
||||
<input
|
||||
v-model="filters_name"
|
||||
:placeholder="$t('admin_dash.users.placeholder_name')"
|
||||
class="input string-input"
|
||||
@input="reset()"
|
||||
>
|
||||
<input
|
||||
v-model="filters_email"
|
||||
:placeholder="$t('admin_dash.users.placeholder_email')"
|
||||
class="input string-input"
|
||||
@input="reset()"
|
||||
>
|
||||
</div>
|
||||
<Select
|
||||
:model-value="filters_origin"
|
||||
@update:model-value="v => update_origin(v)"
|
||||
|
|
@ -94,7 +98,7 @@
|
|||
@update:model-value="v => {filters.unconfirmed = v; reset();}"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_unconfirmed') }}
|
||||
</Checkbox><br>
|
||||
</Checkbox>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
|
|
@ -107,9 +111,9 @@
|
|||
ref="userList"
|
||||
:refresh="true"
|
||||
:get-key="i => i"
|
||||
:box-only="true"
|
||||
:page-size="50"
|
||||
:fetch-page="(store, opts) => fetch_page(store, opts)"
|
||||
:box_only="true"
|
||||
:page_size="50"
|
||||
:fetch_page="(store, opts) => fetch_page(store, opts)"
|
||||
>
|
||||
<template #header>
|
||||
<button
|
||||
|
|
@ -135,7 +139,7 @@
|
|||
</button>
|
||||
</template>
|
||||
<template #item="{item}">
|
||||
<AdminCard :user-details="item" />
|
||||
<AdminCard :user_details="item" />
|
||||
</template>
|
||||
</PageList>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1181,9 +1181,11 @@
|
|||
"scope_unlisted": "unlisted",
|
||||
"scope_private": "private",
|
||||
"scope_direct": "direct",
|
||||
"title_info": "info",
|
||||
"title_content": "content",
|
||||
"link_source": "source"
|
||||
"title_info": "Info",
|
||||
"title_content": "Content",
|
||||
"link_source": "source",
|
||||
"title_database": "Database",
|
||||
"title_details": "Details"
|
||||
},
|
||||
"limits": {
|
||||
"arbitrary_limits": "Arbitrary limits",
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/v1/pleroma/admin/config/description
|
|||
const PLEROMA_ADMIN_FRONTENDS_URL = '/api/v1/pleroma/admin/frontends'
|
||||
const PLEROMA_ADMIN_FRONTENDS_INSTALL_URL = '/api/v1/pleroma/admin/frontends/install'
|
||||
const PLEROMA_ADMIN_USERS_URL = '/api/v1/pleroma/admin/users'
|
||||
const PLEROMA_ADMIN_USERS_URL = ({page, pageSize, filters = {}, query = '', name = '', email = ''}) => {
|
||||
const PLEROMA_ADMIN_USERS_URL = ({page, page_size, filters = {}, query = '', name = '', email = ''}) => {
|
||||
const {
|
||||
local = false,
|
||||
external = false,
|
||||
|
|
@ -136,7 +136,7 @@ const PLEROMA_ADMIN_USERS_URL = ({page, pageSize, filters = {}, query = '', name
|
|||
+ (deactivated ? 'deactivated,' : '')
|
||||
+ (is_admin ? 'is_admin,' : '')
|
||||
+ (is_moderator ? 'is_moderator,' : '')
|
||||
return `/api/v1/pleroma/admin/users?page=${page}&page_size=${pageSize}&filters=${filters_str}&query=${query}&name=${name}&email=${email}`
|
||||
return `/api/v1/pleroma/admin/users?page=${page}&page_size=${page_size}&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_CONFIRM_USER_URL = '/api/v1/pleroma/admin/users/confirm_email'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue