diff --git a/backend/src/schema/types/schema.gql b/backend/src/schema/types/schema.gql index 23c2ded4d..b15179443 100644 --- a/backend/src/schema/types/schema.gql +++ b/backend/src/schema/types/schema.gql @@ -12,11 +12,6 @@ type Mutation { unfollowUser(id: ID!): User } -enum Deletable { - Post - Comment -} - enum ShoutTypeEnum { Post } diff --git a/backend/src/schema/types/type/User.gql b/backend/src/schema/types/type/User.gql index af525396b..e6e7191c5 100644 --- a/backend/src/schema/types/type/User.gql +++ b/backend/src/schema/types/type/User.gql @@ -185,6 +185,11 @@ type Query { ) } +enum Deletable { + Post + Comment +} + type Mutation { UpdateUser ( id: ID! diff --git a/webapp/components/ContentMenu/ContentMenu.vue b/webapp/components/ContentMenu/ContentMenu.vue index ef2df822b..0bcfeb3cd 100644 --- a/webapp/components/ContentMenu/ContentMenu.vue +++ b/webapp/components/ContentMenu/ContentMenu.vue @@ -156,6 +156,15 @@ export default { path: '/settings', icon: 'edit', }) + if (this.isAdmin === true) { + routes.push({ + label: this.$t(`settings.deleteUserAccount.name`), + callback: () => { + this.$emit('delete', this.resource) + }, + icon: 'trash', + }) + } } else { if (this.resource.isMuted) { routes.push({ @@ -191,6 +200,15 @@ export default { icon: 'user-times', }) } + if (this.isAdmin === true) { + routes.push({ + label: this.$t(`settings.deleteUserAccount.name`), + callback: () => { + this.$emit('delete', this.resource) + }, + icon: 'trash', + }) + } } } diff --git a/webapp/components/DeleteData/DeleteData.vue b/webapp/components/DeleteData/DeleteData.vue index 714e4c410..ab22918fb 100644 --- a/webapp/components/DeleteData/DeleteData.vue +++ b/webapp/components/DeleteData/DeleteData.vue @@ -8,7 +8,9 @@ {{ $t('settings.deleteUserAccount.pleaseConfirm', { confirm: currentUser.name }) }} -

{{ $t('settings.deleteUserAccount.accountDescription') }}

+

+ {{ $t('settings.deleteUserAccount.accountDescription') }} +

-
+

{{ $t('settings.deleteUserAccount.accountWarning') }}

+ @@ -38,6 +39,7 @@ import ConfirmModal from '~/components/Modal/ConfirmModal' import DisableModal from '~/components/Modal/DisableModal' import ReleaseModal from '~/components/ReleaseModal/ReleaseModal.vue' import ReportModal from '~/components/Modal/ReportModal' +import DeleteUserModal from '~/components/Modal/DeleteUserModal.vue' import { mapGetters } from 'vuex' export default { @@ -47,6 +49,7 @@ export default { ReleaseModal, ReportModal, ConfirmModal, + DeleteUserModal, }, computed: { ...mapGetters({ diff --git a/webapp/components/Modal/DeleteUserModal.vue b/webapp/components/Modal/DeleteUserModal.vue new file mode 100644 index 000000000..8ef2ca540 --- /dev/null +++ b/webapp/components/Modal/DeleteUserModal.vue @@ -0,0 +1,178 @@ + + + + + diff --git a/webapp/locales/de.json b/webapp/locales/de.json index d53e32a2b..925252437 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -373,6 +373,11 @@ "questions": "Bei Fragen oder Problemen erreichst Du uns per E-Mail an", "title": "Human Connection befindet sich in der Wartung" }, + "modals": { + "deleteUser": { + "created": "Erstellt" + } + }, "moderation": { "name": "Moderation", "reports": { @@ -632,8 +637,12 @@ "deleteUserAccount": { "accountDescription": "Sei dir bewusst, dass deine Beiträge und Kommentare für unsere Community wichtig sind. Wenn du sie trotzdem löschen möchtest, musst du sie unten markieren.", "accountWarning": "Dein Konto, deine Beiträge oder Kommentare kannst du nach dem Löschen WEDER VERWALTEN NOCH WIEDERHERSTELLEN!", + "accountWarningAdmin": "Das Konto, die Beiträge oder Kommentare können nach dem Löschen WEDER VERWALTEN NOCH WIEDERHERGESTELLT WERDEN!", + "accountWarningIsAdmin": "Achtung! Du löschst jetzt ein Benutzerkonto!", "commentedCount": "Meine {count} Kommentare löschen", + "confirmDeleting": "Benutzerkonto jetzt löschen", "contributionsCount": "Meine {count} Beiträge löschen", + "infoAdmin": "Alle Beiträge und Kommentare des Users werden zusätzlich gelöscht!", "name": "Benutzerkonto löschen", "pleaseConfirm": "Zerstörerische Aktion! Gib „{confirm}“ ein, um zu bestätigen.", "success": "Konto erfolgreich gelöscht!" diff --git a/webapp/locales/en.json b/webapp/locales/en.json index e91f5c37a..984deeeb7 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -373,6 +373,11 @@ "questions": "Any Questions or concerns, send an e-mail to", "title": "Human Connection is under maintenance" }, + "modals": { + "deleteUser": { + "created": "Created" + } + }, "moderation": { "name": "Moderation", "reports": { @@ -632,8 +637,12 @@ "deleteUserAccount": { "accountDescription": "Be aware that your Posts and Comments are important to our community. If you still choose to delete them, you have to mark them below.", "accountWarning": "You CAN'T MANAGE and CAN'T RECOVER your Account, Posts, or Comments after deleting your account!", + "accountWarningAdmin": "The account, contributions or comments can NOT BE ADMINISTERED OR RESTORED after deletion!", + "accountWarningIsAdmin": "Heads up! You are about to delete a user account!", "commentedCount": "Delete my {count} comments", + "confirmDeleting": "Delete user account now", "contributionsCount": "Delete my {count} posts", + "infoAdmin": "All contributions and comments of the user are additionally deleted!", "name": "Delete user account", "pleaseConfirm": "Destructive action! Type “{confirm}” to confirm.", "success": "Account successfully deleted!" diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 1a43da14b..c8c9e9886 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -23,6 +23,7 @@ @unmute="unmuteUser" @block="blockUser" @unblock="unblockUser" + @delete="deleteUser" /> @@ -385,6 +386,14 @@ export default { this.$apollo.queries.User.refetch() } }, + async deleteUser(userdata) { + this.$store.commit('modal/SET_OPEN', { + name: 'delete', + data: { + userdata: userdata, + }, + }) + }, pinPost(post) { this.$apollo .mutate({