From aa0cef12b13cfa34ee45ae0dbf2acbd9f130cbc8 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 10 Jun 2026 15:49:51 +0300 Subject: [PATCH] initial implementation of godmode --- src/boot/routes.js | 7 ++ .../user_profile/user_profile_admin_view.js | 66 +++++++++++++++++++ .../user_profile/user_profile_admin_view.vue | 30 +++++++++ src/stores/admin_settings.js | 15 +++-- 4 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 src/components/user_profile/user_profile_admin_view.js create mode 100644 src/components/user_profile/user_profile_admin_view.vue diff --git a/src/boot/routes.js b/src/boot/routes.js index 4a075e955..515a08a96 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -84,6 +84,13 @@ export default (store) => { () => 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', path: '/users/:username/interactions', diff --git a/src/components/user_profile/user_profile_admin_view.js b/src/components/user_profile/user_profile_admin_view.js new file mode 100644 index 000000000..a243dcb20 --- /dev/null +++ b/src/components/user_profile/user_profile_admin_view.js @@ -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 diff --git a/src/components/user_profile/user_profile_admin_view.vue b/src/components/user_profile/user_profile_admin_view.vue new file mode 100644 index 000000000..ea72a7e62 --- /dev/null +++ b/src/components/user_profile/user_profile_admin_view.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/src/stores/admin_settings.js b/src/stores/admin_settings.js index 55f6eca69..c3dd7b5a8 100644 --- a/src/stores/admin_settings.js +++ b/src/stores/admin_settings.js @@ -1,6 +1,8 @@ import { cloneDeep, differenceWith, flatten, get, isEqual, set } from 'lodash' import { defineStore } from 'pinia' +import { parseStatus } from 'src/services/entity_normalizer/entity_normalizer.service.js' + export const defaultState = { frontends: [], loaded: false, @@ -299,11 +301,14 @@ export const useAdminSettingsStore = defineStore('adminSettings', { }, // Statuses stuff - listStatuses({ userId, opts }) { - return this.backendInteractor.adminListStatuses({ - userId, - opts, - }) + fetchStatuses(opts) { + return this + .backendInteractor + .adminListStatuses(opts) + .then(({ total, activities }) => ({ + count: total, + items: activities.map(parseStatus) + }) }, changeStatusScope({ opts }) { return this.backendInteractor.adminChangeStatusScope({