diff --git a/src/components/settings_modal/admin_tabs/admin_card.js b/src/components/settings_modal/admin_tabs/admin_card.js
index 34231c0aa..6c9ed46db 100644
--- a/src/components/settings_modal/admin_tabs/admin_card.js
+++ b/src/components/settings_modal/admin_tabs/admin_card.js
@@ -140,7 +140,7 @@ const AdminCard = {
fetchStatuses (store, opts) {
const u = this.$store.getters.findUser(this.userDetails.id)
const res = store.dispatch('adminListStatuses', { user: u, opts: { pageSize: opts.pageSize, godmode: true, withReblogs: true}})
- return Promise.resolve(res.then(r => r.activities))
+ return res.then(r => r.activities)
}
}
}
diff --git a/src/components/settings_modal/admin_tabs/admin_card.vue b/src/components/settings_modal/admin_tabs/admin_card.vue
index 68c377f09..bea1f83dc 100644
--- a/src/components/settings_modal/admin_tabs/admin_card.vue
+++ b/src/components/settings_modal/admin_tabs/admin_card.vue
@@ -133,13 +133,47 @@
:fetch-page="(store, opts) => fetchStatuses(store, opts)"
>
-
+
+
+
+
+
+
+
@@ -178,6 +212,55 @@
{{ JSON.stringify(user_details, 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
index 3aec8cf8e..aa7a5f2ef 100644
--- a/src/components/settings_modal/admin_tabs/admin_status_card.js
+++ b/src/components/settings_modal/admin_tabs/admin_status_card.js
@@ -25,6 +25,22 @@ const AdminStatusCard = {
},
changeVisibility (v) {
this.$store.dispatch('adminChangeStatusScope', { opts: { id: this.statusDetails.id, visibility: v }}).then(res => parseStatus(res)).then(s => this.statusCache = s)
+ },
+ // show popup
+ confirmSelection(box) {
+ this.$refs[box].show()
+ this.$refs.dropdown.hidePopover()
+ },
+ // do the thing
+ selectionConfirmed(action, opts) {
+ const restricted = []
+ const s = this.$refs.userList.getSelected()
+ s.forEach(u => {
+ if (restricted.includes(action) !== false || u.id !== this.$store.state.users.currentUser.id) {
+ this.$store.dispatch(action, { id: this.statusDetails.id, ...(opts || {}) })
+ }
+ })
+ this.reset()
}
},
components: {
diff --git a/src/components/settings_modal/admin_tabs/users_tab.js b/src/components/settings_modal/admin_tabs/users_tab.js
index 5d27f7e4d..3486122e5 100644
--- a/src/components/settings_modal/admin_tabs/users_tab.js
+++ b/src/components/settings_modal/admin_tabs/users_tab.js
@@ -86,123 +86,21 @@ const UsersTab = {
reset () {
this.$refs.userList.reset()
},
- activateSelection () {
- this.$refs.confirmActivate.show()
+ // show popup
+ confirmSelection(box) {
+ this.$refs[box].show()
this.$refs.dropdown.hidePopover()
},
- activateSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => this.$store.dispatch('adminActivateUser', this.$store.getters.findUser(u.id)))
- this.reset()
- },
- deactivateSelection () {
- this.$refs.confirmDeactivate.show()
- this.$refs.dropdown.hidePopover()
- },
- deactivateSelectionConfirmed () {
+ // do the thing
+ selectionConfirmed(action) {
+ const restricted = []
const s = this.$refs.userList.getSelected()
s.forEach(u => {
- // avoid deactivating yourself
- if (u.id !== this.$store.state.users.currentUser.id) {
- this.$store.dispatch('adminDeactivateUser', this.$store.getters.findUser(u.id))
+ if (restricted.includes(action) !== false || u.id !== this.$store.state.users.currentUser.id) {
+ this.$store.dispatch(action, this.$store.getters.findUser(u.id))
}
})
this.reset()
- },
- deleteSelection () {
- this.$refs.confirmDelete.show()
- this.$refs.dropdown.hidePopover()
- },
- deleteSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => {
- // avoid deleting yourself
- if (u.id !== this.$store.state.users.currentUser.id) {
- this.$store.dispatch('adminDeleteUser', this.$store.getters.findUser(u.id))
- }
- })
- this.reset()
- },
- grantAdminSelection () {
- this.$refs.confirmGrantAdmin.show()
- this.$refs.dropdown.hidePopover()
- },
- grantAdminSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => this.$store.dispatch('adminAddUserToAdminGroup', this.$store.getters.findUser(u.id)))
- this.reset()
- },
- revokeAdminSelection () {
- this.$refs.confirmRevokeAdminSelection.show()
- this.$refs.dropdown.hidePopover()
- },
- revokeAdminSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => {
- // avoid shooting yourself in the foot
- if (u.id !== this.$store.state.users.currentUser.id) {
- this.$store.dispatch('adminRemoveUserToAdminGroup', this.$store.getters.findUser(u.id))
- }
- })
- this.reset()
- },
- grantModeratorSelection () {
- this.$refs.confirmGrantModeratorSelection.show()
- this.$refs.dropdown.hidePopover()
- },
- grantModeratorSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => this.$store.dispatch('adminAddUserToModeratorGroup', this.$store.getters.findUser(u.id)))
- this.reset()
- },
- revokeModeratorSelection () {
- this.$refs.confirmRevokeModeratorSelection.show()
- this.$refs.dropdown.hidePopover()
- },
- revokeModeratorSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => {
- // you know the drill
- if (u.id !== this.$store.state.users.currentUser.id) {
- this.$store.dispatch('adminRemoveUserToModeratorGroup', this.$store.getters.findUser(u.id))
- }
- })
- this.reset()
- },
- approveSelection () {
- this.$refs.confirmApproveSelection.show()
- this.$refs.dropdown.hidePopover()
- },
- approveSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => this.$store.dispatch('adminApproveUser', this.$store.getters.findUser(u.id)))
- this.reset()
- },
- confirmUserSelection () {
- this.$refs.confirmSelection
- },
- confirmUserSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => this.$store.dispatch('adminConfirmUser', this.$store.getters.findUser(u.id)))
- this.reset()
- },
- resendEmailSelection () {
- this.$refs.resendEmailSelection.show()
- this.$refs.dropdown.hidePopover()
- },
- resendEmailSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => this.$store.dispatch('adminResendConfirmationEmail', this.$store.getters.findUser(u.id)))
- this.reset()
- },
- requirePasswordChangeSelection () {
- this.$refs.requirePasswordChangeSelection.show()
- this.$refs.dropdown.hidePopover()
- },
- requirePasswordChangeSelectionConfirmed () {
- const s = this.$refs.userList.getSelected()
- s.forEach(u => this.$store.dispatch('adminRequirePasswordChange', 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 ffc980cd7..54d77989b 100644
--- a/src/components/settings_modal/admin_tabs/users_tab.vue
+++ b/src/components/settings_modal/admin_tabs/users_tab.vue
@@ -136,7 +136,7 @@