initial implementation of godmode
This commit is contained in:
parent
068c3c0654
commit
aa0cef12b1
4 changed files with 113 additions and 5 deletions
|
|
@ -84,6 +84,13 @@ export default (store) => {
|
||||||
() => import('src/components/user_profile/user_profile.vue'),
|
() => import('src/components/user_profile/user_profile.vue'),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'user-profile-admin-view',
|
||||||
|
path: '/admin/users/$:id',
|
||||||
|
component: defineAsyncComponent(
|
||||||
|
() => import('src/components/user_profile/user_profile_admin_view.vue'),
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'interactions',
|
name: 'interactions',
|
||||||
path: '/users/:username/interactions',
|
path: '/users/:username/interactions',
|
||||||
|
|
|
||||||
66
src/components/user_profile/user_profile_admin_view.js
Normal file
66
src/components/user_profile/user_profile_admin_view.js
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
import { get } from 'lodash'
|
||||||
|
import { mapState } from 'pinia'
|
||||||
|
|
||||||
|
import Conversation from 'src/components/conversation/conversation.vue'
|
||||||
|
import List from 'src/components/list/list.vue'
|
||||||
|
import UserCard from 'src/components/user_card/user_card.vue'
|
||||||
|
|
||||||
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
import { useAdminSettingsStore } from 'src/stores/admin_settings.js'
|
||||||
|
|
||||||
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
|
library.add(faCircleNotch)
|
||||||
|
|
||||||
|
const defaultTabKey = 'statuses'
|
||||||
|
|
||||||
|
const UserProfileAdminView = {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userId: null,
|
||||||
|
godmode: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.userId = this.$route.params.id
|
||||||
|
console.log(this.userId)
|
||||||
|
useInterfaceStore().setForeignProfileBackground(this.user?.background_image)
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
useInterfaceStore().setForeignProfileBackground(this.user?.background_image)
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
useInterfaceStore().setForeignProfileBackground(null)
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
fetchOptions() {
|
||||||
|
return {
|
||||||
|
pageSize: 20,
|
||||||
|
godmode: this.godmode,
|
||||||
|
userId: this.userId,
|
||||||
|
withReblogs: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
user() {
|
||||||
|
return this.$store.getters.findUser(this.userId)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchStatuses(page) {
|
||||||
|
return useAdminSettingsStore()
|
||||||
|
.fetchStatuses({
|
||||||
|
...this.fetchOptions,
|
||||||
|
page,
|
||||||
|
})
|
||||||
|
.then(({ count, users }) => ({ count, items: users }))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
UserCard,
|
||||||
|
List,
|
||||||
|
Conversation,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UserProfileAdminView
|
||||||
30
src/components/user_profile/user_profile_admin_view.vue
Normal file
30
src/components/user_profile/user_profile_admin_view.vue
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
v-if="user"
|
||||||
|
class="user-profile panel panel-default"
|
||||||
|
>
|
||||||
|
<div class="panel-body card-wrapper">
|
||||||
|
<UserCard
|
||||||
|
:user-id="userId"
|
||||||
|
:compact="compactProfiles"
|
||||||
|
avatar-action="zoom"
|
||||||
|
:hide-bio="true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<List
|
||||||
|
:fetch-function="fetchStatuses"
|
||||||
|
@select="onSelect"
|
||||||
|
scrollable
|
||||||
|
>
|
||||||
|
<template #item="{item}">
|
||||||
|
<Conversation
|
||||||
|
:user="item"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</List>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./user_profile_admin_view.js"></script>
|
||||||
|
|
||||||
|
<style src="./user_profile.scss" lang="scss"></style>
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { cloneDeep, differenceWith, flatten, get, isEqual, set } from 'lodash'
|
import { cloneDeep, differenceWith, flatten, get, isEqual, set } from 'lodash'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
|
import { parseStatus } from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||||
|
|
||||||
export const defaultState = {
|
export const defaultState = {
|
||||||
frontends: [],
|
frontends: [],
|
||||||
loaded: false,
|
loaded: false,
|
||||||
|
|
@ -299,11 +301,14 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Statuses stuff
|
// Statuses stuff
|
||||||
listStatuses({ userId, opts }) {
|
fetchStatuses(opts) {
|
||||||
return this.backendInteractor.adminListStatuses({
|
return this
|
||||||
userId,
|
.backendInteractor
|
||||||
opts,
|
.adminListStatuses(opts)
|
||||||
})
|
.then(({ total, activities }) => ({
|
||||||
|
count: total,
|
||||||
|
items: activities.map(parseStatus)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
changeStatusScope({ opts }) {
|
changeStatusScope({ opts }) {
|
||||||
return this.backendInteractor.adminChangeStatusScope({
|
return this.backendInteractor.adminChangeStatusScope({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue