mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
react on claus peters comments
This commit is contained in:
parent
0df7b4e74f
commit
2dac6844ba
@ -163,18 +163,15 @@ export default {
|
||||
this.$apollo
|
||||
.mutate({ mutation, variables })
|
||||
.then((result) => {
|
||||
this.$el.ownerDocument.defaultView.console.log('after calling mutation')
|
||||
if (
|
||||
this.hideResubmission &&
|
||||
this.showResubmissionDate &&
|
||||
this.combineResubmissionDateAndTime() > new Date()
|
||||
) {
|
||||
this.$el.ownerDocument.defaultView.console.log('before update-contributions')
|
||||
this.$emit('update-contributions')
|
||||
} else {
|
||||
this.$el.ownerDocument.defaultView.console.log('before reload contribution')
|
||||
this.$emit('reload-contribution', this.contributionId)
|
||||
}
|
||||
}
|
||||
this.toastSuccess(this.$t('message.request'))
|
||||
this.loading = false
|
||||
})
|
||||
|
||||
@ -142,7 +142,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
reloadContribution(id) {
|
||||
console.log('reload contribution with id: %d', id)
|
||||
this.$apollo
|
||||
.query({ query: getContribution, variables: { id } })
|
||||
.then((result) => {
|
||||
|
||||
@ -20,6 +20,7 @@ import {
|
||||
import { UpdateUnconfirmedContributionContext } from '@/interactions/updateUnconfirmedContribution/UpdateUnconfirmedContribution.context'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
import { findContributionMessages } from './util/findContributionMessages'
|
||||
|
||||
@ -148,14 +149,17 @@ export class ContributionMessageResolver {
|
||||
async (transactionalEntityManager: EntityManager) => {
|
||||
const { contribution, contributionMessage, contributionChanged } =
|
||||
await updateUnconfirmedContributionContext.run(transactionalEntityManager, relations)
|
||||
console.log('contribution changed: %d', contributionChanged)
|
||||
if (contributionChanged) {
|
||||
await transactionalEntityManager.update(
|
||||
DbContribution,
|
||||
{ id: contributionId },
|
||||
contribution,
|
||||
)
|
||||
console.log('new contribution resubmission at: %s, status: %s', contribution.resubmissionAt, contribution.contributionStatus)
|
||||
logger.debug(
|
||||
'contribution changed, resubmission at: %s, status: %s',
|
||||
contribution.resubmissionAt,
|
||||
contribution.contributionStatus,
|
||||
)
|
||||
}
|
||||
if (contributionMessage) {
|
||||
await transactionalEntityManager.insert(DbContributionMessage, contributionMessage)
|
||||
|
||||
@ -264,9 +264,24 @@ export class ContributionResolver {
|
||||
await updateUnconfirmedContributionContext.run()
|
||||
await getConnection().transaction(async (transactionalEntityManager: EntityManager) => {
|
||||
await transactionalEntityManager.save(contribution)
|
||||
console.log('saved changed contribution: %o', JSON.stringify(contribution, null, 2))
|
||||
// TODO: move into specialized view or formatting for logging class
|
||||
logger.debug('saved changed contribution', {
|
||||
id: contribution.id,
|
||||
amount: contribution.amount.toString(),
|
||||
memo: contribution.memo,
|
||||
contributionDate: contribution.contributionDate.toString(),
|
||||
resubmissionAt: contribution.resubmissionAt?.toString(),
|
||||
status: contribution.contributionStatus.toString(),
|
||||
})
|
||||
if (contributionMessage) {
|
||||
await transactionalEntityManager.save(contributionMessage)
|
||||
// TODO: move into specialized view or formatting for logging class
|
||||
logger.debug('save new contributionMessage', {
|
||||
contributionId: contributionMessage.contributionId,
|
||||
type: contributionMessage.type,
|
||||
message: contributionMessage.message,
|
||||
isModerator: contributionMessage.isModerator,
|
||||
})
|
||||
}
|
||||
})
|
||||
const moderator = getUser(context)
|
||||
|
||||
@ -10,6 +10,10 @@ import { LogError } from '@/server/LogError'
|
||||
|
||||
import { AbstractUnconfirmedContributionRole } from './AbstractUnconfirmedContribution.role'
|
||||
|
||||
/**
|
||||
* This role will be used for Moderators and Admins which want to edit a contribution
|
||||
* Admins and Moderators are currently not allowed to edit her own contributions with the admin/moderator role
|
||||
*/
|
||||
export class UnconfirmedContributionAdminRole extends AbstractUnconfirmedContributionRole {
|
||||
public constructor(
|
||||
contribution: Contribution,
|
||||
@ -78,7 +82,8 @@ export class UnconfirmedContributionAdminRole extends AbstractUnconfirmedContrib
|
||||
newResubmissionDate !== null &&
|
||||
+this.self.resubmissionAt === +newResubmissionDate
|
||||
|
||||
// creation date is currently not changeable
|
||||
// check if at least one value of contribution was changed and if not, throw an exception
|
||||
// frontend and admin frontend should only call with at least some changes in the args
|
||||
if (
|
||||
!this.isContributionChanging() &&
|
||||
((this.self.resubmissionAt === null && newResubmissionDate === null) ||
|
||||
|
||||
@ -9,6 +9,10 @@ import { LogError } from '@/server/LogError'
|
||||
|
||||
import { AbstractUnconfirmedContributionRole } from './AbstractUnconfirmedContribution.role'
|
||||
|
||||
/**
|
||||
* This role will be used for Moderators and Admins which want to comment a contribution
|
||||
* Admins and Moderators are currently not allowed to comment her own contributions with the admin/moderator role
|
||||
*/
|
||||
export class UnconfirmedContributionAdminAddMessageRole extends AbstractUnconfirmedContributionRole {
|
||||
public constructor(contribution: Contribution, private updateData: ContributionMessageArgs) {
|
||||
super(contribution, contribution.amount, contribution.contributionDate)
|
||||
@ -29,10 +33,8 @@ export class UnconfirmedContributionAdminAddMessageRole extends AbstractUnconfir
|
||||
) {
|
||||
this.self.contributionStatus = newStatus
|
||||
this.self.resubmissionAt = resubmissionDate
|
||||
console.log('update, change status and/or resubmissionAt')
|
||||
} else {
|
||||
this.changed = false
|
||||
console.log('no changes, resubmission date: %s', resubmissionDate?.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,10 @@ import { LogError } from '@/server/LogError'
|
||||
|
||||
import { AbstractUnconfirmedContributionRole } from './AbstractUnconfirmedContribution.role'
|
||||
|
||||
/**
|
||||
* This role will be used for Users which want to edit there own contribution,
|
||||
* independent from there role, because the own contribution can only be edited in user role
|
||||
*/
|
||||
export class UnconfirmedContributionUserRole extends AbstractUnconfirmedContributionRole {
|
||||
public constructor(contribution: Contribution, private updateData: ContributionArgs) {
|
||||
super(contribution, updateData.amount, new Date(updateData.creationDate))
|
||||
|
||||
@ -8,6 +8,10 @@ import { LogError } from '@/server/LogError'
|
||||
|
||||
import { AbstractUnconfirmedContributionRole } from './AbstractUnconfirmedContribution.role'
|
||||
|
||||
/**
|
||||
* This role will be used if a User comment his contribution, for example as answer to a moderator question
|
||||
* independent from there role, because the own contribution can only be commented in user role
|
||||
*/
|
||||
export class UnconfirmedContributionUserAddMessageRole extends AbstractUnconfirmedContributionRole {
|
||||
public constructor(contribution: Contribution, private updateData: ContributionMessageArgs) {
|
||||
super(contribution, contribution.amount, contribution.contributionDate)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user