mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Log error when contribution is in the wrong state. Write full content in changeMessage.
This commit is contained in:
parent
b98e8edd42
commit
c79d186a45
@ -198,6 +198,9 @@ export class ContributionResolver {
|
|||||||
contributionToUpdate.contributionStatus !== ContributionStatus.IN_PROGRESS &&
|
contributionToUpdate.contributionStatus !== ContributionStatus.IN_PROGRESS &&
|
||||||
contributionToUpdate.contributionStatus !== ContributionStatus.PENDING
|
contributionToUpdate.contributionStatus !== ContributionStatus.PENDING
|
||||||
) {
|
) {
|
||||||
|
logger.error(
|
||||||
|
`Contribution can not be updated since the state is ${contributionToUpdate.contributionStatus}`,
|
||||||
|
)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Contribution can not be updated since the state is ${contributionToUpdate.contributionStatus}`,
|
`Contribution can not be updated since the state is ${contributionToUpdate.contributionStatus}`,
|
||||||
)
|
)
|
||||||
@ -219,16 +222,11 @@ export class ContributionResolver {
|
|||||||
contributionMessage.createdAt = contributionToUpdate.updatedAt
|
contributionMessage.createdAt = contributionToUpdate.updatedAt
|
||||||
? contributionToUpdate.updatedAt
|
? contributionToUpdate.updatedAt
|
||||||
: contributionToUpdate.createdAt
|
: contributionToUpdate.createdAt
|
||||||
let changeMessage = ''
|
const changeMessage = `${contributionToUpdate.contributionDate}
|
||||||
if (contributionToUpdate.contributionDate.getTime() !== new Date(creationDate).getTime()) {
|
---
|
||||||
changeMessage += contributionToUpdate.contributionDate + '\n'
|
${contributionToUpdate.memo}
|
||||||
}
|
---
|
||||||
if (contributionToUpdate.memo !== memo) {
|
${contributionToUpdate.amount}`
|
||||||
changeMessage += '---\n' + contributionToUpdate.memo + '\n'
|
|
||||||
}
|
|
||||||
if (contributionToUpdate.amount.toFixed(6) !== amount.toFixed(6)) {
|
|
||||||
changeMessage += '---\n' + contributionToUpdate.amount
|
|
||||||
}
|
|
||||||
contributionMessage.message = changeMessage
|
contributionMessage.message = changeMessage
|
||||||
contributionMessage.isModerator = false
|
contributionMessage.isModerator = false
|
||||||
contributionMessage.userId = user.id
|
contributionMessage.userId = user.id
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user