+
database
{{ JSON.stringify(user, null, 2) }}
diff --git a/src/components/settings_modal/admin_tabs/admin_status_card.js b/src/components/settings_modal/admin_tabs/admin_status_card.js
new file mode 100644
index 000000000..312fe0232
--- /dev/null
+++ b/src/components/settings_modal/admin_tabs/admin_status_card.js
@@ -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
diff --git a/src/components/settings_modal/admin_tabs/admin_status_card.vue b/src/components/settings_modal/admin_tabs/admin_status_card.vue
new file mode 100644
index 000000000..98365b41d
--- /dev/null
+++ b/src/components/settings_modal/admin_tabs/admin_status_card.vue
@@ -0,0 +1,76 @@
+
+
+
{{ $t('admin_dash.users.title_info') }}:
+
{{ $t('admin_dash.users.status_id') }}: {{ statusDetails.id }}
+
{{ $t('admin_dash.users.created_at') }}: {{ statusDetails.created_at }}
+
{{ $t('admin_dash.users.edited_at') }}: {{ statusDetails.edited_at }}
+
{{ $t('admin_dash.users.title_content') }}:
+
+
+
+
+
change_sensitivity(v)"
+ >
+ {{ $t('admin_dash.users.content_nsfw') }}
+
+
+
{{ $t('admin_dash.users.link_source') }}
+
+
+
+
+
+
details
+
{{ JSON.stringify(statusDetails, null, 2) }}
+
+
+
+
+
diff --git a/src/components/settings_modal/admin_tabs/users_tab.js b/src/components/settings_modal/admin_tabs/users_tab.js
index 9bbaadfd3..8d0c1e198 100644
--- a/src/components/settings_modal/admin_tabs/users_tab.js
+++ b/src/components/settings_modal/admin_tabs/users_tab.js
@@ -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() {
}
}
diff --git a/src/components/settings_modal/admin_tabs/users_tab.vue b/src/components/settings_modal/admin_tabs/users_tab.vue
index ed6f2e743..e1a3d026e 100644
--- a/src/components/settings_modal/admin_tabs/users_tab.vue
+++ b/src/components/settings_modal/admin_tabs/users_tab.vue
@@ -1,145 +1,144 @@
-
-
+
+
filter user search
+
update_query(v.target.value)"
+ >
+
update_name(v.target.value)"
+ >
+
update_email(v.target.value)"
+ >
+
+
+
+
{filters.need_approval = v; reset();}"
+ >
+ {{ $t('admin_dash.users.only_unapproved') }}
+
+
{filters.unconfirmed = v; reset();}"
+ >
+ {{ $t('admin_dash.users.only_unconfirmed') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/status_body/status_body.js b/src/components/status_body/status_body.js
index aa334499e..69694f76a 100644
--- a/src/components/status_body/status_body.js
+++ b/src/components/status_body/status_body.js
@@ -35,6 +35,7 @@ const StatusContent = {
'toggleShowingLongSubject'
],
data () {
+ //console.log('status_content', this.status)
return {
postLength: this.status.text.length,
parseReadyDone: false
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 3b0008753..ccbf93d55 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -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",
diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js
index 1a4e541af..519003c5c 100644
--- a/src/modules/adminSettings.js
+++ b/src/modules/adminSettings.js
@@ -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 }))
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 81e62d3fd..16bc39e76 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -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