mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
further renaming
This commit is contained in:
parent
e60f06bb9b
commit
eabd14bdf3
@ -336,8 +336,8 @@ describe('CreationFormular', () => {
|
||||
data: {
|
||||
adminCreateContributions: {
|
||||
success: true,
|
||||
successfulCreation: ['bob@baumeister.de', 'bibi@bloxberg.de'],
|
||||
failedCreation: [],
|
||||
successfulContribution: ['bob@baumeister.de', 'bibi@bloxberg.de'],
|
||||
failedContribution: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -392,8 +392,8 @@ describe('CreationFormular', () => {
|
||||
data: {
|
||||
adminCreateContributions: {
|
||||
success: true,
|
||||
successfulCreation: [],
|
||||
failedCreation: ['bob@baumeister.de', 'bibi@bloxberg.de'],
|
||||
successfulContribution: [],
|
||||
failedContribution: ['bob@baumeister.de', 'bibi@bloxberg.de'],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@ -165,18 +165,18 @@ export default {
|
||||
fetchPolicy: 'no-cache',
|
||||
})
|
||||
.then((result) => {
|
||||
const failedCreations = []
|
||||
const failedContributions = []
|
||||
this.$store.commit(
|
||||
'openCreationsPlus',
|
||||
result.data.adminCreateContributions.successfulCreation.length,
|
||||
result.data.adminCreateContributions.successfulContribution.length,
|
||||
)
|
||||
if (result.data.adminCreateContributions.failedCreation.length > 0) {
|
||||
result.data.adminCreateContributions.failedCreation.forEach((email) => {
|
||||
failedCreations.push(email)
|
||||
if (result.data.adminCreateContributions.failedContribution.length > 0) {
|
||||
result.data.adminCreateContributions.failedContribution.forEach((email) => {
|
||||
failedContributions.push(email)
|
||||
})
|
||||
}
|
||||
this.$emit('remove-all-bookmark')
|
||||
this.$emit('toast-failed-creations', failedCreations)
|
||||
this.$emit('toast-failed-creations', failedContributions)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toastError(error.message)
|
||||
|
||||
@ -4,8 +4,8 @@ export const adminCreateContributions = gql`
|
||||
mutation ($pendingCreations: [AdminCreateContributionArgs!]!) {
|
||||
adminCreateContributions(pendingCreations: $pendingCreations) {
|
||||
success
|
||||
successfulCreation
|
||||
failedCreation
|
||||
successfulContribution
|
||||
failedContribution
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
@ -4,16 +4,16 @@ import { ObjectType, Field } from 'type-graphql'
|
||||
export class AdminCreateContribution {
|
||||
constructor() {
|
||||
this.success = false
|
||||
this.successfulCreation = []
|
||||
this.failedCreation = []
|
||||
this.successfulContribution = []
|
||||
this.failedContribution = []
|
||||
}
|
||||
|
||||
@Field(() => Boolean)
|
||||
success: boolean
|
||||
|
||||
@Field(() => [String])
|
||||
successfulCreation: string[]
|
||||
successfulContribution: string[]
|
||||
|
||||
@Field(() => [String])
|
||||
failedCreation: string[]
|
||||
failedContribution: string[]
|
||||
}
|
||||
|
||||
@ -750,7 +750,9 @@ describe('AdminResolver', () => {
|
||||
mutate({ mutation: adminCreateContribution, variables }),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
errors: [new GraphQLError('This user was deleted. Cannot make a creation.')],
|
||||
errors: [
|
||||
new GraphQLError('This user was deleted. Cannot create a contribution.'),
|
||||
],
|
||||
}),
|
||||
)
|
||||
})
|
||||
@ -767,7 +769,9 @@ describe('AdminResolver', () => {
|
||||
mutate({ mutation: adminCreateContribution, variables }),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
errors: [new GraphQLError('Creation could not be saved, Email is not activated')],
|
||||
errors: [
|
||||
new GraphQLError('Contribution could not be saved, Email is not activated'),
|
||||
],
|
||||
}),
|
||||
)
|
||||
})
|
||||
@ -917,8 +921,8 @@ describe('AdminResolver', () => {
|
||||
data: {
|
||||
adminCreateContributions: {
|
||||
success: true,
|
||||
successfulCreation: ['bibi@bloxberg.de', 'peter@lustig.de'],
|
||||
failedCreation: [
|
||||
successfulContribution: ['bibi@bloxberg.de', 'peter@lustig.de'],
|
||||
failedContribution: [
|
||||
'stephen@hawking.uk',
|
||||
'garrick@ollivander.com',
|
||||
'bob@baumeister.de',
|
||||
|
||||
@ -176,10 +176,10 @@ export class AdminResolver {
|
||||
throw new Error(`Could not find user with email: ${email}`)
|
||||
}
|
||||
if (user.deletedAt) {
|
||||
throw new Error('This user was deleted. Cannot make a creation.')
|
||||
throw new Error('This user was deleted. Cannot create a contribution.')
|
||||
}
|
||||
if (!user.emailChecked) {
|
||||
throw new Error('Creation could not be saved, Email is not activated')
|
||||
throw new Error('Contribution could not be saved, Email is not activated')
|
||||
}
|
||||
const moderator = getUser(context)
|
||||
logger.trace('moderator: ', moderator.id)
|
||||
@ -209,22 +209,22 @@ export class AdminResolver {
|
||||
@Ctx() context: Context,
|
||||
): Promise<AdminCreateContribution> {
|
||||
let success = false
|
||||
const successfulCreation: string[] = []
|
||||
const failedCreation: string[] = []
|
||||
const successfulContribution: string[] = []
|
||||
const failedContribution: string[] = []
|
||||
for (const contribution of contributions) {
|
||||
await this.adminCreateContribution(contribution, context)
|
||||
.then(() => {
|
||||
successfulCreation.push(contribution.email)
|
||||
successfulContribution.push(contribution.email)
|
||||
success = true
|
||||
})
|
||||
.catch(() => {
|
||||
failedCreation.push(contribution.email)
|
||||
failedContribution.push(contribution.email)
|
||||
})
|
||||
}
|
||||
return {
|
||||
success,
|
||||
successfulCreation,
|
||||
failedCreation,
|
||||
successfulContribution,
|
||||
failedContribution,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,8 +114,8 @@ export const adminCreateContributions = gql`
|
||||
mutation ($pendingCreations: [AdminCreateContributionArgs!]!) {
|
||||
adminCreateContributions(pendingCreations: $pendingCreations) {
|
||||
success
|
||||
successfulCreation
|
||||
failedCreation
|
||||
successfulContribution
|
||||
failedContribution
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user