diff --git a/CHANGELOG.md b/CHANGELOG.md index f07cc6645..73261fb3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -#### [2.0.0](https://github.com/gradido/gradido/compare/1.23.3...2.0.0) +#### [2.0.1](https://github.com/gradido/gradido/compare/2.0.0...2.0.1) +- fix(backend): new local user without communitiyuuid [`#3232`](https://github.com/gradido/gradido/pull/3232) +- fix(frontend): fix to less moderator/admins on information page [`#3230`](https://github.com/gradido/gradido/pull/3230) + +### [2.0.0](https://github.com/gradido/gradido/compare/1.23.3...2.0.0) + +> 31 October 2023 + +- chore(release): v2.0.0 [`#3226`](https://github.com/gradido/gradido/pull/3226) +- feat(frontend): split admins and moderators on info page [`#3222`](https://github.com/gradido/gradido/pull/3222) - feat(federation): x-com-sendcoins 32: communtiy authentication handshake [`#3220`](https://github.com/gradido/gradido/pull/3220) - docs(frontend): update news on wallet start page [`#3221`](https://github.com/gradido/gradido/pull/3221) - feat(backend): x-com-sendcoins 31: insert recipient as foreign user in users table after x com sendcoins [`#3215`](https://github.com/gradido/gradido/pull/3215) diff --git a/admin/package.json b/admin/package.json index f44873ed8..ca26057a5 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "2.0.0", + "version": "2.0.1", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/admin/scripts/sort.sh b/admin/scripts/sort.sh index e5c5c41c6..d24307d7c 100755 --- a/admin/scripts/sort.sh +++ b/admin/scripts/sort.sh @@ -2,24 +2,23 @@ ROOT_DIR=$(dirname "$0")/.. -tmp=$(mktemp) exit_code=0 for locale_file in $ROOT_DIR/src/locales/*.json do - jq -f $(dirname "$0")/sort_filter.jq $locale_file > "$tmp" + jq -M 'to_entries | sort_by(.key) | from_entries' "$locale_file" > tmp.json + if [ "$*" == "--fix" ] then - mv "$tmp" $locale_file + mv tmp.json "$locale_file" else - if diff -q "$tmp" $locale_file > /dev/null ; + if ! diff -q tmp.json "$locale_file" > /dev/null ; then - : # all good - else - exit_code=$? - echo "$(basename -- $locale_file) is not sorted by keys" + exit_code=1 + echo "$(basename -- "$locale_file") is not sorted by keys" fi fi done +rm -f tmp.json exit $exit_code diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js b/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js index b7f01f8b8..3638f5180 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js @@ -2,6 +2,7 @@ import { mount } from '@vue/test-utils' import ContributionMessagesFormular from './ContributionMessagesFormular' import { toastErrorSpy, toastSuccessSpy } from '../../../test/testSetup' import { adminCreateContributionMessage } from '@/graphql/adminCreateContributionMessage' +import { adminUpdateContribution } from '@/graphql/adminUpdateContribution' const localVue = global.localVue @@ -12,6 +13,8 @@ describe('ContributionMessagesFormular', () => { const propsData = { contributionId: 42, + contributionMemo: 'It is a test memo', + hideResubmission: true, } const mocks = { @@ -52,9 +55,10 @@ describe('ContributionMessagesFormular', () => { await wrapper.find('form').trigger('reset') }) - it('form has empty text', () => { + it('form has empty text and memo reset to contribution memo input', () => { expect(wrapper.vm.form).toEqual({ text: '', + memo: 'It is a test memo', }) }) }) @@ -92,13 +96,14 @@ describe('ContributionMessagesFormular', () => { await wrapper.find('button[data-test="submit-dialog"]').trigger('click') }) - it('moderatorMesage has `DIALOG`', () => { + it('moderatorMessage has `DIALOG`', () => { expect(apolloMutateMock).toBeCalledWith({ mutation: adminCreateContributionMessage, variables: { contributionId: 42, message: 'text form message', messageType: 'DIALOG', + resubmissionAt: null, }, }) }) @@ -125,6 +130,80 @@ describe('ContributionMessagesFormular', () => { contributionId: 42, message: 'text form message', messageType: 'MODERATOR', + resubmissionAt: null, + }, + }) + }) + + it('toasts an success message', () => { + expect(toastSuccessSpy).toBeCalledWith('message.request') + }) + }) + + describe('send resubmission contribution message with success', () => { + const futureDate = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000) // 7 days in milliseconds + + beforeEach(async () => { + await wrapper.setData({ + form: { + text: 'text form message', + }, + showResubmissionDate: true, + resubmissionDate: futureDate, + resubmissionTime: '08:46', + }) + await wrapper.find('button[data-test="submit-moderator"]').trigger('click') + }) + + it('graphql payload contain resubmission date', () => { + const futureDateExactTime = futureDate + futureDateExactTime.setHours(8) + futureDateExactTime.setMinutes(46) + expect(apolloMutateMock).toBeCalledWith({ + mutation: adminCreateContributionMessage, + variables: { + contributionId: 42, + message: 'text form message', + messageType: 'MODERATOR', + resubmissionAt: futureDateExactTime.toString(), + }, + }) + }) + + it('toasts an success message', () => { + expect(toastSuccessSpy).toBeCalledWith('message.request') + }) + }) + + describe('set memo', () => { + beforeEach(async () => { + await wrapper.setData({ + chatOrMemo: 0, + }) + await wrapper.find('button[data-test="submit-memo"]').trigger('click') + }) + it('check chatOrMemo value is 1', () => { + expect(wrapper.vm.chatOrMemo).toBe(1) + }) + }) + + describe('update contribution memo from moderator for user created contributions', () => { + beforeEach(async () => { + await wrapper.setData({ + form: { + memo: 'changed memo', + }, + chatOrMemo: 1, + }) + await wrapper.find('button[data-test="submit-dialog"]').trigger('click') + }) + + it('adminUpdateContribution was called with contributionId and updated memo', () => { + expect(apolloMutateMock).toBeCalledWith({ + mutation: adminUpdateContribution, + variables: { + id: 42, + memo: 'changed memo', }, }) }) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue index 1286104a4..9b27f34a8 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -2,12 +2,33 @@
- + + + + + {{ $t('moderator.show-submission-form') }} + + + + + + + + + + + + {{ $t('form.cancel') }} @@ -17,7 +38,16 @@ type="button" variant="warning" class="text-black" - :disabled="disabled" + @click.prevent="enableMemo()" + data-test="submit-memo" + > + {{ $t('moderator.memo-modify') }} + + @@ -43,21 +73,39 @@ diff --git a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue index 4492fa88f..5abbb0a33 100644 --- a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue +++ b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue @@ -1,5 +1,5 @@ + @@ -145,6 +156,10 @@ export default { type: Array, required: true, }, + hideResubmission: { + type: Boolean, + required: true, + }, }, methods: { myself(item) { @@ -164,6 +179,12 @@ export default { updateStatus(id) { this.$emit('update-status', id) }, + reloadContribution(id) { + this.$emit('reload-contribution', id) + }, + updateContributions() { + this.$emit('update-contributions') + }, }, } diff --git a/admin/src/components/input/TimePicker.spec.js b/admin/src/components/input/TimePicker.spec.js new file mode 100644 index 000000000..82f51a969 --- /dev/null +++ b/admin/src/components/input/TimePicker.spec.js @@ -0,0 +1,63 @@ +import { mount } from '@vue/test-utils' +import TimePicker from './TimePicker.vue' + +describe('TimePicker', () => { + it('updates timeValue on input and emits input event', async () => { + const wrapper = mount(TimePicker, { + propsData: { + value: '12:34', // Set an initial value for testing + }, + }) + + const input = wrapper.find('input[type="text"]') + + // Simulate user input + await input.setValue('23:45') + + // Check if timeValue is updated + expect(wrapper.vm.timeValue).toBe('23:45') + + // Check if input event is emitted with updated value + expect(wrapper.emitted().input).toBeTruthy() + expect(wrapper.emitted().input[0]).toEqual(['23:45']) + }) + + it('validates and corrects time format on blur', async () => { + const wrapper = mount(TimePicker) + + const input = wrapper.find('input[type="text"]') + + // Simulate user input + await input.setValue('99:99') + expect(wrapper.emitted().input).toBeTruthy() + expect(wrapper.emitted().input[0]).toEqual(['99:99']) + + // Trigger blur event + await input.trigger('blur') + + // Check if timeValue is corrected to valid format + expect(wrapper.vm.timeValue).toBe('23:59') // Maximum allowed value for hours and minutes + + // Check if input event is emitted with corrected value + expect(wrapper.emitted().input).toBeTruthy() + expect(wrapper.emitted().input[1]).toEqual(['23:59']) + }) + + it('check handling of empty input', async () => { + const wrapper = mount(TimePicker) + const input = wrapper.find('input[type="text"]') + + // Simulate user input with non-numeric characters + await input.setValue('') + + // Trigger blur event + await input.trigger('blur') + + // Check if non-numeric characters are filtered out + expect(wrapper.vm.timeValue).toBe('00:00') + + // Check if input event is emitted with filtered value + expect(wrapper.emitted().input).toBeTruthy() + expect(wrapper.emitted().input[1]).toEqual(['00:00']) + }) +}) diff --git a/admin/src/components/input/TimePicker.vue b/admin/src/components/input/TimePicker.vue new file mode 100644 index 000000000..e8fb416ad --- /dev/null +++ b/admin/src/components/input/TimePicker.vue @@ -0,0 +1,48 @@ + + + diff --git a/admin/src/graphql/adminCreateContributionMessage.js b/admin/src/graphql/adminCreateContributionMessage.js index 66750b833..df7ca5458 100644 --- a/admin/src/graphql/adminCreateContributionMessage.js +++ b/admin/src/graphql/adminCreateContributionMessage.js @@ -1,11 +1,17 @@ import gql from 'graphql-tag' export const adminCreateContributionMessage = gql` - mutation ($contributionId: Int!, $message: String!, $messageType: ContributionMessageType) { + mutation ( + $contributionId: Int! + $message: String! + $messageType: ContributionMessageType + $resubmissionAt: String + ) { adminCreateContributionMessage( contributionId: $contributionId message: $message messageType: $messageType + resubmissionAt: $resubmissionAt ) { id message diff --git a/admin/src/graphql/adminListContributions.js b/admin/src/graphql/adminListContributions.js index 9d814b95d..5daa742b5 100644 --- a/admin/src/graphql/adminListContributions.js +++ b/admin/src/graphql/adminListContributions.js @@ -9,6 +9,7 @@ export const adminListContributions = gql` $userId: Int $query: String $noHashtag: Boolean + $hideResubmission: Boolean ) { adminListContributions( currentPage: $currentPage @@ -18,6 +19,7 @@ export const adminListContributions = gql` userId: $userId query: $query noHashtag: $noHashtag + hideResubmission: $hideResubmission ) { contributionCount contributionList { @@ -30,6 +32,8 @@ export const adminListContributions = gql` contributionDate confirmedAt confirmedBy + updatedAt + updatedBy status messagesCount deniedAt diff --git a/admin/src/graphql/adminUpdateContribution.js b/admin/src/graphql/adminUpdateContribution.js index c52a0cbc4..db2f09072 100644 --- a/admin/src/graphql/adminUpdateContribution.js +++ b/admin/src/graphql/adminUpdateContribution.js @@ -1,7 +1,7 @@ import gql from 'graphql-tag' export const adminUpdateContribution = gql` - mutation ($id: Int!, $amount: Decimal!, $memo: String!, $creationDate: String!) { + mutation ($id: Int!, $amount: Decimal, $memo: String, $creationDate: String) { adminUpdateContribution(id: $id, amount: $amount, memo: $memo, creationDate: $creationDate) { amount date diff --git a/admin/src/graphql/getContribution.js b/admin/src/graphql/getContribution.js new file mode 100644 index 000000000..34e260299 --- /dev/null +++ b/admin/src/graphql/getContribution.js @@ -0,0 +1,27 @@ +import gql from 'graphql-tag' + +export const getContribution = gql` + query ($id: Int!) { + contribution(id: $id) { + id + firstName + lastName + amount + memo + createdAt + contributionDate + confirmedAt + confirmedBy + updatedAt + updatedBy + status + messagesCount + deniedAt + deniedBy + deletedAt + deletedBy + moderatorId + userId + } + } +` diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 33ef36053..5b6fefc47 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -1,4 +1,5 @@ { + "GDD": "GDD", "all_emails": "Alle Nutzer", "back": "zurück", "change_user_role": "Nutzerrolle ändern", @@ -42,6 +43,7 @@ "createdAt": "Angelegt", "creation": "Schöpfung", "creationList": "Schöpfungsliste", + "creation_for_month": "Schöpfung für Monat", "creation_form": { "creation_for": "Aktives Grundeinkommen für", "enter_text": "Text eintragen", @@ -58,16 +60,15 @@ "toasted_update": "`Offene Schöpfung {value} GDD) für {email} wurde geändert und liegt zur Bestätigung bereit", "update_creation": "Schöpfung aktualisieren" }, - "creation_for_month": "Schöpfung für Monat", "delete": "Löschen", + "delete_user": "Nutzer löschen", "deleted": "gelöscht", "deleted_user": "Alle gelöschten Nutzer", - "delete_user": "Nutzer löschen", "deny": "Ablehnen", + "e_mail": "E-Mail", "enabled": "aktiviert", "error": "Fehler", "expired": "abgelaufen", - "e_mail": "E-Mail", "federation": { "createdAt": "Erstellt am", "gradidoInstances": "Gradido Instanzen", @@ -88,7 +89,6 @@ "cancel": "Abbrechen", "submit": "Senden" }, - "GDD": "GDD", "help": { "help": "Hilfe", "transactionlist": { @@ -99,6 +99,8 @@ } }, "hide_details": "Details verbergen", + "hide_resubmission": "Wiedervorlage verbergen", + "hide_resubmission_tooltip": "Verbirgt alle Schöpfungen für die ein Moderator ein Erinnerungsdatum festgelegt hat.", "lastname": "Nachname", "math": { "equals": "=", @@ -109,9 +111,14 @@ "request": "Die Anfrage wurde gesendet." }, "moderator": { + "chat": "Chat", "history": "Die Daten wurden geändert. Dies sind die alten Daten.", + "show-submission-form": "warten auf Erinnerung?", "moderator": "Moderator", "notice": "Moderator Notiz", + "memo": "Memo", + "memo-modify": "Memo bearbeiten", + "memo-modified": "Memo vom Moderator bearbeitet", "request": "Diese Nachricht ist nur für die Moderatoren sichtbar!" }, "name": "Name", @@ -123,9 +130,9 @@ "statistic": "Statistik", "user_search": "Nutzersuche" }, - "not_open_creations": "Keine offenen Schöpfungen", "no_hashtag": "#Hashtags verbergen", "no_hashtag_tooltip": "Zeigt nur Beiträge ohne Hashtag im Text", + "not_open_creations": "Keine offenen Schöpfungen", "open": "offen", "open_creations": "Offene Schöpfungen", "overlay": { @@ -196,7 +203,6 @@ "title": "Alle geschöpften Transaktionen für den Nutzer" }, "undelete_user": "Nutzer wiederherstellen", - "unregistered_emails": "Nur unregistrierte Nutzer", "unregister_mail": { "button": "Registrierungs-Email bestätigen, jetzt senden", "error": "Fehler beim Senden des Bestätigungs-Links an den Benutzer: {message}", @@ -206,6 +212,7 @@ "text_false": " Die letzte Email wurde am {date} Uhr an das Mitglied ({email}) gesendet.", "text_true": " Die Email wurde bestätigt." }, + "unregistered_emails": "Nur unregistrierte Nutzer", "userRole": { "notChangeYourSelf": "Als Admin/Moderator kannst du nicht selber deine Rolle ändern.", "selectLabel": "Rolle:", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index 6c8b36f15..57d375c77 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -1,4 +1,5 @@ { + "GDD": "GDD", "all_emails": "All users", "back": "back", "change_user_role": "Change user role", @@ -42,6 +43,7 @@ "createdAt": "Created at", "creation": "Creation", "creationList": "Creation list", + "creation_for_month": "Creation for month", "creation_form": { "creation_for": "Active Basic Income for", "enter_text": "Enter text", @@ -58,16 +60,15 @@ "toasted_update": "Open creation {value} GDD) for {email} has been changed and is ready for confirmation.", "update_creation": "Creation update" }, - "creation_for_month": "Creation for month", "delete": "Delete", + "delete_user": "Delete user", "deleted": "deleted", "deleted_user": "All deleted user", - "delete_user": "Delete user", "deny": "Reject", + "e_mail": "E-mail", "enabled": "enabled", "error": "Error", "expired": "expired", - "e_mail": "E-mail", "federation": { "createdAt": "Created At ", "gradidoInstances": "Gradido Instances", @@ -88,7 +89,6 @@ "cancel": "Cancel", "submit": "Send" }, - "GDD": "GDD", "help": { "help": "Help", "transactionlist": { @@ -99,6 +99,8 @@ } }, "hide_details": "Hide details", + "hide_resubmission": "Hide resubmission", + "hide_resubmission_tooltip": "Hides all creations for which a moderator has set a reminder date.", "lastname": "Lastname", "math": { "equals": "=", @@ -109,9 +111,14 @@ "request": "Request has been sent." }, "moderator": { + "chat": "Chat", "history": "The data has been changed. This is the old data.", + "show-submission-form": "wait for reminder?", "moderator": "Moderator", "notice": "Moderator note", + "memo": "Memo", + "memo-modify": "Modify Memo", + "memo-modified": "Memo edited by moderator", "request": "This message is only visible to the moderators!" }, "name": "Name", @@ -123,9 +130,9 @@ "statistic": "Statistic", "user_search": "User search" }, - "not_open_creations": "No open creations", "no_hashtag": "Hide #hashtags", "no_hashtag_tooltip": "Shows only contributions without hashtag in text", + "not_open_creations": "No open creations", "open": "open", "open_creations": "Open creations", "overlay": { @@ -196,7 +203,6 @@ "title": "All creation-transactions for the user" }, "undelete_user": "Undelete User", - "unregistered_emails": "Only unregistered users", "unregister_mail": { "button": "Confirm registration email, send now", "error": "Error sending the confirmation link to the user: {message}", @@ -206,6 +212,7 @@ "text_false": "The last email was sent to the member ({email}) on {date}.", "text_true": "The email was confirmed." }, + "unregistered_emails": "Only unregistered users", "userRole": { "notChangeYourSelf": "As an admin/moderator, you cannot change your own role.", "selectLabel": "Role:", diff --git a/admin/src/pages/CreationConfirm.spec.js b/admin/src/pages/CreationConfirm.spec.js index 36e2479aa..cba169655 100644 --- a/admin/src/pages/CreationConfirm.spec.js +++ b/admin/src/pages/CreationConfirm.spec.js @@ -4,6 +4,7 @@ import { adminDeleteContribution } from '../graphql/adminDeleteContribution' import { denyContribution } from '../graphql/denyContribution' import { adminListContributions } from '../graphql/adminListContributions' import { confirmContribution } from '../graphql/confirmContribution' +import { getContribution } from '../graphql/getContribution' import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' import VueApollo from 'vue-apollo' import { createMockClient } from 'mock-apollo-client' @@ -61,6 +62,8 @@ const defaultData = () => { contributionDate: new Date(), deletedBy: null, deletedAt: null, + updatedAt: null, + updatedBy: null, createdAt: new Date(), }, { @@ -83,6 +86,8 @@ const defaultData = () => { contributionDate: new Date(), deletedBy: null, deletedAt: null, + updatedAt: null, + updatedBy: null, createdAt: new Date(), }, ], @@ -96,6 +101,7 @@ describe('CreationConfirm', () => { const adminDeleteContributionMock = jest.fn() const adminDenyContributionMock = jest.fn() const confirmContributionMock = jest.fn() + const getContributionMock = jest.fn() mockClient.setRequestHandler( adminListContributions, @@ -121,6 +127,8 @@ describe('CreationConfirm', () => { confirmContributionMock.mockResolvedValue({ data: { confirmContribution: true } }), ) + mockClient.setRequestHandler(getContribution, getContributionMock.mockResolvedValue({ data: {} })) + const Wrapper = () => { return mount(CreationConfirm, { localVue, mocks, apolloProvider }) } @@ -141,7 +149,7 @@ describe('CreationConfirm', () => { }) }) - describe('server response is succes', () => { + describe('server response is success', () => { it('has a DIV element with the class.creation-confirm', () => { expect(wrapper.find('div.creation-confirm').exists()).toBeTruthy() }) @@ -219,7 +227,7 @@ describe('CreationConfirm', () => { expect(wrapper.find('#overlay').isVisible()).toBeTruthy() }) - describe('with succes', () => { + describe('with success', () => { describe('cancel confirmation', () => { beforeEach(async () => { await wrapper.find('#overlay').findAll('button').at(0).trigger('click') @@ -278,7 +286,7 @@ describe('CreationConfirm', () => { expect(wrapper.find('#overlay').isVisible()).toBeTruthy() }) - describe('with succes', () => { + describe('with success', () => { describe('cancel deny', () => { beforeEach(async () => { await wrapper.find('#overlay').findAll('button').at(0).trigger('click') @@ -339,6 +347,7 @@ describe('CreationConfirm', () => { it('refetches contributions with proper filter', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: false, noHashtag: null, order: 'DESC', pageSize: 25, @@ -356,6 +365,7 @@ describe('CreationConfirm', () => { it('refetches contributions with proper filter', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: true, noHashtag: null, order: 'DESC', pageSize: 25, @@ -374,6 +384,7 @@ describe('CreationConfirm', () => { it('refetches contributions with proper filter', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: false, noHashtag: null, order: 'DESC', pageSize: 25, @@ -392,6 +403,7 @@ describe('CreationConfirm', () => { it('refetches contributions with proper filter', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: false, noHashtag: null, order: 'DESC', pageSize: 25, @@ -410,6 +422,7 @@ describe('CreationConfirm', () => { it('refetches contributions with proper filter', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: false, noHashtag: null, order: 'DESC', pageSize: 25, @@ -432,6 +445,7 @@ describe('CreationConfirm', () => { it('calls the API again', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 2, + hideResubmission: false, noHashtag: null, order: 'DESC', pageSize: 25, @@ -449,6 +463,7 @@ describe('CreationConfirm', () => { it('refetches contributions with proper filter and current page = 1', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: true, noHashtag: null, order: 'DESC', pageSize: 25, @@ -472,6 +487,7 @@ describe('CreationConfirm', () => { it('calls the API with query', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: true, noHashtag: null, order: 'DESC', pageSize: 25, @@ -488,6 +504,7 @@ describe('CreationConfirm', () => { it('calls the API with empty query', () => { expect(adminListContributionsMock).toBeCalledWith({ currentPage: 1, + hideResubmission: true, noHashtag: null, order: 'DESC', pageSize: 25, @@ -510,6 +527,20 @@ describe('CreationConfirm', () => { }) }) + describe('reload contribution', () => { + beforeEach(async () => { + await wrapper + .findComponent({ name: 'OpenCreationsTable' }) + .vm.$emit('reload-contribution', 1) + }) + + it('reloaded contribution', () => { + expect(getContributionMock).toBeCalledWith({ + id: 1, + }) + }) + }) + describe('unknown variant', () => { beforeEach(async () => { await wrapper.setData({ variant: 'unknown' }) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index bd4c58983..a0cd9a8a3 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -2,10 +2,16 @@