mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
bug: deleteUser on old status, currentUserCounts are retrieved additionally, admin cannot delete himself via his user settings
This commit is contained in:
parent
9aacb22a58
commit
7e5a7f5d42
@ -45,7 +45,7 @@ describe('DeleteData.vue', () => {
|
|||||||
}
|
}
|
||||||
getters = {
|
getters = {
|
||||||
'auth/user': () => {
|
'auth/user': () => {
|
||||||
return { id: 'u343', name: deleteAccountName, contributionsCount: 2, commentedCount: 3 }
|
return { id: 'u343', name: deleteAccountName }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
actions = { 'auth/logout': jest.fn() }
|
actions = { 'auth/logout': jest.fn() }
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<base-card class="delete-data">
|
<base-card v-if="currentUser.role !== 'admin'" class="delete-data">
|
||||||
<h2 class="title">
|
<h2 class="title">
|
||||||
<base-icon name="warning" />
|
<base-icon name="warning" />
|
||||||
{{ $t('settings.deleteUserAccount.name') }}
|
{{ $t('settings.deleteUserAccount.name') }}
|
||||||
@ -9,23 +9,31 @@
|
|||||||
</label>
|
</label>
|
||||||
<ds-input v-model="enableDeletionValue" />
|
<ds-input v-model="enableDeletionValue" />
|
||||||
<p class="notice">{{ $t('settings.deleteUserAccount.accountDescription') }}</p>
|
<p class="notice">{{ $t('settings.deleteUserAccount.accountDescription') }}</p>
|
||||||
<label v-if="currentUser.contributionsCount" class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" v-model="deleteContributions" />
|
<input type="checkbox" v-model="deleteContributions" />
|
||||||
{{
|
{{
|
||||||
$t('settings.deleteUserAccount.contributionsCount', {
|
$t(
|
||||||
count: currentUser.contributionsCount,
|
'settings.deleteUserAccount.contributionsCount',
|
||||||
})
|
{
|
||||||
|
count: currentUserCount.contributionsCount,
|
||||||
|
},
|
||||||
|
currentUserCount.contributionsCount,
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
</label>
|
</label>
|
||||||
<label v-if="currentUser.commentedCount" class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" v-model="deleteComments" />
|
<input type="checkbox" v-model="deleteComments" />
|
||||||
{{
|
{{
|
||||||
$t('settings.deleteUserAccount.commentedCount', {
|
$t(
|
||||||
count: currentUser.commentedCount,
|
'settings.deleteUserAccount.commentedCount',
|
||||||
})
|
{
|
||||||
|
count: currentUserCount.commentedCount,
|
||||||
|
},
|
||||||
|
currentUserCount.commentedCount,
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
</label>
|
</label>
|
||||||
<section v-if="deleteEnabled" class="warning">
|
<section class="warning">
|
||||||
<p>{{ $t('settings.deleteUserAccount.accountWarning') }}</p>
|
<p>{{ $t('settings.deleteUserAccount.accountWarning') }}</p>
|
||||||
</section>
|
</section>
|
||||||
<base-button
|
<base-button
|
||||||
@ -39,11 +47,15 @@
|
|||||||
{{ $t('settings.deleteUserAccount.name') }}
|
{{ $t('settings.deleteUserAccount.name') }}
|
||||||
</base-button>
|
</base-button>
|
||||||
</base-card>
|
</base-card>
|
||||||
|
<base-card v-else class="delete-data">
|
||||||
|
:) {{ $t('settings.deleteUserAccount.adminInfo') }}
|
||||||
|
</base-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex'
|
import { mapActions, mapGetters } from 'vuex'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
import { currentUserCountQuery } from '~/graphql/User'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DeleteData',
|
name: 'DeleteData',
|
||||||
@ -52,8 +64,19 @@ export default {
|
|||||||
deleteContributions: false,
|
deleteContributions: false,
|
||||||
deleteComments: false,
|
deleteComments: false,
|
||||||
enableDeletionValue: null,
|
enableDeletionValue: null,
|
||||||
|
currentUserCount: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
apollo: {
|
||||||
|
currentUser: {
|
||||||
|
query() {
|
||||||
|
return currentUserCountQuery()
|
||||||
|
},
|
||||||
|
update(currentUser) {
|
||||||
|
this.currentUserCount = currentUser.currentUser
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
currentUser: 'auth/user',
|
currentUser: 'auth/user',
|
||||||
|
|||||||
@ -283,3 +283,12 @@ export const currentUserQuery = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
export const currentUserCountQuery = () => gql`
|
||||||
|
${userCountsFragment}
|
||||||
|
query {
|
||||||
|
currentUser {
|
||||||
|
...userCounts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|||||||
@ -630,10 +630,11 @@
|
|||||||
"success": "Deine Daten wurden erfolgreich aktualisiert!"
|
"success": "Deine Daten wurden erfolgreich aktualisiert!"
|
||||||
},
|
},
|
||||||
"deleteUserAccount": {
|
"deleteUserAccount": {
|
||||||
|
"adminInfo": "Der Kapitän verlässt immer als letzter das Schiff! Du bist Admin dieses Netzwerkes, du kannst dich auf diese weise nicht löschen! ;) ",
|
||||||
"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.",
|
"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!",
|
"accountWarning": "Dein Konto, deine Beiträge oder Kommentare kannst du nach dem Löschen WEDER VERWALTEN NOCH WIEDERHERSTELLEN!",
|
||||||
"commentedCount": "Meine {count} Kommentare löschen",
|
"commentedCount": "Meinen {count} Kommentar löschen ::: Meine {count} Kommentare löschen",
|
||||||
"contributionsCount": "Meine {count} Beiträge löschen",
|
"contributionsCount": "Meinen {count} Beitrag löschen ::: Meine {count} Beiträge löschen",
|
||||||
"name": "Benutzerkonto löschen",
|
"name": "Benutzerkonto löschen",
|
||||||
"pleaseConfirm": "Zerstörerische Aktion! Gib „{confirm}“ ein, um zu bestätigen.",
|
"pleaseConfirm": "Zerstörerische Aktion! Gib „{confirm}“ ein, um zu bestätigen.",
|
||||||
"success": "Konto erfolgreich gelöscht!"
|
"success": "Konto erfolgreich gelöscht!"
|
||||||
|
|||||||
@ -630,10 +630,11 @@
|
|||||||
"success": "Your data was successfully updated!"
|
"success": "Your data was successfully updated!"
|
||||||
},
|
},
|
||||||
"deleteUserAccount": {
|
"deleteUserAccount": {
|
||||||
|
"adminInfo": "The captain is always the last to leave the ship! You are admin of this network, you cannot delete yourself this way! ;) ",
|
||||||
"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.",
|
"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!",
|
"accountWarning": "You CAN'T MANAGE and CAN'T RECOVER your Account, Posts, or Comments after deleting your account!",
|
||||||
"commentedCount": "Delete my {count} comments",
|
"commentedCount": "Delete my {count} comment ::: Delete my {count} comments",
|
||||||
"contributionsCount": "Delete my {count} posts",
|
"contributionsCount": "Delete my {count} post ::: Delete my {count} posts",
|
||||||
"name": "Delete user account",
|
"name": "Delete user account",
|
||||||
"pleaseConfirm": "Destructive action! Type “{confirm}” to confirm.",
|
"pleaseConfirm": "Destructive action! Type “{confirm}” to confirm.",
|
||||||
"success": "Account successfully deleted!"
|
"success": "Account successfully deleted!"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user