tested everything so far, fixed identation, fixed some bugs and added i18n entries
This commit is contained in:
parent
064093c670
commit
9bb86f7603
12 changed files with 506 additions and 238 deletions
|
|
@ -17,14 +17,18 @@ const PageList = {
|
||||||
fetchPage: {
|
fetchPage: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: async () => []
|
default: async () => []
|
||||||
|
},
|
||||||
|
singlePage: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
items: [],
|
items: [],
|
||||||
selected: [],
|
canLoadMore: true,
|
||||||
canLoadMore: true
|
gliter: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -35,12 +39,21 @@ const PageList = {
|
||||||
this.loadMore() // load one page
|
this.loadMore() // load one page
|
||||||
},
|
},
|
||||||
loadMore () {
|
loadMore () {
|
||||||
|
this.gliter++
|
||||||
|
const iter = this.gliter
|
||||||
this.fetchPage(this.$store, {
|
this.fetchPage(this.$store, {
|
||||||
page: this.pageIndex++,
|
page: this.pageIndex++,
|
||||||
pageSize: this.pageSize
|
pageSize: this.pageSize
|
||||||
}).then((items) => this.items = [...this.items, ...items])
|
}).then((items) => {
|
||||||
// fetch page, add to items
|
// ignore if another request was already dispatched
|
||||||
//this.$forceUpdate()
|
if (iter == this.gliter) {
|
||||||
|
console.log('items', items)
|
||||||
|
this.items = [...this.items, ...items]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selected () {
|
||||||
|
return this.$refs.list.selected
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,35 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="page-list">
|
<div class="page-list">
|
||||||
<SelectableList
|
<SelectableList
|
||||||
:box-only="true"
|
ref="list"
|
||||||
:get-key="i => i"
|
:box-only="true"
|
||||||
:items="items"
|
:get-key="i => i"
|
||||||
|
:items="items"
|
||||||
>
|
>
|
||||||
<template v-slot:header="slotProps">
|
<template #header="slotProps">
|
||||||
<slot name="header" v-bind="slotProps"/>
|
<slot
|
||||||
</template>
|
name="header"
|
||||||
<template v-slot:item="slotProps">
|
v-bind="slotProps"
|
||||||
<slot name="item" v-bind="slotProps"/>
|
/>
|
||||||
|
</template>
|
||||||
|
<template #item="slotProps">
|
||||||
|
<slot
|
||||||
|
name="item"
|
||||||
|
v-bind="slotProps"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</SelectableList>
|
</SelectableList>
|
||||||
<button
|
<div v-if="!singlePage">
|
||||||
v-if="canLoadMore"
|
<button
|
||||||
class="button button-default btn"
|
v-if="canLoadMore"
|
||||||
type="button"
|
class="button button-default btn"
|
||||||
@click="loadMore"
|
type="button"
|
||||||
>
|
@click="loadMore"
|
||||||
{{ $t('page_list.load_more') }}
|
>
|
||||||
</button>
|
{{ $t('page_list.load_more') }}
|
||||||
<p> prev first next </p>
|
</button>
|
||||||
|
<p> prev first next </p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import BasicUserCard from '../../basic_user_card/basic_user_card.vue'
|
import BasicUserCard from '../../basic_user_card/basic_user_card.vue'
|
||||||
import Checkbox from 'src/components/checkbox/checkbox.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 = {
|
const AdminCard = {
|
||||||
props: ['userDetails'],
|
props: ['userDetails'],
|
||||||
|
|
@ -8,6 +10,7 @@ const AdminCard = {
|
||||||
progress: false,
|
progress: false,
|
||||||
top_level_expanded: false,
|
top_level_expanded: false,
|
||||||
json_expanded: false,
|
json_expanded: false,
|
||||||
|
timeline_expanded: false,
|
||||||
just_approved: false,
|
just_approved: false,
|
||||||
just_confirmed: false,
|
just_confirmed: false,
|
||||||
just_deleted: false,
|
just_deleted: false,
|
||||||
|
|
@ -55,16 +58,17 @@ const AdminCard = {
|
||||||
},
|
},
|
||||||
is_confirmed () {
|
is_confirmed () {
|
||||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
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 () {
|
is_approved () {
|
||||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
return (this.userDetails._original.is_approved === true) || (this.just_approved === true)
|
||||||
return (u._original.pleroma.is_approved === false) || (this.just_approved === true)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
BasicUserCard,
|
BasicUserCard,
|
||||||
Checkbox
|
Checkbox,
|
||||||
|
PageList,
|
||||||
|
AdminStatusCard,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggle_admin (v) {
|
toggle_admin (v) {
|
||||||
|
|
@ -101,7 +105,10 @@ const AdminCard = {
|
||||||
const u = this.$store.getters.findUser(this.userDetails.id)
|
const u = this.$store.getters.findUser(this.userDetails.id)
|
||||||
this.$store.dispatch('adminResendConfirmationEmail', u)
|
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 () {
|
force_update_user () {
|
||||||
this.$store.dispatch('fetchUser', this.userDetails.id)
|
this.$store.dispatch('fetchUser', this.userDetails.id)
|
||||||
},
|
},
|
||||||
|
|
@ -111,6 +118,11 @@ const AdminCard = {
|
||||||
this.$store.dispatch('adminDeleteUser', u)
|
this.$store.dispatch('adminDeleteUser', u)
|
||||||
this.just_deleted = true
|
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
|
<div
|
||||||
v-if="!isLoaded"
|
v-if="!isLoaded"
|
||||||
>
|
>
|
||||||
loading user...
|
{{ $t('admin_dash.users.loading_user') }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
>
|
>
|
||||||
<div v-if="userDetails.id !== this.$store.state.users.currentUser.id">
|
<div v-if="userDetails.id !== this.$store.state.users.currentUser.id">
|
||||||
<BasicUserCard :user="user">
|
<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>
|
|
||||||
<div v-if="!top_level_expanded">
|
<div v-if="!top_level_expanded">
|
||||||
<button
|
<button
|
||||||
class="button button-default btn"
|
class="button button-default btn"
|
||||||
type="button"
|
type="button"
|
||||||
@click="top_level_expanded = true"
|
@click="top_level_expanded = true"
|
||||||
>
|
>
|
||||||
expand user
|
{{ $t('admin_dash.users.expand_user') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div
|
||||||
|
class="setting-item"
|
||||||
|
v-else
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
class="button button-default btn"
|
class="button button-default btn"
|
||||||
type="button"
|
type="button"
|
||||||
@click="top_level_expanded = false"
|
@click="top_level_expanded = false"
|
||||||
>
|
>
|
||||||
collapse user
|
{{ $t('admin_dash.users.collapse_user') }}
|
||||||
</button><br>
|
</button><br>
|
||||||
<div v-if="is_local">
|
<div v-if="is_local">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
:model-value="is_admin"
|
:model-value="is_admin"
|
||||||
@update:model-value="v => toggle_admin(v)"
|
@update:model-value="v => toggle_admin(v)"
|
||||||
>
|
>
|
||||||
is admin
|
{{ $t('admin_dash.users.is_admin') }}
|
||||||
</Checkbox><br>
|
</Checkbox><br>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
:model-value="is_moderator"
|
:model-value="is_moderator"
|
||||||
@update:model-value="v => toggle_moderator(v)"
|
@update:model-value="v => toggle_moderator(v)"
|
||||||
>
|
>
|
||||||
is moderator
|
{{ $t('admin_dash.users.is_moderator') }}
|
||||||
</Checkbox><br>
|
</Checkbox><br>
|
||||||
<div v-if="!just_confirmed && !is_confirmed">
|
<div v-if="!just_confirmed && !is_confirmed">
|
||||||
<button class="button button-default btn"
|
<button class="button button-default btn"
|
||||||
type="button"
|
type="button"
|
||||||
@click="confirm_user()"
|
@click="confirm_user()"
|
||||||
>
|
>
|
||||||
is confirmed
|
{{ $t('admin_dash.users.is_confirmed') }}
|
||||||
</button><br>
|
</button><br>
|
||||||
<button class="button button-default btn"
|
<button class="button button-default btn"
|
||||||
type="button"
|
type="button"
|
||||||
@click="resend_confirmation_email()"
|
@click="resend_confirmation_email()"
|
||||||
>
|
>
|
||||||
resend confirmation email
|
{{ $t('admin_dash.users.resend_confirmation_email') }}
|
||||||
</button><br>
|
</button><br>
|
||||||
</div>
|
</div>
|
||||||
<Checkbox
|
<div v-if="!is_approved">
|
||||||
:model-value="is_approved"
|
<button
|
||||||
@update:model-value="v => toggle_approval(v)"
|
class="button button-default btn"
|
||||||
|
type="button"
|
||||||
|
@click="toggle_approval(true)"
|
||||||
>
|
>
|
||||||
is approved
|
{{ $t('admin_dash.users.approve') }}
|
||||||
</Checkbox><br>
|
</button><br>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
:model-value="is_activated"
|
:model-value="is_activated"
|
||||||
@update:model-value="v => toggle_activation(v)"
|
@update:model-value="v => toggle_activation(v)"
|
||||||
>
|
>
|
||||||
is active
|
{{ $t('admin_dash.users.is_active') }}
|
||||||
</Checkbox><br>
|
</Checkbox><br>
|
||||||
<button class="button button-default btn"
|
<button class="button button-default btn"
|
||||||
type="button"
|
type="button"
|
||||||
@click="delete_user()"
|
@click="delete_user()"
|
||||||
>
|
>
|
||||||
delete user
|
{{ $t('admin_dash.users.delete_user') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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"
|
<div v-if="!json_expanded"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
|
|
@ -111,16 +120,19 @@
|
||||||
type="button"
|
type="button"
|
||||||
@click="json_expanded = true"
|
@click="json_expanded = true"
|
||||||
>
|
>
|
||||||
expand raw info
|
{{ $t('admin_dash.users.expand_raw_info') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div
|
||||||
|
class="setting-item"
|
||||||
|
v-else
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
class="button button-default btn"
|
class="button button-default btn"
|
||||||
type="button"
|
type="button"
|
||||||
@click="json_expanded = false"
|
@click="json_expanded = false"
|
||||||
>
|
>
|
||||||
collapse raw info
|
{{ $t('admin_dash.users.collapse_raw_info') }}
|
||||||
</button>
|
</button>
|
||||||
<h2> database </h2>
|
<h2> database </h2>
|
||||||
<pre> {{ JSON.stringify(user, null, 2) }} </pre>
|
<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
|
/* filters must match the filter options below initially, or the ui is gonna have a computer moment
|
||||||
* no, i won't fix this
|
* no, i won't fix this
|
||||||
* */
|
* */
|
||||||
filters_origin: "local",
|
filters_origin: "all",
|
||||||
filters_activity: "all",
|
filters_activity: "all",
|
||||||
filters_permission: "all",
|
filters_permission: "all",
|
||||||
filters_query: '',
|
filters_query: "",
|
||||||
filters_name: '',
|
filters_name: "",
|
||||||
filters_email: '',
|
filters_email: "",
|
||||||
filters: {
|
filters: {
|
||||||
local: true,
|
local: false,
|
||||||
external: false,
|
external: false,
|
||||||
active: false,
|
active: false,
|
||||||
need_approval: false,
|
need_approval: false,
|
||||||
|
|
@ -121,8 +121,6 @@ const UsersTab = {
|
||||||
this.filters_email = v
|
this.filters_email = v
|
||||||
this.reset()
|
this.reset()
|
||||||
},
|
},
|
||||||
delete_selection () {
|
|
||||||
},
|
|
||||||
delete_user () {},
|
delete_user () {},
|
||||||
fetch_page (store, opts) {
|
fetch_page (store, opts) {
|
||||||
opts.query = this.filters_query
|
opts.query = this.filters_query
|
||||||
|
|
@ -138,9 +136,21 @@ const UsersTab = {
|
||||||
toggleLocal () {
|
toggleLocal () {
|
||||||
this.filters.local = !this.filters.local
|
this.filters.local = !this.filters.local
|
||||||
this.reset()
|
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>
|
<template>
|
||||||
<TabSwitcher
|
<div :label="$t('admin_dash.users.management')">
|
||||||
:scrollable-tabs="false"
|
<div class="setting-item">
|
||||||
class="user-tab"
|
<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')">
|
<option
|
||||||
<div class="setting-item">
|
value="all"
|
||||||
<h2> filter user search </h2>
|
>
|
||||||
todo: query, name and email input<br>
|
{{ $t('admin_dash.users.all') }}
|
||||||
<input
|
</option>
|
||||||
:model-value="filters_query"
|
<option
|
||||||
placeholder="query"
|
value="local"
|
||||||
@input="v => update_query(v.target.value)"
|
>
|
||||||
/><br>
|
{{ $t('admin_dash.users.only_local') }}
|
||||||
<input
|
</option>
|
||||||
:model-value="filters_name"
|
<option
|
||||||
placeholder="name"
|
value="external"
|
||||||
@input="v => update_name(v.target.value)"
|
>
|
||||||
/><br>
|
{{ $t('admin_dash.users.only_external') }}
|
||||||
<input
|
</option>
|
||||||
:model-value="filters_email"
|
</Select>
|
||||||
placeholder="email"
|
<Select
|
||||||
@input="v => update_email(v.target.value)"
|
:model-value="filters_activity"
|
||||||
/><br>
|
@update:model-value="v => update_activity(v)"
|
||||||
<Select
|
>
|
||||||
:model-value="filters_origin"
|
<option
|
||||||
@update:model-value="v => update_origin(v)"
|
value="all"
|
||||||
>
|
>
|
||||||
<option
|
{{ $t('admin_dash.users.all') }}
|
||||||
value="all"
|
</option>
|
||||||
>
|
<option
|
||||||
all
|
value="active"
|
||||||
</option>
|
>
|
||||||
<option
|
{{ $t('admin_dash.users.only_active') }}
|
||||||
value="local"
|
</option>
|
||||||
>
|
<option
|
||||||
local only
|
value="deactivated"
|
||||||
</option>
|
>
|
||||||
<option
|
{{ $t('admin_dash.users.only_deactivated') }}
|
||||||
value="external"
|
</option>
|
||||||
>
|
</Select>
|
||||||
external only
|
<Select
|
||||||
</option>
|
:model-value="filters_permission"
|
||||||
</Select>
|
@update:model-value="v => update_permission(v)"
|
||||||
<Select
|
>
|
||||||
:model-value="filters_activity"
|
<option
|
||||||
@update:model-value="v => update_activity(v)"
|
value="all"
|
||||||
>
|
>
|
||||||
<option
|
{{ $t('admin_dash.users.all') }}
|
||||||
value="all"
|
</option>
|
||||||
>
|
<option
|
||||||
all
|
value="admin"
|
||||||
</option>
|
>
|
||||||
<option
|
{{ $t('admin_dash.users.only_administrators') }}
|
||||||
value="active"
|
</option>
|
||||||
>
|
<option
|
||||||
active only
|
value="modsnadmins"
|
||||||
</option>
|
>
|
||||||
<option
|
{{ $t('admin_dash.users.all_privileged') }}
|
||||||
value="deactivated"
|
</option>
|
||||||
>
|
<option
|
||||||
deactivated only
|
value="moderator"
|
||||||
</option>
|
>
|
||||||
</Select>
|
{{ $t('admin_dash.users.only_moderators') }}
|
||||||
<Select
|
</option>
|
||||||
:model-value="filters_permission"
|
</Select>
|
||||||
@update:model-value="v => update_permission(v)"
|
<Checkbox
|
||||||
>
|
@update:model-value="v => {filters.need_approval = v; reset();}"
|
||||||
<option
|
>
|
||||||
value="all"
|
{{ $t('admin_dash.users.only_unapproved') }}
|
||||||
>
|
</Checkbox>
|
||||||
all
|
<Checkbox
|
||||||
</option>
|
@update:model-value="v => {filters.unconfirmed = v; reset();}"
|
||||||
<option
|
>
|
||||||
value="admin"
|
{{ $t('admin_dash.users.only_unconfirmed') }}
|
||||||
>
|
</Checkbox><br>
|
||||||
admin only
|
<button
|
||||||
</option>
|
class="button button-default btn"
|
||||||
<option
|
type="button"
|
||||||
value="modsnadmins"
|
@click="reset"
|
||||||
>
|
>
|
||||||
all privileged
|
{{ $t('admin_dash.users.refresh') }}
|
||||||
</option>
|
</button>
|
||||||
<option
|
</div>
|
||||||
value="moderator"
|
<PageList
|
||||||
>
|
ref="userList"
|
||||||
moderator only
|
:refresh="true"
|
||||||
</option>
|
:get-key="i => i"
|
||||||
</Select>
|
:box-only="true"
|
||||||
<Checkbox
|
:page-size="50"
|
||||||
@update:model-value="v => {filters.need_approval = v; reset();}"
|
:fetch-page="(store, opts) => fetch_page(store, opts)"
|
||||||
>
|
>
|
||||||
only unapproved
|
<template #header>
|
||||||
</Checkbox>
|
<button
|
||||||
<Checkbox
|
class="button button-default btn"
|
||||||
@update:model-value="v => {filters.unconfirmed = v; reset();}"
|
type="button"
|
||||||
>
|
@click="activate_selection"
|
||||||
only unconfirmed
|
>
|
||||||
</Checkbox>
|
{{ $t('admin_dash.users.activate') }}
|
||||||
</div>
|
</button>
|
||||||
<PageList
|
<button
|
||||||
ref="userList"
|
class="button button-default btn"
|
||||||
:refresh="true"
|
type="button"
|
||||||
:get-key="i => i"
|
@click="deactivate_selection"
|
||||||
:box-only="true"
|
>
|
||||||
:page-size="50"
|
{{ $t('admin_dash.users.deactivate') }}
|
||||||
:fetch-page="(store, opts) => this.fetch_page(store, opts)"
|
</button>
|
||||||
>
|
<button
|
||||||
<template #header>
|
class="button button-default btn"
|
||||||
<button
|
type="button"
|
||||||
class="button button-default btn"
|
@click="delete_selection"
|
||||||
type="button"
|
>
|
||||||
@click="delete_selection"
|
{{ $t('admin_dash.users.delete') }}
|
||||||
>
|
</button>
|
||||||
{{ $t('admin_dash.users.activate') }}
|
</template>
|
||||||
</button>
|
<template #item="{item}">
|
||||||
<button
|
<AdminCard :user-details="item" />
|
||||||
class="button button-default btn"
|
</template>
|
||||||
type="button"
|
</PageList>
|
||||||
@click="activate_selection"
|
</div>
|
||||||
>
|
|
||||||
{{ $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>
|
|
||||||
</template>
|
</template>
|
||||||
<script src="./users_tab.js"></script>
|
<script src="./users_tab.js"></script>
|
||||||
<style lang="scss" src="./users_tab.scss"></style>
|
<style lang="scss" src="./users_tab.scss"></style>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ const StatusContent = {
|
||||||
'toggleShowingLongSubject'
|
'toggleShowingLongSubject'
|
||||||
],
|
],
|
||||||
data () {
|
data () {
|
||||||
|
//console.log('status_content', this.status)
|
||||||
return {
|
return {
|
||||||
postLength: this.status.text.length,
|
postLength: this.status.text.length,
|
||||||
parseReadyDone: false
|
parseReadyDone: false
|
||||||
|
|
|
||||||
|
|
@ -1133,19 +1133,51 @@
|
||||||
},
|
},
|
||||||
"users": {
|
"users": {
|
||||||
"management": "Management",
|
"management": "Management",
|
||||||
"invitations": "Invitations",
|
|
||||||
"search_users": "Search for users...",
|
"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...",
|
"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",
|
"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": {
|
"limits": {
|
||||||
"arbitrary_limits": "Arbitrary limits",
|
"arbitrary_limits": "Arbitrary limits",
|
||||||
|
|
|
||||||
|
|
@ -96,11 +96,20 @@ const adminSettingsStorage = {
|
||||||
},
|
},
|
||||||
adminConfirmUser (store, user) {
|
adminConfirmUser (store, user) {
|
||||||
return store.rootState.api.backendInteractor.adminConfirmUser({ user })
|
return store.rootState.api.backendInteractor.adminConfirmUser({ user })
|
||||||
.then(res => store.dispatch('fetchUser', user.id))
|
.then(() => store.dispatch('fetchUser', user.id))
|
||||||
},
|
},
|
||||||
adminResendConfirmationEmail (store, user) {
|
adminResendConfirmationEmail (store, user) {
|
||||||
return store.rootState.api.backendInteractor.adminResendConfirmationEmail({ 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 }) {
|
loadFrontendsStuff ({ rootState, commit }) {
|
||||||
rootState.api.backendInteractor.fetchAvailableFrontends()
|
rootState.api.backendInteractor.fetchAvailableFrontends()
|
||||||
.then(frontends => commit('setAvailableFrontends', { frontends }))
|
.then(frontends => commit('setAvailableFrontends', { frontends }))
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,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_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_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_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_RELOAD_URL = '/api/pleroma/admin/reload_emoji'
|
||||||
const PLEROMA_EMOJI_IMPORT_FS_URL = '/api/pleroma/emoji/packs/import'
|
const PLEROMA_EMOJI_IMPORT_FS_URL = '/api/pleroma/emoji/packs/import'
|
||||||
|
|
@ -696,14 +699,24 @@ const deactivateUser = ({ credentials, user: { screen_name: nickname } }) => {
|
||||||
}).then(response => get(response, 'users.0'))
|
}).then(response => get(response, 'users.0'))
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteUser = ({ credentials, user }) => {
|
const deleteUser = ({ credentials, user: { screen_name: nickname } }) => {
|
||||||
const screenName = user.screen_name
|
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)
|
const headers = authHeaders(credentials)
|
||||||
|
|
||||||
return fetch(`${ADMIN_USERS_URL}?nickname=${screenName}`, {
|
return fetch(`${ADMIN_USERS_URL}?nickname=${screenName}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers
|
headers
|
||||||
})
|
})*/
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchTimeline = ({
|
const fetchTimeline = ({
|
||||||
|
|
@ -1533,6 +1546,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 announcementToPayload = ({ content, startsAt, endsAt, allDay }) => {
|
||||||
const payload = { content }
|
const payload = { content }
|
||||||
|
|
||||||
|
|
@ -2212,6 +2264,9 @@ const apiService = {
|
||||||
adminRemoveUserFromModeratorGroup,
|
adminRemoveUserFromModeratorGroup,
|
||||||
adminConfirmUser,
|
adminConfirmUser,
|
||||||
adminResendConfirmationEmail,
|
adminResendConfirmationEmail,
|
||||||
|
adminApproveUser,
|
||||||
|
adminListStatuses,
|
||||||
|
adminChangeStatusScope,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default apiService
|
export default apiService
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue