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