From 99a84cbb929523d34fc89f97bf9f027c2cc5a60a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 6 Mar 2025 16:51:56 +0100 Subject: [PATCH] fix tests --- .../ContributionMessagesFormular.vue | 4 ++++ .../ContributionMessagesList.spec.js | 12 ++++++---- .../ContributionMessagesList.vue | 12 +++++++--- .../components/Tables/OpenCreationsTable.vue | 23 +++++++++++++++++++ admin/src/graphql/adminListContributions.js | 1 + admin/src/locales/de.json | 4 ++-- admin/src/locales/en.json | 6 ++--- backend/src/graphql/model/Contribution.ts | 8 +++++-- frontend/src/locales/de.json | 4 ++-- frontend/src/locales/en.json | 4 ++-- 10 files changed, 59 insertions(+), 19 deletions(-) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue index 0ae31c905..c8dc2f854 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -222,6 +222,10 @@ const onSubmit = () => { } } toastSuccess(t('message.request')) + form.value = { + text: '', + memo: props.contributionMemo, + } loading.value = false }) .catch((error) => { diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.spec.js b/admin/src/components/ContributionMessages/ContributionMessagesList.spec.js index 7d87082d4..bbb2f3806 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesList.spec.js +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.spec.js @@ -93,10 +93,12 @@ describe('ContributionMessagesList', () => { wrapper = mount(ContributionMessagesList, { props: { - contributionId: 42, - contributionMemo: 'test memo', - contributionUserId: 108, - contributionStatus: 'PENDING', + contribution: { + id: 42, + memo: 'test memo', + userId: 108, + status: 'PENDING', + }, hideResubmission: true, }, global: { @@ -137,7 +139,7 @@ describe('ContributionMessagesList', () => { }) it('does not render the ContributionMessagesFormular when status is not PENDING or IN_PROGRESS', async () => { - await wrapper.setProps({ contributionStatus: 'COMPLETED' }) + await wrapper.setProps({ contribution: { status: 'COMPLETED' } }) expect(wrapper.find('contribution-messages-formular-stub').exists()).toBe(false) }) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.vue b/admin/src/components/ContributionMessages/ContributionMessagesList.vue index a465fe5a8..e62dae7f0 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.vue @@ -2,9 +2,12 @@
+ + {{ contribution.firstName }} {{ contribution.lastName }} <{{ contribution.email }}> + +   {{ - $t('contributionMessagesForm.userDetailsRegisteredAt', { - ...contribution, + $t('contributionMessagesForm.hasRegisteredAt', { createdAt: new Date(contribution.createdAt).toLocaleString(), }) }} @@ -34,7 +37,7 @@ diff --git a/admin/src/graphql/adminListContributions.js b/admin/src/graphql/adminListContributions.js index aa6c0c713..b5eca3477 100644 --- a/admin/src/graphql/adminListContributions.js +++ b/admin/src/graphql/adminListContributions.js @@ -26,6 +26,7 @@ export const adminListContributions = gql` id firstName lastName + email amount memo createdAt diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index b2d72cb91..9e5f3bc0e 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -36,7 +36,7 @@ }, "contributionMessagesForm": { "resubmissionDateInPast": "Wiedervorlage Datum befindet sich in der Vergangenheit!", - "userDetailsRegisteredAt": "{firstName} {lastName} <{email}> hat sich am {createdAt} registriert." + "hasRegisteredAt": "hat sich am {createdAt} registriert." }, "contributions": { "all": "Alle", @@ -143,7 +143,7 @@ "plus": "+" }, "message": { - "request": "Die Anfrage wurde gesendet." + "request": "Die Eingabe wurde gespeichert." }, "moderator": { "history": "Die Daten wurden geändert. Dies sind die alten Daten.", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index 0eee027a3..7d71e8bf0 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -36,7 +36,7 @@ }, "contributionMessagesForm": { "resubmissionDateInPast": "Resubmission date is in the past!", - "userDetailsRegisteredAt": "{firstName} {lastName} <{email}> registered on {createdAt}." + "hasRegisteredAt": "registered on {createdAt}." }, "contributions": { "all": "All", @@ -74,8 +74,8 @@ "deleted_user": "All deleted user", "deny": "Reject", "description": "Description", - "e_mail": "E-mail", "details": "Details", + "e_mail": "E-mail", "edit": "edit", "enabled": "enabled", "error": "Error", @@ -143,7 +143,7 @@ "plus": "+" }, "message": { - "request": "Request has been sent." + "request": "The entry has been saved." }, "moderator": { "history": "The data has been changed. This is the old data.", diff --git a/backend/src/graphql/model/Contribution.ts b/backend/src/graphql/model/Contribution.ts index a0e7e4366..87240a47e 100644 --- a/backend/src/graphql/model/Contribution.ts +++ b/backend/src/graphql/model/Contribution.ts @@ -7,8 +7,9 @@ import { ObjectType, Field, Int } from 'type-graphql' export class Contribution { constructor(contribution: dbContribution, user?: User | null) { this.id = contribution.id - this.firstName = user ? user.firstName : null - this.lastName = user ? user.lastName : null + this.firstName = user?.firstName ?? null + this.lastName = user?.lastName ?? null + this.email = user?.emailContact?.email ?? null this.amount = contribution.amount this.memo = contribution.memo this.createdAt = contribution.createdAt @@ -37,6 +38,9 @@ export class Contribution { @Field(() => String, { nullable: true }) lastName: string | null + @Field(() => String, { nullable: true }) + email: string | null + @Field(() => Decimal) amount: Decimal diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index c1ee2d490..64bdd993e 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -51,8 +51,8 @@ "contribution": { "activity": "Tätigkeit", "alert": { - "answerQuestion": "Bitte beantworte diese Rückfrage.", - "answerQuestionToast": "Du hast eine Rückfrage auf einen Beitrag. Bitte antworte auf diese.", + "answerQuestion": "Zu diesem Beitrag liegt eine neue Nachricht vor.", + "answerQuestionToast": "Du hast neue Nachrichten.", "communityNoteList": "Hier findest du alle eingereichten und bestätigten Beiträge von allen Mitgliedern aus dieser Gemeinschaft.", "confirm": "bestätigt", "deleted": "gelöscht", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index ed23c4d27..a40034dff 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -51,8 +51,8 @@ "contribution": { "activity": "Activity", "alert": { - "answerQuestion": "Please answer the question.", - "answerQuestionToast": "You have a question about a post. Please reply to it.", + "answerQuestion": "There is a new message for this article.", + "answerQuestionToast": "You have new messages.", "communityNoteList": "Here you will find all submitted and confirmed contributions from all members of this community.", "confirm": "confirmed", "deleted": "deleted",