mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
bug: fix - contributionCount, commentCount remove from code
This commit is contained in:
parent
8a2d238f96
commit
4210727ddf
@ -45,7 +45,7 @@ describe('DeleteData.vue', () => {
|
||||
}
|
||||
getters = {
|
||||
'auth/user': () => {
|
||||
return { id: 'u343', name: deleteAccountName, contributionsCount: 2, commentedCount: 3 }
|
||||
return { id: 'u343', name: deleteAccountName }
|
||||
},
|
||||
}
|
||||
actions = { 'auth/logout': jest.fn() }
|
||||
@ -68,12 +68,12 @@ describe('DeleteData.vue', () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it('defaults to deleteContributions to false', () => {
|
||||
expect(wrapper.vm.deleteContributions).toEqual(false)
|
||||
it('defaults to deleteContributions to true', () => {
|
||||
expect(wrapper.vm.deleteContributions).toEqual(true)
|
||||
})
|
||||
|
||||
it('defaults to deleteComments to false', () => {
|
||||
expect(wrapper.vm.deleteComments).toEqual(false)
|
||||
it('defaults to deleteComments to true', () => {
|
||||
expect(wrapper.vm.deleteComments).toEqual(true)
|
||||
})
|
||||
|
||||
it('defaults to deleteEnabled to false', () => {
|
||||
@ -93,7 +93,31 @@ describe('DeleteData.vue', () => {
|
||||
deleteAccountBtn = wrapper.find('[data-test="delete-button"]')
|
||||
})
|
||||
|
||||
it('if deleteEnabled is true and only deletes user by default', () => {
|
||||
|
||||
it("deletes user's posts and comments if requested by default", () => {
|
||||
mocks.$t.mockImplementation(() => deleteContributionsMessage)
|
||||
enableContributionDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(0)
|
||||
mocks.$t.mockImplementation(() => deleteCommentsMessage)
|
||||
enableCommentDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(1)
|
||||
deleteAccountBtn.trigger('click')
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
id: 'u343',
|
||||
resource: ['Post', 'Comment'],
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
it('if deleteEnabled is true and only deletes user ', () => {
|
||||
mocks.$t.mockImplementation(() => deleteContributionsMessage)
|
||||
enableContributionDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(0)
|
||||
enableContributionDeletionCheckbox.trigger('click')
|
||||
mocks.$t.mockImplementation(() => deleteCommentsMessage)
|
||||
enableCommentDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(1)
|
||||
enableCommentDeletionCheckbox.trigger('click')
|
||||
deleteAccountBtn.trigger('click')
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
@ -107,7 +131,7 @@ describe('DeleteData.vue', () => {
|
||||
|
||||
it("deletes a user's posts if requested", () => {
|
||||
mocks.$t.mockImplementation(() => deleteContributionsMessage)
|
||||
enableContributionDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(0)
|
||||
enableContributionDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(1)
|
||||
enableContributionDeletionCheckbox.trigger('click')
|
||||
deleteAccountBtn.trigger('click')
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||
@ -122,7 +146,7 @@ describe('DeleteData.vue', () => {
|
||||
|
||||
it("deletes a user's comments if requested", () => {
|
||||
mocks.$t.mockImplementation(() => deleteCommentsMessage)
|
||||
enableCommentDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(1)
|
||||
enableCommentDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(0)
|
||||
enableCommentDeletionCheckbox.trigger('click')
|
||||
deleteAccountBtn.trigger('click')
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||
@ -135,23 +159,7 @@ describe('DeleteData.vue', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it("deletes a user's posts and comments if requested", () => {
|
||||
mocks.$t.mockImplementation(() => deleteContributionsMessage)
|
||||
enableContributionDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(0)
|
||||
enableContributionDeletionCheckbox.trigger('click')
|
||||
mocks.$t.mockImplementation(() => deleteCommentsMessage)
|
||||
enableCommentDeletionCheckbox = wrapper.findAll('input[type="checkbox"]').at(1)
|
||||
enableCommentDeletionCheckbox.trigger('click')
|
||||
deleteAccountBtn.trigger('click')
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
id: 'u343',
|
||||
resource: ['Post', 'Comment'],
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
it('shows a success toaster after successful mutation', async () => {
|
||||
await deleteAccountBtn.trigger('click')
|
||||
|
||||
@ -9,23 +9,15 @@
|
||||
</label>
|
||||
<ds-input v-model="enableDeletionValue" />
|
||||
<p class="notice">{{ $t('settings.deleteUserAccount.accountDescription') }}</p>
|
||||
<label v-if="currentUser.contributionsCount" class="checkbox">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" v-model="deleteContributions" />
|
||||
{{
|
||||
$t('settings.deleteUserAccount.contributionsCount', {
|
||||
count: currentUser.contributionsCount,
|
||||
})
|
||||
}}
|
||||
{{ $t('settings.deleteUserAccount.contributionsCount') }}
|
||||
</label>
|
||||
<label v-if="currentUser.commentedCount" class="checkbox">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" v-model="deleteComments" />
|
||||
{{
|
||||
$t('settings.deleteUserAccount.commentedCount', {
|
||||
count: currentUser.commentedCount,
|
||||
})
|
||||
}}
|
||||
{{ $t('settings.deleteUserAccount.commentedCount') }}
|
||||
</label>
|
||||
<section v-if="deleteEnabled" class="warning">
|
||||
<section class="warning">
|
||||
<p>{{ $t('settings.deleteUserAccount.accountWarning') }}</p>
|
||||
</section>
|
||||
<base-button
|
||||
@ -49,8 +41,8 @@ export default {
|
||||
name: 'DeleteData',
|
||||
data() {
|
||||
return {
|
||||
deleteContributions: false,
|
||||
deleteComments: false,
|
||||
deleteContributions: true,
|
||||
deleteComments: true,
|
||||
enableDeletionValue: null,
|
||||
}
|
||||
},
|
||||
|
||||
@ -630,10 +630,10 @@
|
||||
"success": "Deine Daten wurden erfolgreich aktualisiert!"
|
||||
},
|
||||
"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.",
|
||||
"accountDescription": "Sei dir bewusst, dass deine Beiträge und Kommentare für unsere Community wichtig sind. Wenn du sie nicht löschen möchtest, musst du die Häckchen entfernen.",
|
||||
"accountWarning": "Dein Konto, deine Beiträge oder Kommentare kannst du nach dem Löschen WEDER VERWALTEN NOCH WIEDERHERSTELLEN!",
|
||||
"commentedCount": "Meine {count} Kommentare löschen",
|
||||
"contributionsCount": "Meine {count} Beiträge löschen",
|
||||
"commentedCount": "Meine Kommentare löschen",
|
||||
"contributionsCount": "Meine Beiträge löschen",
|
||||
"name": "Benutzerkonto löschen",
|
||||
"pleaseConfirm": "Zerstörerische Aktion! Gib „{confirm}“ ein, um zu bestätigen.",
|
||||
"success": "Konto erfolgreich gelöscht!"
|
||||
|
||||
@ -632,8 +632,8 @@
|
||||
"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!",
|
||||
"commentedCount": "Delete my {count} comments",
|
||||
"contributionsCount": "Delete my {count} posts",
|
||||
"commentedCount": "Delete my comments",
|
||||
"contributionsCount": "Delete my posts",
|
||||
"name": "Delete user account",
|
||||
"pleaseConfirm": "Destructive action! Type “{confirm}” to confirm.",
|
||||
"success": "Account successfully deleted!"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user