tested everything so far, fixed identation, fixed some bugs and added i18n entries
This commit is contained in:
parent
fee857e6b2
commit
42236b0c76
12 changed files with 506 additions and 238 deletions
|
|
@ -17,14 +17,18 @@ const PageList = {
|
|||
fetchPage: {
|
||||
type: Function,
|
||||
default: async () => []
|
||||
},
|
||||
singlePage: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
pageIndex: 1,
|
||||
items: [],
|
||||
selected: [],
|
||||
canLoadMore: true
|
||||
canLoadMore: true,
|
||||
gliter: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -35,12 +39,21 @@ const PageList = {
|
|||
this.loadMore() // load one page
|
||||
},
|
||||
loadMore () {
|
||||
this.gliter++
|
||||
const iter = this.gliter
|
||||
this.fetchPage(this.$store, {
|
||||
page: this.pageIndex++,
|
||||
pageSize: this.pageSize
|
||||
}).then((items) => this.items = [...this.items, ...items])
|
||||
// fetch page, add to items
|
||||
//this.$forceUpdate()
|
||||
}).then((items) => {
|
||||
// ignore if another request was already dispatched
|
||||
if (iter == this.gliter) {
|
||||
console.log('items', items)
|
||||
this.items = [...this.items, ...items]
|
||||
}
|
||||
})
|
||||
},
|
||||
selected () {
|
||||
return this.$refs.list.selected
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
|
|
|||
|
|
@ -1,26 +1,35 @@
|
|||
<template>
|
||||
<div class="page-list">
|
||||
<SelectableList
|
||||
:box-only="true"
|
||||
:get-key="i => i"
|
||||
:items="items"
|
||||
ref="list"
|
||||
:box-only="true"
|
||||
:get-key="i => i"
|
||||
:items="items"
|
||||
>
|
||||
<template v-slot:header="slotProps">
|
||||
<slot name="header" v-bind="slotProps"/>
|
||||
</template>
|
||||
<template v-slot:item="slotProps">
|
||||
<slot name="item" v-bind="slotProps"/>
|
||||
<template #header="slotProps">
|
||||
<slot
|
||||
name="header"
|
||||
v-bind="slotProps"
|
||||
/>
|
||||
</template>
|
||||
<template #item="slotProps">
|
||||
<slot
|
||||
name="item"
|
||||
v-bind="slotProps"
|
||||
/>
|
||||
</template>
|
||||
</SelectableList>
|
||||
<button
|
||||
v-if="canLoadMore"
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="loadMore"
|
||||
>
|
||||
{{ $t('page_list.load_more') }}
|
||||
</button>
|
||||
<p> prev first next </p>
|
||||
<div v-if="!singlePage">
|
||||
<button
|
||||
v-if="canLoadMore"
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="loadMore"
|
||||
>
|
||||
{{ $t('page_list.load_more') }}
|
||||
</button>
|
||||
<p> prev first next </p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import BasicUserCard from '../../basic_user_card/basic_user_card.vue'
|
||||
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
||||
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'],
|
||||
|
|
@ -8,6 +10,7 @@ const AdminCard = {
|
|||
progress: false,
|
||||
top_level_expanded: false,
|
||||
json_expanded: false,
|
||||
timeline_expanded: false,
|
||||
just_approved: false,
|
||||
just_confirmed: false,
|
||||
just_deleted: false,
|
||||
|
|
@ -55,16 +58,17 @@ const AdminCard = {
|
|||
},
|
||||
is_confirmed () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
return (u._original.pleroma.is_confirmed === false) || (this.just_confirmed === true)
|
||||
return (u._original.pleroma.is_confirmed === true) || (this.just_confirmed === true)
|
||||
},
|
||||
is_approved () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
return (u._original.pleroma.is_approved === false) || (this.just_approved === true)
|
||||
return (this.userDetails._original.is_approved === true) || (this.just_approved === true)
|
||||
}
|
||||
},
|
||||
components: {
|
||||
BasicUserCard,
|
||||
Checkbox
|
||||
Checkbox,
|
||||
PageList,
|
||||
AdminStatusCard,
|
||||
},
|
||||
methods: {
|
||||
toggle_admin (v) {
|
||||
|
|
@ -101,7 +105,10 @@ const AdminCard = {
|
|||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
this.$store.dispatch('adminResendConfirmationEmail', u)
|
||||
},
|
||||
toggle_approval () {},
|
||||
toggle_approval () {
|
||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||
this.$store.dispatch('adminApproveUser', u)
|
||||
},
|
||||
force_update_user () {
|
||||
this.$store.dispatch('fetchUser', this.userDetails.id)
|
||||
},
|
||||
|
|
@ -111,6 +118,11 @@ const AdminCard = {
|
|||
this.$store.dispatch('adminDeleteUser', u)
|
||||
this.just_deleted = true
|
||||
}
|
||||
},
|
||||
fetch_statuses (store, opts) {
|
||||
const u = this.$store.getters.findUser(this.userDetails.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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,106 +4,115 @@
|
|||
<div
|
||||
v-if="!isLoaded"
|
||||
>
|
||||
loading user...
|
||||
{{ $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 class="admin-card-content-container">
|
||||
<!--<button
|
||||
v-if="muted"
|
||||
class="btn button-default"
|
||||
:disabled="progress"
|
||||
@click="unmuteUser"
|
||||
>
|
||||
<template v-if="progress">
|
||||
{{ $t('user_card.unmute_progress') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t('user_card.unmute') }}
|
||||
</template>
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
class="btn button-default"
|
||||
:disabled="progress"
|
||||
@click="muteUser"
|
||||
>
|
||||
<template v-if="progress">
|
||||
{{ $t('user_card.mute_progress') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t('user_card.mute') }}
|
||||
</template>
|
||||
</button>-->
|
||||
</div>
|
||||
</BasicUserCard>
|
||||
<BasicUserCard :user="user" />
|
||||
<div v-if="!top_level_expanded">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="top_level_expanded = true"
|
||||
>
|
||||
expand user
|
||||
{{ $t('admin_dash.users.expand_user') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div
|
||||
class="setting-item"
|
||||
v-else
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="top_level_expanded = false"
|
||||
>
|
||||
collapse user
|
||||
{{ $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)"
|
||||
>
|
||||
is admin
|
||||
{{ $t('admin_dash.users.is_admin') }}
|
||||
</Checkbox><br>
|
||||
<Checkbox
|
||||
:model-value="is_moderator"
|
||||
@update:model-value="v => toggle_moderator(v)"
|
||||
>
|
||||
is moderator
|
||||
{{ $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()"
|
||||
>
|
||||
is confirmed
|
||||
{{ $t('admin_dash.users.is_confirmed') }}
|
||||
</button><br>
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="resend_confirmation_email()"
|
||||
>
|
||||
resend confirmation email
|
||||
{{ $t('admin_dash.users.resend_confirmation_email') }}
|
||||
</button><br>
|
||||
</div>
|
||||
<Checkbox
|
||||
:model-value="is_approved"
|
||||
@update:model-value="v => toggle_approval(v)"
|
||||
<div v-if="!is_approved">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="toggle_approval(true)"
|
||||
>
|
||||
is approved
|
||||
</Checkbox><br>
|
||||
{{ $t('admin_dash.users.approve') }}
|
||||
</button><br>
|
||||
</div>
|
||||
</div>
|
||||
<Checkbox
|
||||
:model-value="is_activated"
|
||||
@update:model-value="v => toggle_activation(v)"
|
||||
>
|
||||
is active
|
||||
{{ $t('admin_dash.users.is_active') }}
|
||||
</Checkbox><br>
|
||||
<button class="button button-default btn"
|
||||
type="button"
|
||||
@click="delete_user()"
|
||||
>
|
||||
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
|
||||
|
|
@ -111,16 +120,19 @@
|
|||
type="button"
|
||||
@click="json_expanded = true"
|
||||
>
|
||||
expand raw info
|
||||
{{ $t('admin_dash.users.expand_raw_info') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div
|
||||
class="setting-item"
|
||||
v-else
|
||||
>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="json_expanded = false"
|
||||
>
|
||||
collapse raw info
|
||||
{{ $t('admin_dash.users.collapse_raw_info') }}
|
||||
</button>
|
||||
<h2> database </h2>
|
||||
<pre> {{ JSON.stringify(user, null, 2) }} </pre>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
||||
import Select from 'src/components/select/select.vue'
|
||||
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'],
|
||||
data () {
|
||||
return {
|
||||
json_expanded: false,
|
||||
statusCache: undefined,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
is_sensitive () {
|
||||
return this.statusDetails.sensitive === true
|
||||
},
|
||||
visibility () {
|
||||
return this.statusDetails.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)
|
||||
},
|
||||
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)
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Checkbox,
|
||||
Select,
|
||||
StatusBody,
|
||||
},
|
||||
mounted () {
|
||||
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.statusDetails.id }}).then(res => parseStatus(res)).then(p => p).then(s => this.statusCache = s)
|
||||
}
|
||||
}
|
||||
|
||||
export default AdminStatusCard
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<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>
|
||||
<h2> {{ $t('admin_dash.users.title_content') }}: </h2>
|
||||
<div>
|
||||
<StatusBody
|
||||
v-if="typeof(statusCache) !== 'undefined'"
|
||||
:status="statusCache"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="delete_status(status.id)"
|
||||
>
|
||||
{{ $t('admin_dash.users.delete_status') }}
|
||||
</button><br>
|
||||
<Checkbox
|
||||
:model-value="is_sensitive"
|
||||
@update:model-value="v => change_sensitivity(v)"
|
||||
>
|
||||
{{ $t('admin_dash.users.content_nsfw') }}
|
||||
</Checkbox>
|
||||
<Select
|
||||
:model-value="visibility"
|
||||
@update:model-value="v => change_visibility(v)"
|
||||
>
|
||||
<option
|
||||
value="public"
|
||||
>
|
||||
{{ $t('admin_dash.users.scope_public') }}
|
||||
</option>
|
||||
<option
|
||||
value="unlisted"
|
||||
>
|
||||
{{ $t('admin_dash.users.scope_unlisted') }}
|
||||
</option>
|
||||
<option
|
||||
value="private"
|
||||
>
|
||||
{{ $t('admin_dash.users.scope_private') }}
|
||||
</option>
|
||||
<option
|
||||
value="direct"
|
||||
>
|
||||
{{ $t('admin_dash.users.scope_direct') }}
|
||||
</option>
|
||||
</Select><br>
|
||||
<a :href="statusDetails.url"> {{ $t('admin_dash.users.link_source') }} </a>
|
||||
<div v-if="!json_expanded">
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="json_expanded = !json_expanded"
|
||||
>
|
||||
{{ $t('admin_dash.users.expand_raw_info') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="json_expanded = !json_expanded"
|
||||
>
|
||||
{{ $t('admin_dash.users.collapse_raw_info') }}
|
||||
</button>
|
||||
<h2> details </h2>
|
||||
<pre> {{ JSON.stringify(statusDetails, null, 2) }} </pre>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./admin_status_card.js"></script>
|
||||
|
|
@ -19,14 +19,14 @@ const UsersTab = {
|
|||
/* 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_origin: "all",
|
||||
filters_activity: "all",
|
||||
filters_permission: "all",
|
||||
filters_query: '',
|
||||
filters_name: '',
|
||||
filters_email: '',
|
||||
filters_query: "",
|
||||
filters_name: "",
|
||||
filters_email: "",
|
||||
filters: {
|
||||
local: true,
|
||||
local: false,
|
||||
external: false,
|
||||
active: false,
|
||||
need_approval: false,
|
||||
|
|
@ -121,8 +121,6 @@ const UsersTab = {
|
|||
this.filters_email = v
|
||||
this.reset()
|
||||
},
|
||||
delete_selection () {
|
||||
},
|
||||
delete_user () {},
|
||||
fetch_page (store, opts) {
|
||||
opts.query = this.filters_query
|
||||
|
|
@ -138,9 +136,21 @@ const UsersTab = {
|
|||
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()
|
||||
console.log(s)
|
||||
s.forEach(u => this.$store.dispatch('adminDeleteUser', this.$store.getters.findUser(u.id)))
|
||||
this.reset()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,145 +1,144 @@
|
|||
<!-- eslint-disable -->
|
||||
<template>
|
||||
<TabSwitcher
|
||||
:scrollable-tabs="false"
|
||||
class="user-tab"
|
||||
<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>
|
||||
<Select
|
||||
:model-value="filters_origin"
|
||||
@update:model-value="v => update_origin(v)"
|
||||
>
|
||||
<div :label="$t('admin_dash.users.management')">
|
||||
<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)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
>
|
||||
all
|
||||
</option>
|
||||
<option
|
||||
value="local"
|
||||
>
|
||||
local only
|
||||
</option>
|
||||
<option
|
||||
value="external"
|
||||
>
|
||||
external only
|
||||
</option>
|
||||
</Select>
|
||||
<Select
|
||||
:model-value="filters_activity"
|
||||
@update:model-value="v => update_activity(v)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
>
|
||||
all
|
||||
</option>
|
||||
<option
|
||||
value="active"
|
||||
>
|
||||
active only
|
||||
</option>
|
||||
<option
|
||||
value="deactivated"
|
||||
>
|
||||
deactivated only
|
||||
</option>
|
||||
</Select>
|
||||
<Select
|
||||
:model-value="filters_permission"
|
||||
@update:model-value="v => update_permission(v)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
>
|
||||
all
|
||||
</option>
|
||||
<option
|
||||
value="admin"
|
||||
>
|
||||
admin only
|
||||
</option>
|
||||
<option
|
||||
value="modsnadmins"
|
||||
>
|
||||
all privileged
|
||||
</option>
|
||||
<option
|
||||
value="moderator"
|
||||
>
|
||||
moderator only
|
||||
</option>
|
||||
</Select>
|
||||
<Checkbox
|
||||
@update:model-value="v => {filters.need_approval = v; reset();}"
|
||||
>
|
||||
only unapproved
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
@update:model-value="v => {filters.unconfirmed = v; reset();}"
|
||||
>
|
||||
only unconfirmed
|
||||
</Checkbox>
|
||||
</div>
|
||||
<PageList
|
||||
ref="userList"
|
||||
:refresh="true"
|
||||
:get-key="i => i"
|
||||
:box-only="true"
|
||||
:page-size="50"
|
||||
:fetch-page="(store, opts) => this.fetch_page(store, opts)"
|
||||
>
|
||||
<template #header>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="delete_selection"
|
||||
>
|
||||
{{ $t('admin_dash.users.activate') }}
|
||||
</button>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="activate_selection"
|
||||
>
|
||||
{{ $t('admin_dash.users.deactivate') }}
|
||||
</button>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="deactivate_selection"
|
||||
>
|
||||
{{ $t('admin_dash.users.delete') }}
|
||||
</button>
|
||||
</template>
|
||||
<template #item="{item}">
|
||||
<AdminCard :user-details="item" />
|
||||
</template>
|
||||
</PageList>
|
||||
</div>
|
||||
|
||||
<div :label="$t('admin_dash.users.invitations')">
|
||||
TBC
|
||||
</div>
|
||||
</TabSwitcher>
|
||||
<option
|
||||
value="all"
|
||||
>
|
||||
{{ $t('admin_dash.users.all') }}
|
||||
</option>
|
||||
<option
|
||||
value="local"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_local') }}
|
||||
</option>
|
||||
<option
|
||||
value="external"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_external') }}
|
||||
</option>
|
||||
</Select>
|
||||
<Select
|
||||
:model-value="filters_activity"
|
||||
@update:model-value="v => update_activity(v)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
>
|
||||
{{ $t('admin_dash.users.all') }}
|
||||
</option>
|
||||
<option
|
||||
value="active"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_active') }}
|
||||
</option>
|
||||
<option
|
||||
value="deactivated"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_deactivated') }}
|
||||
</option>
|
||||
</Select>
|
||||
<Select
|
||||
:model-value="filters_permission"
|
||||
@update:model-value="v => update_permission(v)"
|
||||
>
|
||||
<option
|
||||
value="all"
|
||||
>
|
||||
{{ $t('admin_dash.users.all') }}
|
||||
</option>
|
||||
<option
|
||||
value="admin"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_administrators') }}
|
||||
</option>
|
||||
<option
|
||||
value="modsnadmins"
|
||||
>
|
||||
{{ $t('admin_dash.users.all_privileged') }}
|
||||
</option>
|
||||
<option
|
||||
value="moderator"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_moderators') }}
|
||||
</option>
|
||||
</Select>
|
||||
<Checkbox
|
||||
@update:model-value="v => {filters.need_approval = v; reset();}"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_unapproved') }}
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
@update:model-value="v => {filters.unconfirmed = v; reset();}"
|
||||
>
|
||||
{{ $t('admin_dash.users.only_unconfirmed') }}
|
||||
</Checkbox><br>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="reset"
|
||||
>
|
||||
{{ $t('admin_dash.users.refresh') }}
|
||||
</button>
|
||||
</div>
|
||||
<PageList
|
||||
ref="userList"
|
||||
:refresh="true"
|
||||
:get-key="i => i"
|
||||
:box-only="true"
|
||||
:page-size="50"
|
||||
:fetch-page="(store, opts) => fetch_page(store, opts)"
|
||||
>
|
||||
<template #header>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="activate_selection"
|
||||
>
|
||||
{{ $t('admin_dash.users.activate') }}
|
||||
</button>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="deactivate_selection"
|
||||
>
|
||||
{{ $t('admin_dash.users.deactivate') }}
|
||||
</button>
|
||||
<button
|
||||
class="button button-default btn"
|
||||
type="button"
|
||||
@click="delete_selection"
|
||||
>
|
||||
{{ $t('admin_dash.users.delete') }}
|
||||
</button>
|
||||
</template>
|
||||
<template #item="{item}">
|
||||
<AdminCard :user-details="item" />
|
||||
</template>
|
||||
</PageList>
|
||||
</div>
|
||||
</template>
|
||||
<script src="./users_tab.js"></script>
|
||||
<style lang="scss" src="./users_tab.scss"></style>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ const StatusContent = {
|
|||
'toggleShowingLongSubject'
|
||||
],
|
||||
data () {
|
||||
//console.log('status_content', this.status)
|
||||
return {
|
||||
postLength: this.status.text.length,
|
||||
parseReadyDone: false
|
||||
|
|
|
|||
|
|
@ -1139,19 +1139,51 @@
|
|||
},
|
||||
"users": {
|
||||
"management": "Management",
|
||||
"invitations": "Invitations",
|
||||
"search_users": "Search for users...",
|
||||
"filters": {
|
||||
"show_all": "show all",
|
||||
"active_only": "active only",
|
||||
"inactive_only": "inactive only",
|
||||
"local_only": "local only",
|
||||
"external_only": "external only"
|
||||
},
|
||||
"loading": "Loading...",
|
||||
"deactivate": "deactivate",
|
||||
"placeholder_query": "query",
|
||||
"placeholder_name": "name",
|
||||
"placeholder_email": "email",
|
||||
"all": "all",
|
||||
"only_local": "local only",
|
||||
"only_external": "external only",
|
||||
"only_active": "active only",
|
||||
"only_deactivated": "deactivated only",
|
||||
"only_administrators": "admin only",
|
||||
"all_privileged": "all privileged",
|
||||
"only_moderators": "moderators only",
|
||||
"only_unapproved": "unapproved only",
|
||||
"only_unconfirmed": "unconfirmed only",
|
||||
"refresh": "refresh",
|
||||
"activate": "activate",
|
||||
"delete": "delete"
|
||||
"deactivate": "deactivate",
|
||||
"delete": "delete",
|
||||
"loading_user": "Loading user...",
|
||||
"expand_user": "expand user",
|
||||
"collapse_user": "collapse user",
|
||||
"is_admin": "is admin",
|
||||
"is_moderator": "is moderator",
|
||||
"is_confirmed": "is confirmed",
|
||||
"resend_confirmation_email": "resend confirmation email",
|
||||
"approve": "approve",
|
||||
"is_active": "is active",
|
||||
"delete_user": "delete user",
|
||||
"expand_timeline": "expand timeline",
|
||||
"collapse_timeline": "collapse timeline",
|
||||
"expand_raw_info": "expand raw info",
|
||||
"collapse_raw_info": "collapse raw info",
|
||||
"status_id": "status ID",
|
||||
"created_at": "created at",
|
||||
"edited_at": "edited at",
|
||||
"delete_status": "delete status",
|
||||
"content_nsfw": "content marked sensitive",
|
||||
"scope_public": "public",
|
||||
"scope_unlisted": "unlisted",
|
||||
"scope_private": "private",
|
||||
"scope_direct": "direct",
|
||||
"title_info": "info",
|
||||
"title_content": "content",
|
||||
"link_source": "source"
|
||||
},
|
||||
"limits": {
|
||||
"arbitrary_limits": "Arbitrary limits",
|
||||
|
|
|
|||
|
|
@ -96,11 +96,20 @@ const adminSettingsStorage = {
|
|||
},
|
||||
adminConfirmUser (store, user) {
|
||||
return store.rootState.api.backendInteractor.adminConfirmUser({ user })
|
||||
.then(res => store.dispatch('fetchUser', user.id))
|
||||
.then(() => store.dispatch('fetchUser', user.id))
|
||||
},
|
||||
adminResendConfirmationEmail (store, user) {
|
||||
return store.rootState.api.backendInteractor.adminResendConfirmationEmail({ user })
|
||||
},
|
||||
adminApproveUser (store, user) {
|
||||
return store.rootState.api.backendInteractor.adminApproveUser({ user })
|
||||
},
|
||||
adminListStatuses (store, { user, opts }) {
|
||||
return store.rootState.api.backendInteractor.adminListStatuses({ user, opts })
|
||||
},
|
||||
adminChangeStatusScope (store, { opts }) {
|
||||
return store.rootState.api.backendInteractor.adminChangeStatusScope({ opts })
|
||||
},
|
||||
loadFrontendsStuff ({ rootState, commit }) {
|
||||
rootState.api.backendInteractor.fetchAvailableFrontends()
|
||||
.then(frontends => commit('setAvailableFrontends', { frontends }))
|
||||
|
|
|
|||
|
|
@ -144,6 +144,9 @@ 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_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_ADMIN_APPROVE_URL = '/api/v1/pleroma/admin/users/approve'
|
||||
const PLEROMA_ADMIN_LIST_STATUSES_URL = (id, page_size, godmode, with_reblogs) => `/api/v1/pleroma/admin/users/${id}/statuses?page_size=${page_size}&godmode=${godmode}&with_reblogs=${with_reblogs}`
|
||||
const PLEROMA_ADMIN_CHANGE_STATUS_SCOPE_URL = (id) => `/api/v1/pleroma/admin/statuses/${id}`
|
||||
|
||||
const PLEROMA_EMOJI_RELOAD_URL = '/api/pleroma/admin/reload_emoji'
|
||||
const PLEROMA_EMOJI_IMPORT_FS_URL = '/api/pleroma/emoji/packs/import'
|
||||
|
|
@ -705,14 +708,24 @@ const deactivateUser = ({ credentials, user: { screen_name: nickname } }) => {
|
|||
}).then(response => get(response, 'users.0'))
|
||||
}
|
||||
|
||||
const deleteUser = ({ credentials, user }) => {
|
||||
const screenName = user.screen_name
|
||||
const deleteUser = ({ credentials, user: { screen_name: nickname } }) => {
|
||||
const r = promisedRequest({
|
||||
url: ADMIN_USERS_URL,
|
||||
method: 'DELETE',
|
||||
credentials,
|
||||
payload: {
|
||||
nicknames: [nickname]
|
||||
}
|
||||
})
|
||||
console.log(r)
|
||||
return r.then(response => get(response, 'users.0'))
|
||||
/* const screenName = user.screen_name
|
||||
const headers = authHeaders(credentials)
|
||||
|
||||
return fetch(`${ADMIN_USERS_URL}?nickname=${screenName}`, {
|
||||
method: 'DELETE',
|
||||
headers
|
||||
})
|
||||
})*/
|
||||
}
|
||||
|
||||
const fetchTimeline = ({
|
||||
|
|
@ -1549,6 +1562,45 @@ const adminResendConfirmationEmail = ({user: { screen_name: nickname }, credenti
|
|||
})
|
||||
}
|
||||
|
||||
const adminApproveUser = ({user : { screen_name: nickname }, credentials }) => {
|
||||
const url = PLEROMA_ADMIN_APPROVE_URL
|
||||
const r = promisedRequest({url: url,
|
||||
credentials,
|
||||
method: 'PATCH',
|
||||
payload: {
|
||||
nicknames: [nickname]
|
||||
}
|
||||
})
|
||||
r.catch(error => console.log('approve error', error))
|
||||
console.log(r)
|
||||
return r
|
||||
}
|
||||
|
||||
const adminListStatuses = ({user: { id }, opts: { page_size, godmode, with_reblogs }, credentials }) => {
|
||||
const url = PLEROMA_ADMIN_LIST_STATUSES_URL(id, page_size, godmode, with_reblogs)
|
||||
return promisedRequest({url: url,
|
||||
credentials,
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
|
||||
const adminChangeStatusScope = ({opts: { id, sensitive, visibility}, credentials }) => {
|
||||
const url = PLEROMA_ADMIN_CHANGE_STATUS_SCOPE_URL(id)
|
||||
var payload = {}
|
||||
if (typeof(sensitive) !== 'undefined') {
|
||||
payload['sensitive'] = sensitive
|
||||
}
|
||||
if (typeof(visibility) !== 'undefined') {
|
||||
payload['visibility'] = visibility
|
||||
}
|
||||
return promisedRequest({url: url,
|
||||
credentials,
|
||||
method: 'PUT',
|
||||
payload
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const announcementToPayload = ({ content, startsAt, endsAt, allDay }) => {
|
||||
const payload = { content }
|
||||
|
||||
|
|
@ -2228,6 +2280,9 @@ const apiService = {
|
|||
adminRemoveUserFromModeratorGroup,
|
||||
adminConfirmUser,
|
||||
adminResendConfirmationEmail,
|
||||
adminApproveUser,
|
||||
adminListStatuses,
|
||||
adminChangeStatusScope,
|
||||
}
|
||||
|
||||
export default apiService
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue