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 @@