From eb7f8290aff7f7b43c9ee380765e185e03e90936 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 22:15:59 +0200 Subject: [PATCH 001/408] add Page Community, add query listContributionLinks --- frontend/src/components/Menu/Sidebar.vue | 4 ++ frontend/src/graphql/queries.js | 15 +++++++ frontend/src/pages/Community.vue | 50 ++++++++++++++++++++++++ frontend/src/routes/routes.js | 7 ++++ 4 files changed, 76 insertions(+) create mode 100644 frontend/src/pages/Community.vue diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index 028b7aca6..8062e5ef5 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -34,6 +34,10 @@ {{ $t('navigation.admin_area') }} + + + {{ $t('community.community') }} + {{ $t('navigation.logout') }} diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 601880a51..c6c847868 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -144,3 +144,18 @@ export const listTransactionLinks = gql` } } ` + +export const listContributionLinks = gql` + query { + listContributionLinks { + startDate + endDate + name + memo + amount + cycle + repetition + maxAmount + } + } +` diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue new file mode 100644 index 000000000..1786f30a0 --- /dev/null +++ b/frontend/src/pages/Community.vue @@ -0,0 +1,50 @@ + + diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index e68f97502..540ef9d69 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -38,6 +38,13 @@ const routes = [ requiresAuth: true, }, }, + { + path: '/community', + component: () => import('@/pages/Community.vue'), + meta: { + requiresAuth: true, + }, + }, { path: '/login/:code?', component: () => import('@/pages/Login.vue'), From 83ebf4aa2efb8396dc6ee42c8b7d3454567ee340 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 22:25:14 +0200 Subject: [PATCH 002/408] add Statistik Container --- frontend/src/pages/Community.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index 1786f30a0..a59d708d8 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -34,6 +34,20 @@ suport@gradido.net +
+ +
Statistik
+
+
+ Mitglieder + 1203 +
+
+ Mitglieder + 1203 +
+
+
diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 540ef9d69..bd8f67524 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -45,6 +45,13 @@ const routes = [ requiresAuth: true, }, }, + { + path: '/info', + component: () => import('@/pages/InfoStatistic.vue'), + meta: { + requiresAuth: true, + }, + }, { path: '/login/:code?', component: () => import('@/pages/Login.vue'), From 2759c7011d8065d1849689d60c3b178512e14ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 4 Aug 2022 12:18:50 +0200 Subject: [PATCH 025/408] Fix test in 'ContributionForm.spec.js' --- .../Contributions/ContributionForm.spec.js | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index 80dcd28c1..fdd037b63 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -7,7 +7,7 @@ const localVue = global.localVue describe('ContributionForm', () => { let wrapper - let propsData = { + const propsData = { value: { id: null, date: '', @@ -103,37 +103,13 @@ describe('ContributionForm', () => { const now = new Date().toISOString() beforeEach(async () => { - // Wolle: await wrapper.setData({ - // form: { - // id: 2, - // date: now, - // memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', - // amount: '200', - // }, - // }) - // await wrapper.setData({ - // form: { - // id: 2, - // }, - // }) - propsData = { - value: { - id: 2, - date: '', - memo: '', - amount: '', - }, - } wrapper = Wrapper() - // await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) + await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) await wrapper .find('#contribution-memo') .find('textarea') .setValue('Mein Beitrag zur Gemeinschaft für diesen Monat ...') await wrapper.find('#contribution-amount').find('input').setValue('200') - await flushPromises() - // Wolle: - await wrapper.vm.$nextTick() }) describe('has button', () => { @@ -143,21 +119,24 @@ describe('ContributionForm', () => { ).toBeFalsy() }) - it.only('submit enabled', () => { + it('submit enabled', () => { expect( wrapper.find('button[data-test="button-submit"]').attributes('disabled'), ).toBeFalsy() }) }) - describe.skip('on trigger submit', () => { + describe('on trigger submit', () => { beforeEach(async () => { // await wrapper.find('.test-submit').trigger('click') // await wrapper.find('button[type="submit"]').trigger('click') await wrapper.find('form').trigger('submit') + await flushPromises() + // Wolle: + await wrapper.vm.$nextTick() }) - it('emits "update-contribution"', () => { + it.only('emits "update-contribution"', () => { expect(wrapper.emitted('update-contribution')).toEqual( expect.arrayContaining([ expect.arrayContaining([ From f7dccb04b61a90fbe902cfa12bfa65c9b5304360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 4 Aug 2022 15:45:38 +0200 Subject: [PATCH 026/408] Fix all tests in 'ContributionForm.spec.js' --- .../Contributions/ContributionForm.spec.js | 121 ++++++++++-------- .../Contributions/ContributionForm.vue | 7 +- 2 files changed, 69 insertions(+), 59 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index fdd037b63..9dfc090f2 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -1,5 +1,4 @@ import { mount } from '@vue/test-utils' -import flushPromises from 'flush-promises' import ContributionForm from './ContributionForm.vue' const localVue = global.localVue @@ -46,64 +45,24 @@ describe('ContributionForm', () => { describe('empty form data', () => { describe('has button', () => { it('reset enabled', () => { - expect(wrapper.find('button[type="reset"]').attributes('disabled')).toBeFalsy() + expect( + wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), + ).toBeFalsy() }) it('submit disabled', () => { - expect(wrapper.find('button[type="submit"]').attributes('disabled')).toBe('disabled') + expect(wrapper.find('button[data-test="button-submit"]').attributes('disabled')).toBe( + 'disabled', + ) }) }) }) describe('set contrubtion', () => { - describe('fill in form data', () => { + describe('fill in form data with "id === null"', () => { const now = new Date().toISOString() beforeEach(async () => { - await wrapper.setData({ - form: { - id: null, - date: now, - memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', - amount: '200', - }, - }) - }) - - describe('has button', () => { - it('reset enabled', () => { - expect(wrapper.find('button[type="reset"]').attributes('disabled')).toBeFalsy() - }) - - it('submit enabled', () => { - expect(wrapper.find('button[type="submit"]').attributes('disabled')).toBeFalsy() - }) - }) - - describe.skip('on trigger submit', () => { - beforeEach(async () => { - // await wrapper.find('.test-submit').trigger('click') - await wrapper.find('button[type="submit"]').trigger('click') - }) - - it('emits "set-contribution"', () => { - expect(wrapper.emitted('set-contribution')).toEqual({ - id: null, - date: now, - memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', - amount: '200', - }) - }) - }) - }) - }) - - describe('update contrubtion', () => { - describe('fill in form data and "id"', () => { - const now = new Date().toISOString() - - beforeEach(async () => { - wrapper = Wrapper() await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) await wrapper .find('#contribution-memo') @@ -128,15 +87,69 @@ describe('ContributionForm', () => { describe('on trigger submit', () => { beforeEach(async () => { - // await wrapper.find('.test-submit').trigger('click') - // await wrapper.find('button[type="submit"]').trigger('click') await wrapper.find('form').trigger('submit') - await flushPromises() - // Wolle: - await wrapper.vm.$nextTick() }) - it.only('emits "update-contribution"', () => { + it('emits "set-contribution"', () => { + expect(wrapper.emitted('set-contribution')).toEqual( + expect.arrayContaining([ + expect.arrayContaining([ + { + id: null, + date: now, + memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', + amount: '200', + }, + ]), + ]), + ) + }) + }) + }) + }) + + describe('update contrubtion', () => { + describe('fill in form data with set "id"', () => { + const now = new Date().toISOString() + + beforeEach(async () => { + wrapper = Wrapper() + await wrapper.setData({ + form: { + id: 2, + date: now, + memo: 'Mein kommerzieller Beitrag für diesen Monat ...', + amount: '100', + }, + }) + await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) + await wrapper + .find('#contribution-memo') + .find('textarea') + .setValue('Mein Beitrag zur Gemeinschaft für diesen Monat ...') + await wrapper.find('#contribution-amount').find('input').setValue('200') + }) + + describe('has button', () => { + it('reset enabled', () => { + expect( + wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), + ).toBeFalsy() + }) + + it('submit enabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBeFalsy() + }) + }) + + describe('on trigger submit', () => { + beforeEach(async () => { + await wrapper.find('form').trigger('submit') + }) + + it('emits "update-contribution"', () => { expect(wrapper.emitted('update-contribution')).toEqual( expect.arrayContaining([ expect.arrayContaining([ diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 5434881ab..e19fb2b9a 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -98,11 +98,8 @@ export default { }, methods: { submit() { - if (this.form.id) { - this.$emit('update-contribution', this.form) - } else { - this.$emit('set-contribution', this.form) - } + // this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', this.form) // is not working for testing + this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form }) // this works for testing, why ever, we have to make a spread '...', to evaluate the values it looks like this.reset() }, reset() { From 9c8f76d080ff1daee0ec5847fa77d4a62dd883ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 4 Aug 2022 16:02:15 +0200 Subject: [PATCH 027/408] Write new tests in 'ContributionForm.spec.js' --- .../Contributions/ContributionForm.spec.js | 52 +++++++++++++------ .../Contributions/ContributionForm.vue | 6 ++- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index 9dfc090f2..298f4a82f 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -72,16 +72,26 @@ describe('ContributionForm', () => { }) describe('has button', () => { - it('reset enabled', () => { - expect( - wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), - ).toBeFalsy() + describe('reset', () => { + it('enabled', () => { + expect( + wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), + ).toBeFalsy() + }) }) - it('submit enabled', () => { - expect( - wrapper.find('button[data-test="button-submit"]').attributes('disabled'), - ).toBeFalsy() + describe('submit', () => { + it('enabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBeFalsy() + }) + + it('labeled with "contribution.submit"', () => { + expect(wrapper.find('button[data-test="button-submit"]').text()).toContain( + 'contribution.submit', + ) + }) }) }) @@ -131,16 +141,26 @@ describe('ContributionForm', () => { }) describe('has button', () => { - it('reset enabled', () => { - expect( - wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), - ).toBeFalsy() + describe('reset', () => { + it('enabled', () => { + expect( + wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), + ).toBeFalsy() + }) }) - it('submit enabled', () => { - expect( - wrapper.find('button[data-test="button-submit"]').attributes('disabled'), - ).toBeFalsy() + describe('submit', () => { + it('enabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBeFalsy() + }) + + it('labeled with "form.change"', () => { + expect(wrapper.find('button[data-test="button-submit"]').text()).toContain( + 'form.change', + ) + }) }) }) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index e19fb2b9a..a24c07ec2 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -98,8 +98,10 @@ export default { }, methods: { submit() { - // this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', this.form) // is not working for testing - this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form }) // this works for testing, why ever, we have to make a spread '...', to evaluate the values it looks like + // not working for testing: + // this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', this.form) + // works for testing, why ever, we have to make a spread '...', to evaluate the values it looks like: (I didn't find a solution in the test itmself) + this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form }) this.reset() }, reset() { From 6823ff548804a9f0600dbc0a81e74100c22a1e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 4 Aug 2022 16:06:48 +0200 Subject: [PATCH 028/408] Fix locales --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index d06299245..0deec9ae1 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -105,12 +105,12 @@ "amount": "Betrag", "at": "am", "cancel": "Abbrechen", + "change": "Ändern", "check_now": "Jetzt prüfen", "close": "Schließen", "current_balance": "Aktueller Kontostand", "date": "Datum", "description": "Beschreibung", - "change": "Ändern", "email": "E-Mail", "firstname": "Vorname", "from": "Von", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index de1ee6900..65b7abc87 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -105,12 +105,12 @@ "amount": "Amount", "at": "at", "cancel": "Cancel", + "change": "Change", "check_now": "Check now", "close": "Close", "current_balance": "Current Balance", "date": "Date", "description": "Description", - "change": "Change", "email": "Email", "firstname": "Firstname", "from": "from", From 4ab160ec44ec04d1cea76d93deea0a4ed87f41e9 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 5 Aug 2022 11:15:38 +0200 Subject: [PATCH 029/408] =?UTF-8?q?add=20query=20listContributionLinks=1B[?= =?UTF-8?q?D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/graphql/queries.js | 27 ++++++++++------ frontend/src/locales/de.json | 3 +- frontend/src/locales/en.json | 3 +- frontend/src/pages/InfoStatistic.vue | 46 +++++++++++++++++++++++++--- 4 files changed, 63 insertions(+), 16 deletions(-) diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index fdbbd1e93..ab7cc849f 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -164,16 +164,23 @@ export const listTransactionLinks = gql` ` export const listContributionLinks = gql` - query { - listContributionLinks { - startDate - endDate - name - memo - amount - cycle - repetition - maxAmount + query($currentPage: Int = 1, $pageSize: Int = 25, $order: Order = DESC) { + listContributionLinks(currentPage: $currentPage, pageSize: $pageSize, order: $order) { + links { + id + amount + name + memo + code + link + createdAt + validFrom + validTo + maxAmountPerMonth + cycle + maxPerCycle + } + count } } ` diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 1db4d75a6..e98d53287 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -63,7 +63,8 @@ "updated": "Der Beitrag wurde geändert." }, "contribution-link": { - "thanksYouWith": "dankt dir mit" + "thanksYouWith": "dankt dir mit", + "unique":"( einmalig )" }, "decay": { "before_startblock_transaction": "Diese Transaktion beinhaltet keine Vergänglichkeit.", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 8c6caf7df..8b7cff5aa 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -63,7 +63,8 @@ "updated": "The contribution was changed." }, "contribution-link": { - "thanksYouWith": "thanks you with" + "thanksYouWith": "thanks you with", + "unique":"( unique )" }, "decay": { "before_startblock_transaction": "This transaction does not include decay.", diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index 6363292f7..464dfd1a9 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -17,17 +17,25 @@ {{ $t('community.openContributionLinkText', { _name_: CONFIG.COMMUNITY_NAME }) }} + Momentan gibt es aktuell {{ count }} Aktionen.
    -
  • {{ item.id }}
  • +
  • +
    {{ item.name }}
    +
    {{ item.memo }}
    +
    + {{ item.amount | GDD }} + {{ $t('contribution-link.unique') }} +
    +

{{ $t('community.moderators') }}
    -
  • {{ item.id }}
  • +
  • {{ item.name }}
- {{ supportMail }} + {{ supportMail }}

@@ -43,16 +51,46 @@ From 45f877f559e3ab88e68d795dc03e6b2020973fbe Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 5 Aug 2022 11:20:23 +0200 Subject: [PATCH 030/408] add count to the locales: openContributionLinkText --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- frontend/src/pages/InfoStatistic.vue | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index e98d53287..bed4e0be6 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -30,7 +30,7 @@ "moderators": "Moderatoren", "myContributions": "Meine Beiträge zum Gemeinwohl", "openContributionLinks": "öffentliche Beitragslinklist", - "openContributionLinkText": "Folgende automatische Schöpfungen werden zur Zeit durch die Gemeinschaft '{_name_}' bereitgestellt.", + "openContributionLinkText": "Folgende {_count_} automatische Schöpfungen werden zur Zeit durch die Gemeinschaft '{_name_}' bereitgestellt.", "other-communities": "Weitere Gemeinschaften", "statistic": "Statistik", "submitContribution": "Beitrag einreichen", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 8b7cff5aa..ffef7c441 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -30,7 +30,7 @@ "moderators": "Moderators", "myContributions": "My contributions to the common good", "openContributionLinks": "open Contribution links list", - "openContributionLinkText": "The following automatic creations are currently provided by the '{_name_}' community.", + "openContributionLinkText": "The following {_count_} automatic creations are currently provided by the '{_name_}' community.", "other-communities": "Other communities", "statistic": "Statistics", "submitContribution": "Submit contribution", diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index 464dfd1a9..f8aaefbf3 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -15,9 +15,13 @@
{{ $t('community.openContributionLinks') }}
- {{ $t('community.openContributionLinkText', { _name_: CONFIG.COMMUNITY_NAME }) }} + {{ + $t('community.openContributionLinkText', { + _name_: CONFIG.COMMUNITY_NAME, + _count_: count, + }) + }} - Momentan gibt es aktuell {{ count }} Aktionen.
  • {{ item.name }}
    From 7fbdbb521784ebe3e491ec99bf34c62c48cfe09d Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 5 Aug 2022 11:58:48 +0200 Subject: [PATCH 031/408] spec test for info page --- frontend/src/graphql/queries.js | 2 - frontend/src/pages/InfoStatistic.spec.js | 77 ++++++++++++++++++++++++ frontend/src/pages/InfoStatistic.vue | 2 +- 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 frontend/src/pages/InfoStatistic.spec.js diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index ab7cc849f..b7d778147 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -171,8 +171,6 @@ export const listContributionLinks = gql` amount name memo - code - link createdAt validFrom validTo diff --git a/frontend/src/pages/InfoStatistic.spec.js b/frontend/src/pages/InfoStatistic.spec.js new file mode 100644 index 000000000..ade3a0340 --- /dev/null +++ b/frontend/src/pages/InfoStatistic.spec.js @@ -0,0 +1,77 @@ +import { mount } from '@vue/test-utils' +import InfoStatistic from './InfoStatistic' +import { toastErrorSpy } from '../../test/testSetup' + +const localVue = global.localVue + +const apolloQueryMock = jest.fn().mockResolvedValue({ + data: { + listContributionLinks: { + count: 2, + links: [ + { + id: 1, + amount: 200, + name: 'Dokumenta 2017', + memo: 'Vielen Dank für deinen Besuch bei der Dokumenta 2017', + cycle: 'ONCE', + }, + { + id: 2, + amount: 200, + name: 'Dokumenta 2022', + memo: 'Vielen Dank für deinen Besuch bei der Dokumenta 2022', + cycle: 'ONCE', + }, + ], + }, + }, +}) + +describe('InfoStatistic', () => { + let wrapper + + const mocks = { + $i18n: { + locale: 'en', + }, + $t: jest.fn((t) => t), + $apollo: { + query: apolloQueryMock, + }, + } + + const Wrapper = () => { + return mount(InfoStatistic, { localVue, mocks }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the info page', () => { + expect(wrapper.find('div.info-statistic').exists()).toBe(true) + }) + + it('calls listUnconfirmedContributions', () => { + expect(apolloQueryMock).toBeCalled() + }) + + describe('error apolloQueryMock', () => { + beforeEach(async () => { + apolloQueryMock.mockRejectedValue({ + message: 'uups', + }) + wrapper = Wrapper() + jest.clearAllMocks() + }) + + it('toasts the error message', () => { + expect(toastErrorSpy).toBeCalledWith( + 'listContributionLinks has no result, use default data', + ) + }) + }) + }) +}) diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index f8aaefbf3..7b48eaf64 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -1,5 +1,5 @@ diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 540ef9d69..2c727304b 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -34,6 +34,15 @@ const routes = [ { path: '/transactions', component: () => import('@/pages/Transactions.vue'), + props: { gdt: false }, + meta: { + requiresAuth: true, + }, + }, + { + path: '/gdt', + component: () => import('@/pages/Transactions.vue'), + props: { gdt: true }, meta: { requiresAuth: true, }, From 6be065b0b68a276def8589ff73a6ba6a07499de4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Sun, 7 Aug 2022 13:11:01 +0200 Subject: [PATCH 038/408] add tests for navbar and sidebar --- frontend/src/components/Menu/Navbar.spec.js | 24 ++++++++++++-------- frontend/src/components/Menu/Navbar.vue | 4 ++++ frontend/src/components/Menu/Sidebar.spec.js | 24 ++++++++++++-------- frontend/src/pages/Transactions.spec.js | 6 +++++ frontend/src/routes/router.test.js | 13 ++++++++++- 5 files changed, 50 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/Menu/Navbar.spec.js b/frontend/src/components/Menu/Navbar.spec.js index 3f12682c0..a348ffa9c 100644 --- a/frontend/src/components/Menu/Navbar.spec.js +++ b/frontend/src/components/Menu/Navbar.spec.js @@ -49,7 +49,7 @@ describe('Navbar', () => { }) it('has ten b-nav-item in the navbar', () => { - expect(wrapper.findAll('.nav-item')).toHaveLength(11) + expect(wrapper.findAll('.nav-item')).toHaveLength(12) }) it('has first nav-item "amount GDD" in navbar', () => { @@ -68,29 +68,33 @@ describe('Navbar', () => { expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.transactions') }) - it('has first nav-item "navigation.transactions" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.community') + it('has first nav-item "gdt.gdt" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('gdt.gdt') + }) + + it('has first nav-item "navigation.community" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.community') }) it('has first nav-item "navigation.profile" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.profile') + expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.profile') }) }) describe('navigation Navbar (user has an elopage account)', () => { it('has a link to the members area', () => { - expect(wrapper.findAll('.nav-item').at(8).text()).toContain('navigation.members_area') - expect(wrapper.findAll('.nav-item').at(8).find('a').attributes('href')).toBe( + expect(wrapper.findAll('.nav-item').at(9).text()).toContain('navigation.members_area') + expect(wrapper.findAll('.nav-item').at(9).find('a').attributes('href')).toBe( 'https://elopage.com', ) }) it('has first nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.admin_area') + expect(wrapper.findAll('.nav-item').at(10).text()).toEqual('navigation.admin_area') }) it('has first nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(10).text()).toEqual('navigation.logout') + expect(wrapper.findAll('.nav-item').at(11).text()).toEqual('navigation.logout') }) }) @@ -101,11 +105,11 @@ describe('Navbar', () => { }) it('has first nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.admin_area') + expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.admin_area') }) it('has first nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.logout') + expect(wrapper.findAll('.nav-item').at(10).text()).toEqual('navigation.logout') }) }) }) diff --git a/frontend/src/components/Menu/Navbar.vue b/frontend/src/components/Menu/Navbar.vue index ef222fdb4..a0f6e5a9d 100644 --- a/frontend/src/components/Menu/Navbar.vue +++ b/frontend/src/components/Menu/Navbar.vue @@ -52,6 +52,10 @@ {{ $t('navigation.transactions') }} + + + {{ $t('gdt.gdt') }} + {{ $t('navigation.community') }} diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index 1593a79a8..1ffa8bf15 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -45,31 +45,35 @@ describe('Sidebar', () => { expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('navigation.transactions') }) + it('has first nav-item "gdt.gdt" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('gdt.gdt') + }) + it('has first nav-item "navigation.community" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(3).text()).toContain('navigation.community') + expect(wrapper.findAll('.nav-item').at(4).text()).toContain('navigation.community') }) it('has first nav-item "navigation.profile" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.profile') + expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.profile') }) }) describe('navigation Navbar (user has an elopage account)', () => { it('has eight b-nav-item in the navbar', () => { - expect(wrapper.findAll('.nav-item')).toHaveLength(8) + expect(wrapper.findAll('.nav-item')).toHaveLength(9) }) it('has a link to the members area', () => { - expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.members_area') - expect(wrapper.findAll('.nav-item').at(5).find('a').attributes('href')).toBe('#') + expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.members_area') + expect(wrapper.findAll('.nav-item').at(6).find('a').attributes('href')).toBe('#') }) it('has first nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area') + expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.admin_area') }) it('has first nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout') + expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.logout') }) }) @@ -80,15 +84,15 @@ describe('Sidebar', () => { }) it('has seven b-nav-item in the navbar', () => { - expect(wrapper.findAll('.nav-item')).toHaveLength(7) + expect(wrapper.findAll('.nav-item')).toHaveLength(8) }) it('has first nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.admin_area') + expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area') }) it('has first nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.logout') + expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout') }) }) }) diff --git a/frontend/src/pages/Transactions.spec.js b/frontend/src/pages/Transactions.spec.js index 94e0f51c1..d364d3be7 100644 --- a/frontend/src/pages/Transactions.spec.js +++ b/frontend/src/pages/Transactions.spec.js @@ -1,11 +1,13 @@ import { mount } from '@vue/test-utils' import Transactions from './Transactions' import { GdtEntryType } from '@/graphql/enums' +import flushPromises from 'flush-promises' import { toastErrorSpy } from '@test/testSetup' const localVue = global.localVue +const mockRouterReplace = jest.fn() const windowScrollToMock = jest.fn() window.scrollTo = windowScrollToMock @@ -39,6 +41,9 @@ describe('Transactions', () => { $apollo: { query: apolloMock, }, + $router: { + push: mockRouterReplace, + }, } const Wrapper = () => { @@ -158,6 +163,7 @@ describe('Transactions', () => { describe('click on GDD tab', () => { beforeEach(() => { + flushPromises() wrapper.findAll('li[ role="presentation"]').at(0).find('a').trigger('click') }) diff --git a/frontend/src/routes/router.test.js b/frontend/src/routes/router.test.js index 2eefaeb36..d3f9cf992 100644 --- a/frontend/src/routes/router.test.js +++ b/frontend/src/routes/router.test.js @@ -50,7 +50,7 @@ describe('router', () => { }) it('has sixteen routes defined', () => { - expect(routes).toHaveLength(17) + expect(routes).toHaveLength(18) }) describe('overview', () => { @@ -108,6 +108,17 @@ describe('router', () => { }) }) + describe('gdt', () => { + it('requires authorization', () => { + expect(routes.find((r) => r.path === '/gdt').meta.requiresAuth).toBeTruthy() + }) + + it('loads the "GDT" page', async () => { + const component = await routes.find((r) => r.path === '/gdt').component() + expect(component.default.name).toBe('Transactions') + }) + }) + describe('login', () => { it('loads the "Login" page', async () => { const component = await routes.find((r) => r.path === '/login/:code?').component() From 3c632e0d631b8457c9b37a6ac256c55495a6fc49 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 8 Aug 2022 09:37:04 +0200 Subject: [PATCH 039/408] fix test add mockRouterReplace --- frontend/src/pages/Transactions.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/Transactions.spec.js b/frontend/src/pages/Transactions.spec.js index d364d3be7..822a8f558 100644 --- a/frontend/src/pages/Transactions.spec.js +++ b/frontend/src/pages/Transactions.spec.js @@ -42,7 +42,7 @@ describe('Transactions', () => { query: apolloMock, }, $router: { - push: mockRouterReplace, + replace: mockRouterReplace, }, } From d377fc0241ef9c0cc53018c015c545cdbb2b33bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 8 Aug 2022 11:25:49 +0200 Subject: [PATCH 040/408] Add invalid tests for memo length --- .../Contributions/ContributionForm.spec.js | 277 ++++++++++++------ .../Contributions/ContributionForm.vue | 2 + 2 files changed, 196 insertions(+), 83 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index 52e876de9..6d6f2164b 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -66,58 +66,118 @@ describe('ContributionForm', () => { const now = new Date().toISOString() beforeEach(async () => { - await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) - await wrapper - .find('#contribution-memo') - .find('textarea') - .setValue('Mein Beitrag zur Gemeinschaft für diesen Monat ...') - await wrapper.find('#contribution-amount').find('input').setValue('200') + await wrapper.setData({ + form: { + id: null, + date: '', + memo: '', + amount: '', + }, + }) }) - describe('buttons', () => { - describe('reset', () => { - it('has enabled', () => { - expect( - wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), - ).toBeFalsy() + describe('invalid form data', () => { + beforeEach(async () => { + await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) + await wrapper.find('#contribution-amount').find('input').setValue('200') + }) + + describe('memo lenght < 5, others are valid', () => { + beforeEach(async () => { + await wrapper.find('#contribution-memo').find('textarea').setValue('1234') + }) + + describe('buttons', () => { + describe('submit', () => { + it('has disabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBe('disabled') + }) + }) }) }) - describe('submit', () => { - it('has enabled', () => { - expect( - wrapper.find('button[data-test="button-submit"]').attributes('disabled'), - ).toBeFalsy() + describe('memo lenght > 255, others are valid', () => { + beforeEach(async () => { + await wrapper + .find('#contribution-memo') + .find('textarea') + .setValue( + '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' + + '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' + + '01234567890123456789012345678901234567890123456789012345', + ) + await wrapper.vm.$nextTick() }) - it('has label "contribution.submit"', () => { - expect(wrapper.find('button[data-test="button-submit"]').text()).toContain( - 'contribution.submit', + describe('buttons', () => { + describe('submit', () => { + it('has disabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBe('disabled') + }) + }) + }) + }) + }) + + describe('valid form data', () => { + beforeEach(async () => { + await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) + await wrapper + .find('#contribution-memo') + .find('textarea') + .setValue('Mein Beitrag zur Gemeinschaft für diesen Monat ...') + await wrapper.find('#contribution-amount').find('input').setValue('200') + }) + + describe('buttons', () => { + describe('reset', () => { + it('has enabled', () => { + expect( + wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), + ).toBeFalsy() + }) + }) + + describe('submit', () => { + it('has enabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBeFalsy() + }) + + it('has label "contribution.submit"', () => { + expect(wrapper.find('button[data-test="button-submit"]').text()).toContain( + 'contribution.submit', + ) + }) + }) + }) + + describe('on trigger submit', () => { + beforeEach(async () => { + await wrapper.find('form').trigger('submit') + }) + + it('emits "set-contribution"', () => { + expect(wrapper.emitted('set-contribution')).toEqual( + expect.arrayContaining([ + expect.arrayContaining([ + { + id: null, + date: now, + memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', + amount: '200', + }, + ]), + ]), ) }) }) }) - - describe('on trigger submit', () => { - beforeEach(async () => { - await wrapper.find('form').trigger('submit') - }) - - it('emits "set-contribution"', () => { - expect(wrapper.emitted('set-contribution')).toEqual( - expect.arrayContaining([ - expect.arrayContaining([ - { - id: null, - date: now, - memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', - amount: '200', - }, - ]), - ]), - ) - }) - }) }) }) @@ -126,7 +186,6 @@ describe('ContributionForm', () => { const now = new Date().toISOString() beforeEach(async () => { - wrapper = Wrapper() await wrapper.setData({ form: { id: 2, @@ -135,58 +194,110 @@ describe('ContributionForm', () => { amount: '100', }, }) - await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) - await wrapper - .find('#contribution-memo') - .find('textarea') - .setValue('Mein Beitrag zur Gemeinschaft für diesen Monat ...') - await wrapper.find('#contribution-amount').find('input').setValue('200') }) - describe('buttons', () => { - describe('reset', () => { - it('has enabled', () => { - expect( - wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), - ).toBeFalsy() + describe('invalid form data', () => { + beforeEach(async () => { + await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) + await wrapper.find('#contribution-amount').find('input').setValue('200') + }) + + describe('memo lenght < 5, others are valid', () => { + beforeEach(async () => { + await wrapper.find('#contribution-memo').find('textarea').setValue('1234') + }) + + describe('buttons', () => { + describe('submit', () => { + it('has disabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBe('disabled') + }) + }) }) }) - describe('submit', () => { - it('has enabled', () => { - expect( - wrapper.find('button[data-test="button-submit"]').attributes('disabled'), - ).toBeFalsy() + describe('memo lenght > 255, others are valid', () => { + beforeEach(async () => { + await wrapper + .find('#contribution-memo') + .find('textarea') + .setValue( + '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' + + '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' + + '01234567890123456789012345678901234567890123456789012345', + ) + await wrapper.vm.$nextTick() }) - it('has label "form.change"', () => { - expect(wrapper.find('button[data-test="button-submit"]').text()).toContain( - 'form.change', + describe('buttons', () => { + describe('submit', () => { + it('has disabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBe('disabled') + }) + }) + }) + }) + }) + + describe('valid form data', () => { + beforeEach(async () => { + await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) + await wrapper + .find('#contribution-memo') + .find('textarea') + .setValue('Mein Beitrag zur Gemeinschaft für diesen Monat ...') + await wrapper.find('#contribution-amount').find('input').setValue('200') + }) + + describe('buttons', () => { + describe('reset', () => { + it('has enabled', () => { + expect( + wrapper.find('button[data-test="button-cancel"]').attributes('disabled'), + ).toBeFalsy() + }) + }) + + describe('submit', () => { + it('has enabled', () => { + expect( + wrapper.find('button[data-test="button-submit"]').attributes('disabled'), + ).toBeFalsy() + }) + + it('has label "form.change"', () => { + expect(wrapper.find('button[data-test="button-submit"]').text()).toContain( + 'form.change', + ) + }) + }) + }) + + describe('on trigger submit', () => { + beforeEach(async () => { + await wrapper.find('form').trigger('submit') + }) + + it('emits "update-contribution"', () => { + expect(wrapper.emitted('update-contribution')).toEqual( + expect.arrayContaining([ + expect.arrayContaining([ + { + id: 2, + date: now, + memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', + amount: '200', + }, + ]), + ]), ) }) }) }) - - describe('on trigger submit', () => { - beforeEach(async () => { - await wrapper.find('form').trigger('submit') - }) - - it('emits "update-contribution"', () => { - expect(wrapper.emitted('update-contribution')).toEqual( - expect.arrayContaining([ - expect.arrayContaining([ - { - id: 2, - date: now, - memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', - amount: '200', - }, - ]), - ]), - ) - }) - }) }) }) }) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 19731c683..d890e6a1e 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -127,9 +127,11 @@ export default { return new Date(this.maximalDate.getFullYear(), this.maximalDate.getMonth() - 1, 1) }, disabled() { + // Wolle: refactor if ( this.form.date === '' || this.form.memo.length < this.minlength || + this.form.memo.length > this.maxlength || this.form.amount <= 0 || this.form.amount > 1000 || (this.isThisMonth && parseInt(this.form.amount) > parseInt(this.maxGddThisMonth)) || From d49a99fcfffc16628d8b9ea399b6830758ab134d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 8 Aug 2022 11:28:31 +0200 Subject: [PATCH 041/408] Refactor method 'disabled' --- frontend/src/components/Contributions/ContributionForm.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index d890e6a1e..e9feb72d7 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -127,8 +127,7 @@ export default { return new Date(this.maximalDate.getFullYear(), this.maximalDate.getMonth() - 1, 1) }, disabled() { - // Wolle: refactor - if ( + return ( this.form.date === '' || this.form.memo.length < this.minlength || this.form.memo.length > this.maxlength || @@ -137,8 +136,6 @@ export default { (this.isThisMonth && parseInt(this.form.amount) > parseInt(this.maxGddThisMonth)) || (!this.isThisMonth && parseInt(this.form.amount) > parseInt(this.maxGddLastMonth)) ) - return true - return false }, lastMonthObject() { // Wolle: refine logic and melt with 'thisMonthObject' From f15d085450f89fdea677526a43006462fce24ddb Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 8 Aug 2022 12:45:10 +0200 Subject: [PATCH 042/408] add statistics overview for admin area --- admin/src/components/CommunityStatistic.vue | 63 +++++++++++++++++++++ admin/src/config/index.js | 5 ++ admin/src/locales/de.json | 11 ++++ admin/src/locales/en.json | 11 ++++ admin/src/pages/Overview.vue | 36 ++++++++++++ 5 files changed, 126 insertions(+) create mode 100644 admin/src/components/CommunityStatistic.vue diff --git a/admin/src/components/CommunityStatistic.vue b/admin/src/components/CommunityStatistic.vue new file mode 100644 index 000000000..ca450bf3d --- /dev/null +++ b/admin/src/components/CommunityStatistic.vue @@ -0,0 +1,63 @@ + + diff --git a/admin/src/config/index.js b/admin/src/config/index.js index fe373386d..7468227ef 100644 --- a/admin/src/config/index.js +++ b/admin/src/config/index.js @@ -32,6 +32,10 @@ const endpoints = { WALLET_URL: process.env.WALLET_URL || 'http://localhost/login', } +const community = { + COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung', +} + const debug = { DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' || false, } @@ -53,6 +57,7 @@ const CONFIG = { ...version, ...environment, ...endpoints, + ...community, ...debug, } diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 3d88e0257..22cb833bf 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -73,6 +73,7 @@ "hide_details": "Details verbergen", "lastname": "Nachname", "math": { + "colon": ":", "exclaim": "!", "pipe": "|", "plus": "+" @@ -105,6 +106,16 @@ "removeNotSelf": "Als Admin/Moderator kannst du dich nicht selber löschen.", "remove_all": "alle Nutzer entfernen", "save": "Speichern", + "statistic": { + "activeUsers": "aktive Mitglieder", + "deletedUsers": "gelöschte Mitglieder", + "name": "Statistik", + "totalGradidoAvailable": "GDD insgesamt im Umflauf", + "totalGradidoCreated": "GDD insgesamt geschöpft", + "totalGradidoDecayed": "GDD insgesamt verfallen", + "totalGradidoUnbookedDecayed": "GDD nicht gebuchter verfall", + "totalUsers": "Mitglieder" + }, "status": "Status", "success": "Erfolg", "text": "Text", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index f23c61e21..ca5928bcd 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -73,6 +73,7 @@ "hide_details": "Hide details", "lastname": "Lastname", "math": { + "colon": ":", "exclaim": "!", "pipe": "|", "plus": "+" @@ -105,6 +106,16 @@ "removeNotSelf": "As an admin/moderator, you cannot delete yourself.", "remove_all": "Remove all users", "save": "Speichern", + "statistic": { + "activeUsers": "active members", + "deletedUsers": "deleted members", + "name": "Statistic", + "totalGradidoAvailable": "Total GDD in circulation", + "totalGradidoCreated": "GDD total created", + "totalGradidoDecayed": "Total GDD decayed", + "totalGradidoUnbookedDecayed": "GDD not booked decayed", + "totalUsers": "Members" + }, "status": "Status", "success": "Success", "text": "Text", diff --git a/admin/src/pages/Overview.vue b/admin/src/pages/Overview.vue index 69aa15c1a..cbe0c1ae1 100644 --- a/admin/src/pages/Overview.vue +++ b/admin/src/pages/Overview.vue @@ -29,22 +29,36 @@ + diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.vue b/admin/src/components/ContributionMessages/ContributionMessagesList.vue new file mode 100644 index 000000000..2f1c038d2 --- /dev/null +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.vue @@ -0,0 +1,47 @@ + + diff --git a/admin/src/components/Tables/OpenCreationsTable.vue b/admin/src/components/Tables/OpenCreationsTable.vue index 3ebc81fba..2b8956206 100644 --- a/admin/src/components/Tables/OpenCreationsTable.vue +++ b/admin/src/components/Tables/OpenCreationsTable.vue @@ -21,6 +21,9 @@ > + + + @@ -58,6 +69,8 @@ import { toggleRowDetails } from '../../mixins/toggleRowDetails' import RowDetails from '../RowDetails.vue' import EditCreationFormular from '../EditCreationFormular.vue' +import ContributionMessagesFormular from '../ContributionMessages/ContributionMessagesFormular.vue' +import ContributionMessagesList from '../ContributionMessages/ContributionMessagesList.vue' export default { name: 'OpenCreationsTable', @@ -65,6 +78,8 @@ export default { components: { EditCreationFormular, RowDetails, + ContributionMessagesFormular, + ContributionMessagesList, }, props: { items: { From edbe59b5bac2db05eb54335b866e05481608a424 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 18 Aug 2022 10:36:20 +0200 Subject: [PATCH 190/408] fix lint --- .../ContributionMessagesList.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.vue b/admin/src/components/ContributionMessages/ContributionMessagesList.vue index 2f1c038d2..18fbdc56d 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.vue @@ -1,10 +1,12 @@ + diff --git a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue new file mode 100644 index 000000000..74d349d12 --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue @@ -0,0 +1,16 @@ + + diff --git a/admin/src/components/ContributionMessages/slots/IsModerator.vue b/admin/src/components/ContributionMessages/slots/IsModerator.vue new file mode 100644 index 000000000..1fd284b65 --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/IsModerator.vue @@ -0,0 +1,27 @@ + + + diff --git a/admin/src/components/ContributionMessages/slots/IsNotModerator.vue b/admin/src/components/ContributionMessages/slots/IsNotModerator.vue new file mode 100644 index 000000000..8554fdcf1 --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/IsNotModerator.vue @@ -0,0 +1,33 @@ + + + diff --git a/admin/src/components/Tables/OpenCreationsTable.vue b/admin/src/components/Tables/OpenCreationsTable.vue index 2b8956206..649435798 100644 --- a/admin/src/components/Tables/OpenCreationsTable.vue +++ b/admin/src/components/Tables/OpenCreationsTable.vue @@ -51,12 +51,7 @@ />
    - -
    -
    -
    -
    @@ -69,7 +64,7 @@ import { toggleRowDetails } from '../../mixins/toggleRowDetails' import RowDetails from '../RowDetails.vue' import EditCreationFormular from '../EditCreationFormular.vue' -import ContributionMessagesFormular from '../ContributionMessages/ContributionMessagesFormular.vue' + import ContributionMessagesList from '../ContributionMessages/ContributionMessagesList.vue' export default { @@ -78,7 +73,6 @@ export default { components: { EditCreationFormular, RowDetails, - ContributionMessagesFormular, ContributionMessagesList, }, props: { From 2a093c234f59294423ddb8b44b980d5c508d2726 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 18 Aug 2022 15:28:50 +0200 Subject: [PATCH 216/408] fix lint --- .../components/ContributionMessages/ContributionMessagesList.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.vue b/admin/src/components/ContributionMessages/ContributionMessagesList.vue index 409ceb6b1..65484b14e 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.vue @@ -1,7 +1,6 @@ diff --git a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue index 74d349d12..a1d9565c0 100644 --- a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue +++ b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue @@ -1,15 +1,37 @@ diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue index c8d53868d..f8130f2bc 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue @@ -5,12 +5,11 @@ -
    -
    -
    @@ -38,6 +37,11 @@ export default { required: true, }, }, + methods: { + toggleContributionMessagesBox(id) { + this.$emit('toggle-contribution-messages-box', id) + }, + }, } diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 7e17ecbb5..be19822d2 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -2,55 +2,64 @@
    -
    -
    -
    {{ firstName }} {{ lastName }}
    -
    - {{ amount | GDD }} +
    +
    +
    + + +
    +
    {{ firstName }} {{ lastName }}
    +
    + {{ amount | GDD }} +
    + {{ $t('math.minus') }} +
    {{ $d(new Date(date), 'short') }}
    - {{ $t('math.minus') }} -
    {{ $d(new Date(date), 'short') }}
    -
    -
    - {{ $t('contribution.date') }} - - {{ $d(new Date(contributionDate), 'monthAndYear') }} - -
    -
    {{ memo }}
    -
    +
    + {{ $t('contribution.date') }} + + {{ $d(new Date(contributionDate), 'monthAndYear') }} + +
    +
    {{ memo }}
    - -
    -
    - -
    -
    - +
    + +
    +
    + +
    +
    + +
    - - - Bitte beantworte die Nachfrage + + {{ $t('contribution.alert.answerQuestion') }} @@ -58,6 +67,7 @@ :messages="messages" :state="state" :contributionId="contributionId" + @toggle-contribution-messages-box="toggleContributionMessagesBox" /> @@ -140,6 +150,7 @@ export default { variant() { if (this.deletedAt) return 'danger' if (this.confirmedAt) return 'success' + if (this.state === 'IN_PROGRESS') return 'warning' return 'primary' }, date() { @@ -155,6 +166,9 @@ export default { if (value) this.$emit('delete-contribution', item) }) }, + toggleContributionMessagesBox(id) { + alert('toggleContributionMessagesBox(' + id + ')') + }, }, } diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index b107ca612..bbdc9886a 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -38,9 +38,10 @@ "communityNoteList": "Hier findest du alle eingereichten und bestätigten Beiträge von allen Mitgliedern aus dieser Gemeinschaft.", "confirm": "bestätigt", "myContributionNoteList": "Eingereichte Beiträge, die noch nicht bestätigt wurden, kannst du jederzeit bearbeiten oder löschen.", - "myContributionNoteSupport": "Es wird bald an dieser Stelle die Möglichkeit geben das ein Dialog zwischen Moderatoren und dir stattfinden kann. Solltest du jetzt Probleme haben bitte nimm Kontakt mit dem Support auf.", "pending": "Eingereicht und wartet auf Bestätigung", - "rejected": "abgelehnt" + "rejected": "abgelehnt", + "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "answerQuestion": "Bitte beantworte die Nachfrage" }, "date": "Beitrag für:", "delete": "Beitrag löschen! Bist du sicher?", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 2b1eb492e..4f7830f65 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -38,9 +38,10 @@ "communityNoteList": "Here you will find all submitted and confirmed contributions from all members of this community.", "confirm": "confirmed", "myContributionNoteList": "You can edit or delete entries that have not yet been confirmed at any time.", - "myContributionNoteSupport": "Soon there will be the possibility for a dialogue between moderators and you. If you have any problems now, please contact the support.", "pending": "Submitted and waiting for confirmation", - "rejected": "deleted" + "rejected": "deleted", + "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "answerQuestion": "Please answer the question" }, "date": "Contribution for:", "delete": "Delete Contribution! Are you sure?", diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index df32c3729..ffec649ed 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -38,9 +38,10 @@ "communityNoteList": "Aquí encontrarás todas las contribuciones enviadas y confirmadas de todos los miembros de esta comunidad.", "confirm": "confirmado", "myContributionNoteList": "Puedes editar o eliminar las contribuciones enviadas que aún no han sido confirmadas en cualquier momento.", - "myContributionNoteSupport": "Pronto existirá la posibilidad de que puedas dialogar con los moderadores. Si tienes algún problema ahora, ponte en contacto con el equipo de asistencia.", "pending": "Enviado y a la espera de confirmación", - "rejected": "rechazado" + "rejected": "rechazado", + "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "answerQuestion": "Please answer the question" }, "date": "Contribución para:", "delete": "Eliminar la contribución. ¿Estás seguro?", diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index c8a25d2fb..b1ff773d0 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -38,9 +38,10 @@ "communityNoteList": "Vous trouverez ci-contre toutes les contributions versées et certifiées de tous les membres de cette communauté.", "confirm": " Approuvé", "myContributionNoteList": "À tout moment vous pouvez éditer ou supprimer les données qui n´ont pas été confirmées.", - "myContributionNoteSupport": "Vous aurez bientôt la possibilité de dialoguer avec un médiateur. Si vous rencontrez un problème maintenant, merci de contacter l´aide en ligne.", "pending": "Inscription en attente de validation", - "rejected": "supprimé" + "rejected": "supprimé", + "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "answerQuestion": "Please answer the question" }, "date": "Contribution pour:", "delete": "Supprimer la contribution! Êtes-vous sûr?", diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json index fe0e83839..edb2ec21b 100644 --- a/frontend/src/locales/nl.json +++ b/frontend/src/locales/nl.json @@ -38,9 +38,10 @@ "communityNoteList": "Hier vind je alle ingediende en bevestigde bijdragen van alle leden uit deze gemeenschap.", "confirm": "bevestigt", "myContributionNoteList": "Ingediende bijdragen, die nog niet bevestigd zijn, kun je op elk moment wijzigen of verwijderen.", - "myContributionNoteSupport": "Hier heb je binnenkort de mogelijkheid een gesprek met een moderator te voeren. Mocht je nu problemen hebben, dan neem alsjeblieft contact op met Support.", "pending": "Ingediend en wacht op bevestiging", - "rejected": "afgewezen" + "rejected": "afgewezen", + "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "answerQuestion": "Please answer the question" }, "date": "Bijdrage voor:", "delete": "Bijdrage verwijderen! Weet je het zeker?", diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index 64aca6156..5f9eb57f6 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -22,6 +22,10 @@ {{ $t('contribution.alert.pending') }}
  • +
  • + + {{ $t('contribution.alert.in_progress') }} +
  • {{ $t('contribution.alert.confirm') }} @@ -32,9 +36,6 @@

-

- {{ $t('contribution.alert.myContributionNoteSupport') }} -

Date: Thu, 25 Aug 2022 18:46:16 +0200 Subject: [PATCH 319/408] fix lint && fix locales --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- frontend/src/locales/es.json | 2 +- frontend/src/locales/fr.json | 2 +- frontend/src/locales/nl.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index bbdc9886a..1296616d3 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -40,7 +40,7 @@ "myContributionNoteList": "Eingereichte Beiträge, die noch nicht bestätigt wurden, kannst du jederzeit bearbeiten oder löschen.", "pending": "Eingereicht und wartet auf Bestätigung", "rejected": "abgelehnt", - "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "answerQuestion": "Bitte beantworte die Nachfrage" }, "date": "Beitrag für:", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 4f7830f65..ee31350ce 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -40,7 +40,7 @@ "myContributionNoteList": "You can edit or delete entries that have not yet been confirmed at any time.", "pending": "Submitted and waiting for confirmation", "rejected": "deleted", - "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "answerQuestion": "Please answer the question" }, "date": "Contribution for:", diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index ffec649ed..fa6613092 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -40,7 +40,7 @@ "myContributionNoteList": "Puedes editar o eliminar las contribuciones enviadas que aún no han sido confirmadas en cualquier momento.", "pending": "Enviado y a la espera de confirmación", "rejected": "rechazado", - "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "answerQuestion": "Please answer the question" }, "date": "Contribución para:", diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index b1ff773d0..948f1b0fe 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -40,7 +40,7 @@ "myContributionNoteList": "À tout moment vous pouvez éditer ou supprimer les données qui n´ont pas été confirmées.", "pending": "Inscription en attente de validation", "rejected": "supprimé", - "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "answerQuestion": "Please answer the question" }, "date": "Contribution pour:", diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json index edb2ec21b..69896cbea 100644 --- a/frontend/src/locales/nl.json +++ b/frontend/src/locales/nl.json @@ -40,7 +40,7 @@ "myContributionNoteList": "Ingediende bijdragen, die nog niet bevestigd zijn, kun je op elk moment wijzigen of verwijderen.", "pending": "Ingediend en wacht op bevestiging", "rejected": "afgewezen", - "in_progress":"Es gibt eine Rückfrage der Moderatoren.", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "answerQuestion": "Please answer the question" }, "date": "Bijdrage voor:", From 773207f80fd8a35f321dfc39c2d036e4e14a4454 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 25 Aug 2022 18:46:58 +0200 Subject: [PATCH 320/408] fix lint in adminarea --- admin/src/components/Tables/OpenCreationsTable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/src/components/Tables/OpenCreationsTable.vue b/admin/src/components/Tables/OpenCreationsTable.vue index 6c0289ffe..50ae6df97 100644 --- a/admin/src/components/Tables/OpenCreationsTable.vue +++ b/admin/src/components/Tables/OpenCreationsTable.vue @@ -27,7 +27,7 @@ v-if="row.item.state === 'PENDING' && row.item.messageCount > 0" icon="exclamation-circle-fill" variant="warning" - > + > Date: Fri, 26 Aug 2022 08:32:15 +0200 Subject: [PATCH 321/408] Remove OneToMany import. --- database/entity/0047-messages_tables/ContributionMessage.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/database/entity/0047-messages_tables/ContributionMessage.ts b/database/entity/0047-messages_tables/ContributionMessage.ts index 3d9c04d89..e5226043d 100644 --- a/database/entity/0047-messages_tables/ContributionMessage.ts +++ b/database/entity/0047-messages_tables/ContributionMessage.ts @@ -5,7 +5,6 @@ import { Entity, JoinColumn, ManyToOne, - OneToMany, PrimaryGeneratedColumn, } from 'typeorm' import { Contribution } from '../Contribution' From 894140b41837e8ab2a0a3c7a7d1dcfcb97ed456a Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 26 Aug 2022 08:50:08 +0200 Subject: [PATCH 322/408] Remove unused imports. --- backend/src/graphql/resolver/ContributionResolver.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 1b7a8f630..f8300f164 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -11,10 +11,8 @@ import { ContributionType } from '@enum/ContributionType' import { ContributionStatus } from '@enum/ContributionStatus' import { Contribution, ContributionListResult } from '@model/Contribution' import { UnconfirmedContribution } from '@model/UnconfirmedContribution' -import { User } from '@model/User' import { validateContribution, getUserCreation, updateCreations } from './util/creations' import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' -import { ContributionMessage } from '@entity/ContributionMessage' @Resolver() export class ContributionResolver { From 5dc74b9cb8d7dd1854f613e2f35f9916aefbd96e Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 26 Aug 2022 08:32:15 +0200 Subject: [PATCH 323/408] Remove OneToMany import. --- database/entity/0047-messages_tables/ContributionMessage.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/database/entity/0047-messages_tables/ContributionMessage.ts b/database/entity/0047-messages_tables/ContributionMessage.ts index 3d9c04d89..e5226043d 100644 --- a/database/entity/0047-messages_tables/ContributionMessage.ts +++ b/database/entity/0047-messages_tables/ContributionMessage.ts @@ -5,7 +5,6 @@ import { Entity, JoinColumn, ManyToOne, - OneToMany, PrimaryGeneratedColumn, } from 'typeorm' import { Contribution } from '../Contribution' From c6f2e9fb0d4c9f7d1acb58d9a92e967bed66b265 Mon Sep 17 00:00:00 2001 From: ogerly Date: Sat, 27 Aug 2022 11:20:14 +0200 Subject: [PATCH 324/408] reload messages if submited --- .../ContributionMessagesFormular.vue | 2 ++ .../ContributionMessagesList.vue | 4 +++ .../Contributions/ContributionList.vue | 1 + .../Contributions/ContributionListItem.vue | 25 +++++++++++++++++-- frontend/src/graphql/queries.js | 23 +++++++++++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue index e27989b12..5fed6ebd6 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -51,6 +51,8 @@ export default { }, }) .then((result) => { + this.$emit('get-list-contribution-messages', this.contributionId) + this.form.text = '' this.toastSuccess(result) }) .catch((error) => { diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue index f8130f2bc..1b8e36cae 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue @@ -10,6 +10,7 @@ class="mt-5" :contributionId="contributionId" @toggle-contribution-messages-box="toggleContributionMessagesBox" + @get-list-contribution-messages="getListContributionMessages" /> @@ -41,6 +42,9 @@ export default { toggleContributionMessagesBox(id) { this.$emit('toggle-contribution-messages-box', id) }, + getListContributionMessages() { + this.$emit('get-list-contribution-messages', this.contributionId) + }, }, } diff --git a/frontend/src/components/Contributions/ContributionList.vue b/frontend/src/components/Contributions/ContributionList.vue index cffee360b..724a69281 100644 --- a/frontend/src/components/Contributions/ContributionList.vue +++ b/frontend/src/components/Contributions/ContributionList.vue @@ -47,6 +47,7 @@ export default { data() { return { currentPage: 1, + messages: [], } }, methods: { diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index be19822d2..6e95093db 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -2,7 +2,7 @@
-
+
@@ -78,6 +79,7 @@ diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index f701ad8cf..d7fc0ce98 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -265,3 +265,26 @@ export const searchAdminUsers = gql` } } ` + +export const listContributionMessages = gql` + query($contributionId: Float!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) { + listContributionMessages( + contributionId: $contributionId + pageSize: $pageSize + currentPage: $currentPage + order: $order + ) { + count + messages { + id + message + createdAt + updatedAt + type + userFirstName + userLastName + userId + } + } + } +` From fd74a2e67105b45a28041e28022b1fcaecb09e9c Mon Sep 17 00:00:00 2001 From: ogerly Date: Sat, 27 Aug 2022 11:20:30 +0200 Subject: [PATCH 325/408] reload messages if submited adminarea --- .../ContributionMessagesFormular.vue | 30 +++++++------------ .../ContributionMessagesList.vue | 6 +++- .../slots/ContributionMessagesListItem.vue | 6 ---- .../slots/IsModerator.vue | 24 ++++++++------- .../slots/IsNotModerator.vue | 7 +---- 5 files changed, 30 insertions(+), 43 deletions(-) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue index b7e706d5c..c04f8a573 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -1,23 +1,5 @@ From ef52c8b6d560d30d551e92ba2619e741488c4975 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 08:08:30 +0200 Subject: [PATCH 326/408] delete unused toggleContributionMessagesBox function --- .../ContributionMessages/ContributionMessagesFormular.vue | 3 --- .../src/components/Contributions/ContributionListItem.vue | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue index 5fed6ebd6..80708726c 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -63,9 +63,6 @@ export default { event.preventDefault() this.form.text = '' }, - toggleContributionMessagesBox() { - this.$emit('toggle-contribution-messages-box', this.contributionId) - }, }, } diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 6e95093db..976730384 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -173,7 +173,7 @@ export default { alert('toggleContributionMessagesBox(' + id + ')') }, getListContributionMessages() { - console.log('getListContributionMessages', this.contributionId) + // console.log('getListContributionMessages', this.contributionId) this.$apollo .query({ query: listContributionMessages, @@ -183,7 +183,7 @@ export default { fetchPolicy: 'no-cache', }) .then((result) => { - console.log('result', result.data.listContributionMessages.messages) + // console.log('result', result.data.listContributionMessages.messages) this.messages_get = result.data.listContributionMessages.messages }) .catch((error) => { From 14ca1378bf4505882646b26c8070572a830b470f Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 08:15:48 +0200 Subject: [PATCH 327/408] delete unused toggleContributionMessagesBox function --- .../ContributionMessages/ContributionMessagesList.vue | 4 ---- .../src/components/Contributions/ContributionListItem.vue | 4 ---- 2 files changed, 8 deletions(-) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue index 1b8e36cae..98e92e6e7 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue @@ -9,7 +9,6 @@ v-if="state === 'PENDING' || state === 'IN_PROGRESS'" class="mt-5" :contributionId="contributionId" - @toggle-contribution-messages-box="toggleContributionMessagesBox" @get-list-contribution-messages="getListContributionMessages" />
@@ -39,9 +38,6 @@ export default { }, }, methods: { - toggleContributionMessagesBox(id) { - this.$emit('toggle-contribution-messages-box', id) - }, getListContributionMessages() { this.$emit('get-list-contribution-messages', this.contributionId) }, diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 976730384..8fc742cd3 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -67,7 +67,6 @@ :messages="messages_get" :state="state" :contributionId="contributionId" - @toggle-contribution-messages-box="toggleContributionMessagesBox" @get-list-contribution-messages="getListContributionMessages" /> @@ -169,9 +168,6 @@ export default { if (value) this.$emit('delete-contribution', item) }) }, - toggleContributionMessagesBox(id) { - alert('toggleContributionMessagesBox(' + id + ')') - }, getListContributionMessages() { // console.log('getListContributionMessages', this.contributionId) this.$apollo From 15af14a2331616c9053453e9433b652007d1dec6 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 10:00:41 +0200 Subject: [PATCH 328/408] add methods updateState and emits --- .../ContributionMessages/ContributionMessagesFormular.vue | 1 + .../ContributionMessages/ContributionMessagesList.vue | 4 ++++ frontend/src/components/Contributions/ContributionList.vue | 4 ++++ .../src/components/Contributions/ContributionListItem.vue | 4 ++++ frontend/src/pages/Community.vue | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue index 80708726c..7ec3c4ff9 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -52,6 +52,7 @@ export default { }) .then((result) => { this.$emit('get-list-contribution-messages', this.contributionId) + this.$emit('update-state', this.contributionId) this.form.text = '' this.toastSuccess(result) }) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue index 98e92e6e7..896487160 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue @@ -10,6 +10,7 @@ class="mt-5" :contributionId="contributionId" @get-list-contribution-messages="getListContributionMessages" + @update-state="updateState" />
@@ -41,6 +42,9 @@ export default { getListContributionMessages() { this.$emit('get-list-contribution-messages', this.contributionId) }, + updateState(id) { + this.$emit('update-state', id) + }, }, } diff --git a/frontend/src/components/Contributions/ContributionList.vue b/frontend/src/components/Contributions/ContributionList.vue index 724a69281..11cc0f9dd 100644 --- a/frontend/src/components/Contributions/ContributionList.vue +++ b/frontend/src/components/Contributions/ContributionList.vue @@ -6,6 +6,7 @@ :contributionId="item.id" @update-contribution-form="updateContributionForm" @delete-contribution="deleteContribution" + @update-state="updateState" />
@@ -186,6 +187,9 @@ export default { this.toastError(error.message) }) }, + updateState(id) { + this.$emit('update-state', id) + }, }, } diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index 5f9eb57f6..1753ca5d2 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -43,6 +43,7 @@ @update-list-contributions="updateListContributions" @update-contribution-form="updateContributionForm" @delete-contribution="deleteContribution" + @update-state="updateState" :contributionCount="contributionCount" :showPagination="true" :pageSize="pageSize" @@ -259,6 +260,9 @@ export default { updateTransactions(pagination) { this.$emit('update-transactions', pagination) }, + updateState(id) { + this.items.find((item) => item.id === id).state = 'PENDING' + }, }, created() { // verifyLogin is important at this point so that creation is updated on reload if they are deleted in a session in the admin area. From 40475ecb37953b3a06f0ee655235a57b85316466 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 10:20:12 +0200 Subject: [PATCH 329/408] add locales key form.replay --- frontend/src/locales/de.json | 1 + frontend/src/locales/en.json | 1 + frontend/src/locales/es.json | 1 + frontend/src/locales/fr.json | 1 + frontend/src/locales/nl.json | 1 + 5 files changed, 5 insertions(+) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 1296616d3..008dc7705 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -132,6 +132,7 @@ "password_new_repeat": "Neues Passwort wiederholen", "password_old": "Altes Passwort", "recipient": "Empfänger", + "reply": "Antworten", "reset": "Zurücksetzen", "save": "Speichern", "scann_code": "QR Code Scanner - Scanne den QR Code deines Partners", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index ee31350ce..394f74a7a 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -132,6 +132,7 @@ "password_new_repeat": "Repeat new password", "password_old": "Old password", "recipient": "Recipient", + "reply": "Reply", "reset": "Reset", "save": "Save", "scann_code": "QR Code Scanner - Scan the QR Code of your partner", diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index fa6613092..b871e7168 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -132,6 +132,7 @@ "password_new_repeat": "Repetir contraseña nueva", "password_old": "contraseña antigua", "recipient": "Destinatario", + "reply": "Respuesta", "reset": "Restablecer", "save": "Guardar", "scann_code": "QR Code Scanner - Escanea el código QR de tu pareja", diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 948f1b0fe..eea99d57c 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -132,6 +132,7 @@ "password_new_repeat": "Répétez le nouveau mot de passe", "password_old": "Ancien mot de passe", "recipient": "Destinataire", + "reply": "Répondre", "reset": "Réinitialiser", "save": "Sauvegarder", "scann_code": "QR Code Scanner - Scannez le QR code de votre partenaire", diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json index 69896cbea..13a1b2124 100644 --- a/frontend/src/locales/nl.json +++ b/frontend/src/locales/nl.json @@ -132,6 +132,7 @@ "password_new_repeat": "Nieuw wachtwoord herhalen", "password_old": "Oud wachtwoord", "recipient": "Ontvanger", + "reply": "Antwoord", "reset": "Resetten", "save": "Opslaan", "scann_code": "QR Code Scanner - Scan de QR Code van uw partner", From 0cfd0f00977c766a4a073055e043ad103bc5891c Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 10:21:50 +0200 Subject: [PATCH 330/408] add locales key form.reply --- .../ContributionMessages/ContributionMessagesFormular.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue index 7ec3c4ff9..440f9781a 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -14,7 +14,7 @@ {{ $t('form.reset') }} - {{ $t('form.submit') }} + {{ $t('form.reply') }} From 6bd02a2d4bf298d909b1532ff1010e212f397add Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 11:12:31 +0200 Subject: [PATCH 331/408] add method updateState and emits --- .../ContributionMessagesFormular.vue | 1 + .../ContributionMessagesList.vue | 15 ++++----------- .../src/components/Tables/OpenCreationsTable.vue | 10 ++++++++-- admin/src/pages/CreationConfirm.vue | 7 +++++++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue index c04f8a573..06085dec7 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -52,6 +52,7 @@ export default { }) .then((result) => { this.$emit('get-list-contribution-messages', this.contributionId) + this.$emit('update-state', this.contributionId) this.form.text = '' this.toastSuccess(result) }) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.vue b/admin/src/components/ContributionMessages/ContributionMessagesList.vue index 15762b18d..c5863cdc3 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.vue @@ -4,21 +4,13 @@ {{ messages.lenght }}
- -
@@ -46,7 +38,6 @@ export default { }, methods: { getListContributionMessages(id) { - // console.log('getListContributionMessages', id) this.messages = [] this.$apollo .query({ @@ -57,13 +48,15 @@ export default { fetchPolicy: 'no-cache', }) .then((result) => { - // console.log('result', result.data.listContributionMessages) this.messages = result.data.listContributionMessages.messages }) .catch((error) => { this.toastError(error.message) }) }, + updateState(id) { + this.$emit('update-state', id) + }, }, created() { this.getListContributionMessages(this.contributionId) diff --git a/admin/src/components/Tables/OpenCreationsTable.vue b/admin/src/components/Tables/OpenCreationsTable.vue index 50ae6df97..86c5ecce6 100644 --- a/admin/src/components/Tables/OpenCreationsTable.vue +++ b/admin/src/components/Tables/OpenCreationsTable.vue @@ -57,11 +57,14 @@ :row="row" :creationUserData="creationUserData" @update-creation-data="updateCreationData" - @update-user-data="updateUserData" />
- +
@@ -116,6 +119,9 @@ export default { updateUserData(rowItem, newCreation) { rowItem.creation = newCreation }, + updateState(id) { + this.$emit('update-state', id) + }, }, } diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index c07e6b351..c94d84cbd 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -9,6 +9,7 @@ :fields="fields" @remove-creation="removeCreation" @show-overlay="showOverlay" + @update-state="updateState" />
@@ -79,6 +80,7 @@ export default { .then((result) => { this.$store.commit('resetOpenCreations') this.pendingCreations = result.data.listUnconfirmedContributions + console.log(this.pendingCreations) this.$store.commit('setOpenCreations', result.data.listUnconfirmedContributions.length) }) .catch((error) => { @@ -93,6 +95,11 @@ export default { this.overlay = true this.item = item }, + updateState(id) { + console.log('admin updateState', id) + console.log(this.pendingCreations) + this.pendingCreations.find((item) => item.id === id).state = 'IN_PROGRESS' + }, }, computed: { fields() { From 6acb944ac05a63b871b789eaa1526218c03c9a2d Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 11:17:45 +0200 Subject: [PATCH 332/408] delete unused local keys --- admin/src/locales/de.json | 3 +-- admin/src/locales/en.json | 3 +-- admin/src/pages/CreationConfirm.vue | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index a9e18f165..b3b587e9a 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -159,6 +159,5 @@ }, "user_deleted": "Nutzer ist gelöscht.", "user_recovered": "Nutzer ist wiederhergestellt.", - "user_search": "Nutzer-Suche", - "preview": "Vorschau" + "user_search": "Nutzer-Suche" } diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index 9b5ab107a..ee6ca1b63 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -159,6 +159,5 @@ }, "user_deleted": "User is deleted.", "user_recovered": "User is recovered.", - "user_search": "User search", - "preview": "Preview" + "user_search": "User search" } diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index c94d84cbd..595bd56b2 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -80,7 +80,6 @@ export default { .then((result) => { this.$store.commit('resetOpenCreations') this.pendingCreations = result.data.listUnconfirmedContributions - console.log(this.pendingCreations) this.$store.commit('setOpenCreations', result.data.listUnconfirmedContributions.length) }) .catch((error) => { @@ -96,8 +95,6 @@ export default { this.item = item }, updateState(id) { - console.log('admin updateState', id) - console.log(this.pendingCreations) this.pendingCreations.find((item) => item.id === id).state = 'IN_PROGRESS' }, }, From c76a58b59b041a1803c1563aae38e638de8e7a30 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 11:18:31 +0200 Subject: [PATCH 333/408] delete v-toogle from element --- frontend/src/components/Contributions/ContributionListItem.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 56f71bb66..78ba6f0fe 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -2,7 +2,7 @@
-
+
Date: Mon, 29 Aug 2022 11:49:12 +0200 Subject: [PATCH 334/408] fix locales --- frontend/src/locales/de.json | 6 +++--- frontend/src/locales/en.json | 6 +++--- frontend/src/locales/es.json | 6 +++--- frontend/src/locales/fr.json | 6 +++--- frontend/src/locales/nl.json | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 008dc7705..4ebedf0a5 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -35,13 +35,13 @@ "contribution": { "activity": "Tätigkeit", "alert": { + "answerQuestion": "Bitte beantworte die Nachfrage", "communityNoteList": "Hier findest du alle eingereichten und bestätigten Beiträge von allen Mitgliedern aus dieser Gemeinschaft.", "confirm": "bestätigt", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "myContributionNoteList": "Eingereichte Beiträge, die noch nicht bestätigt wurden, kannst du jederzeit bearbeiten oder löschen.", "pending": "Eingereicht und wartet auf Bestätigung", - "rejected": "abgelehnt", - "in_progress": "Es gibt eine Rückfrage der Moderatoren.", - "answerQuestion": "Bitte beantworte die Nachfrage" + "rejected": "abgelehnt" }, "date": "Beitrag für:", "delete": "Beitrag löschen! Bist du sicher?", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 394f74a7a..f0cb341c0 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -35,13 +35,13 @@ "contribution": { "activity": "Activity", "alert": { + "answerQuestion": "Please answer the question", "communityNoteList": "Here you will find all submitted and confirmed contributions from all members of this community.", "confirm": "confirmed", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "myContributionNoteList": "You can edit or delete entries that have not yet been confirmed at any time.", "pending": "Submitted and waiting for confirmation", - "rejected": "deleted", - "in_progress": "Es gibt eine Rückfrage der Moderatoren.", - "answerQuestion": "Please answer the question" + "rejected": "deleted" }, "date": "Contribution for:", "delete": "Delete Contribution! Are you sure?", diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index b871e7168..4cefe2905 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -35,13 +35,13 @@ "contribution": { "activity": "Actividad", "alert": { + "answerQuestion": "Please answer the question", "communityNoteList": "Aquí encontrarás todas las contribuciones enviadas y confirmadas de todos los miembros de esta comunidad.", "confirm": "confirmado", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "myContributionNoteList": "Puedes editar o eliminar las contribuciones enviadas que aún no han sido confirmadas en cualquier momento.", "pending": "Enviado y a la espera de confirmación", - "rejected": "rechazado", - "in_progress": "Es gibt eine Rückfrage der Moderatoren.", - "answerQuestion": "Please answer the question" + "rejected": "rechazado" }, "date": "Contribución para:", "delete": "Eliminar la contribución. ¿Estás seguro?", diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index eea99d57c..a35e6ce30 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -35,13 +35,13 @@ "contribution": { "activity": "Activité", "alert": { + "answerQuestion": "Please answer the question", "communityNoteList": "Vous trouverez ci-contre toutes les contributions versées et certifiées de tous les membres de cette communauté.", "confirm": " Approuvé", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "myContributionNoteList": "À tout moment vous pouvez éditer ou supprimer les données qui n´ont pas été confirmées.", "pending": "Inscription en attente de validation", - "rejected": "supprimé", - "in_progress": "Es gibt eine Rückfrage der Moderatoren.", - "answerQuestion": "Please answer the question" + "rejected": "supprimé" }, "date": "Contribution pour:", "delete": "Supprimer la contribution! Êtes-vous sûr?", diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json index 13a1b2124..c301b9201 100644 --- a/frontend/src/locales/nl.json +++ b/frontend/src/locales/nl.json @@ -35,13 +35,13 @@ "contribution": { "activity": "Activiteit", "alert": { + "answerQuestion": "Please answer the question", "communityNoteList": "Hier vind je alle ingediende en bevestigde bijdragen van alle leden uit deze gemeenschap.", "confirm": "bevestigt", + "in_progress": "Es gibt eine Rückfrage der Moderatoren.", "myContributionNoteList": "Ingediende bijdragen, die nog niet bevestigd zijn, kun je op elk moment wijzigen of verwijderen.", "pending": "Ingediend en wacht op bevestiging", - "rejected": "afgewezen", - "in_progress": "Es gibt eine Rückfrage der Moderatoren.", - "answerQuestion": "Please answer the question" + "rejected": "afgewezen" }, "date": "Bijdrage voor:", "delete": "Bijdrage verwijderen! Weet je het zeker?", From efaf02facc9f06cecd2f7f4c3869bd3a6de17e91 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 11:49:38 +0200 Subject: [PATCH 335/408] fix locales adminarea --- admin/src/locales/de.json | 4 ++-- admin/src/locales/en.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index b3b587e9a..b8ad45af1 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -70,8 +70,8 @@ "short_hash": "({shortHash})" }, "form": { - "submit": "absenden", - "reset": "löschen" + "reset": "löschen", + "submit": "absenden" }, "GDD": "GDD", "hide_details": "Details verbergen", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index ee6ca1b63..bc8c297f5 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -70,8 +70,8 @@ "short_hash": "({shortHash})" }, "form": { - "submit": "submit", - "reset": "reset" + "reset": "reset", + "submit": "submit" }, "GDD": "GDD", "hide_details": "Hide details", From 423989777b91898b5a9b698956c72537aacd1a8f Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 29 Aug 2022 12:19:25 +0200 Subject: [PATCH 336/408] Remove leftJoin on user, changed ContributionMessage array to count of ContributionMessage. --- backend/src/graphql/model/Contribution.ts | 9 +++------ backend/src/graphql/resolver/ContributionResolver.ts | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/backend/src/graphql/model/Contribution.ts b/backend/src/graphql/model/Contribution.ts index c0e6d66f3..1f690a3d8 100644 --- a/backend/src/graphql/model/Contribution.ts +++ b/backend/src/graphql/model/Contribution.ts @@ -2,7 +2,6 @@ import { ObjectType, Field, Int } from 'type-graphql' import Decimal from 'decimal.js-light' import { Contribution as dbContribution } from '@entity/Contribution' import { User } from '@entity/User' -import { ContributionMessage } from './ContributionMessage' @ObjectType() export class Contribution { @@ -18,9 +17,7 @@ export class Contribution { this.confirmedBy = contribution.confirmedBy this.contributionDate = contribution.contributionDate this.state = contribution.contributionStatus - this.messages = contribution.messages - ? contribution.messages.map((message) => new ContributionMessage(message, message.user)) - : [] + this.messagesCount = contribution.messages ? contribution.messages.length : 0 } @Field(() => Number) @@ -53,8 +50,8 @@ export class Contribution { @Field(() => Date) contributionDate: Date - @Field(() => [ContributionMessage]) - messages: ContributionMessage[] + @Field(() => Number) + messagesCount: number @Field(() => String) state: string diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index f8300f164..fc93880f1 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -97,7 +97,6 @@ export class ContributionResolver { .select('c') .from(dbContribution, 'c') .leftJoinAndSelect('c.messages', 'm') - .leftJoinAndSelect('m.user', 'u') .where(where) .orderBy('c.createdAt', order) .limit(pageSize) From 214f85544b64c82911c1a5c85d8ac09578bb61ae Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 29 Aug 2022 12:24:09 +0200 Subject: [PATCH 337/408] ContributionMessage is only defined in 0047 so remove the OneToMany relation from 0046 User and add it to 0047 User. --- .../User.ts | 5 - database/entity/0047-messages_tables/User.ts | 116 ++++++++++++++++++ database/entity/User.ts | 2 +- 3 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 database/entity/0047-messages_tables/User.ts diff --git a/database/entity/0046-adapt_users_table_for_gradidoid/User.ts b/database/entity/0046-adapt_users_table_for_gradidoid/User.ts index a772a3c99..3f2547cad 100644 --- a/database/entity/0046-adapt_users_table_for_gradidoid/User.ts +++ b/database/entity/0046-adapt_users_table_for_gradidoid/User.ts @@ -8,7 +8,6 @@ import { JoinColumn, } from 'typeorm' import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' @Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) export class User extends BaseEntity { @@ -109,8 +108,4 @@ export class User extends BaseEntity { @OneToMany(() => Contribution, (contribution) => contribution.user) @JoinColumn({ name: 'user_id' }) contributions?: Contribution[] - - @OneToMany(() => ContributionMessage, (message) => message.user) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] } diff --git a/database/entity/0047-messages_tables/User.ts b/database/entity/0047-messages_tables/User.ts new file mode 100644 index 000000000..a772a3c99 --- /dev/null +++ b/database/entity/0047-messages_tables/User.ts @@ -0,0 +1,116 @@ +import { + BaseEntity, + Entity, + PrimaryGeneratedColumn, + Column, + DeleteDateColumn, + OneToMany, + JoinColumn, +} from 'typeorm' +import { Contribution } from '../Contribution' +import { ContributionMessage } from '../ContributionMessage' + +@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) +export class User extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ + name: 'gradido_id', + length: 36, + nullable: false, + unique: true, + collation: 'utf8mb4_unicode_ci', + }) + gradidoID: string + + @Column({ + name: 'alias', + length: 20, + nullable: true, + unique: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + alias: string + + @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) + pubKey: Buffer + + @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) + privKey: Buffer + + @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) + email: string + + @Column({ + name: 'first_name', + length: 255, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + firstName: string + + @Column({ + name: 'last_name', + length: 255, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + lastName: string + + @DeleteDateColumn() + deletedAt: Date | null + + @Column({ type: 'bigint', default: 0, unsigned: true }) + password: BigInt + + @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) + emailHash: Buffer + + @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) + createdAt: Date + + @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) + emailChecked: boolean + + @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) + language: string + + @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) + isAdmin: Date | null + + @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) + referrerId?: number | null + + @Column({ + name: 'contribution_link_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + contributionLinkId?: number | null + + @Column({ name: 'publisher_id', default: 0 }) + publisherId: number + + @Column({ + type: 'text', + name: 'passphrase', + collation: 'utf8mb4_unicode_ci', + nullable: true, + default: null, + }) + passphrase: string + + @OneToMany(() => Contribution, (contribution) => contribution.user) + @JoinColumn({ name: 'user_id' }) + contributions?: Contribution[] + + @OneToMany(() => ContributionMessage, (message) => message.user) + @JoinColumn({ name: 'user_id' }) + messages?: ContributionMessage[] +} diff --git a/database/entity/User.ts b/database/entity/User.ts index 02a99fcd1..7d15bf559 100644 --- a/database/entity/User.ts +++ b/database/entity/User.ts @@ -1 +1 @@ -export { User } from './0046-adapt_users_table_for_gradidoid/User' +export { User } from './0047-messages_tables/User' From 61d763030af88ffb0dc409659ec50ac6dd43bcda Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 12:54:32 +0200 Subject: [PATCH 338/408] change state if messagesCount 0 --- admin/src/pages/CreationConfirm.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index 595bd56b2..f518e1f00 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -95,7 +95,10 @@ export default { this.item = item }, updateState(id) { - this.pendingCreations.find((item) => item.id === id).state = 'IN_PROGRESS' + this.pendingCreations.find((value) => { + value.state = 'IN_PROGRESS' + value.messageCount = value.messageCount + 1 + }) }, }, computed: { From 7156f1afd5a0c9a3166acc441eaf7fc61bd286d6 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 29 Aug 2022 12:58:01 +0200 Subject: [PATCH 339/408] Setup Test file for ContributionMessageResolver. --- .../ContributionMessageResolver.test.ts | 47 +++++++++++++++++++ backend/src/seeds/graphql/mutations.ts | 28 +++++++++++ backend/src/seeds/graphql/queries.ts | 23 +++++++++ 3 files changed, 98 insertions(+) create mode 100644 backend/src/graphql/resolver/ContributionMessageResolver.test.ts diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts new file mode 100644 index 000000000..f98e4f211 --- /dev/null +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -0,0 +1,47 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + +import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' +import { cleanDB, resetToken, testEnvironment } from '@test/helpers' +import { GraphQLError } from 'graphql' +import { userFactory } from '@/seeds/factory/user' +import { creationFactory } from '@/seeds/factory/creation' +import { creations } from '@/seeds/creation/index' +import { peterLustig } from '@/seeds/users/peter-lustig' +import { createContributionMessage } from '@/seeds/graphql/mutations' + +let mutate: any, query: any, con: any +let testEnv: any +let result: any + +beforeAll(async () => { + testEnv = await testEnvironment() + mutate = testEnv.mutate + query = testEnv.query + con = testEnv.con + await cleanDB() +}) + +afterAll(async () => { + await cleanDB() + await con.close() +}) + +describe('ContributionMessageResolver', () => { + describe('createContributionMessage', () => { + describe('unauthenticated', () => { + it('returns an error', async () => { + await expect( + mutate({ + mutation: createContributionMessage, + variables: { contributionId: 1, message: 'This is a test message' }, + }), + ).resolves.toEqual( + expect.objectContaining({ + errors: [new GraphQLError('401 Unauthorized')], + }), + ) + }) + }) + }) +}) diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index bf898bd7d..e5f290645 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -261,3 +261,31 @@ export const deleteContribution = gql` deleteContribution(id: $id) } ` + +export const createContributionMessage = gql` + mutation ($contributionId: Float!, $message: String!) { + createContributionMessage(contributionId: $contributionId, message: $message) { + id + message + createdAt + updatedAt + type + userFirstName + userLastName + } + } +` + +export const adminCreateContributionMessage = gql` + mutation ($contributionId: Float!, $message: String!) { + adminCreateContributionMessage(contributionId: $contributionId, message: $message) { + id + message + createdAt + updatedAt + type + userFirstName + userLastName + } + } +` diff --git a/backend/src/seeds/graphql/queries.ts b/backend/src/seeds/graphql/queries.ts index 3bd042ac2..60dffa21b 100644 --- a/backend/src/seeds/graphql/queries.ts +++ b/backend/src/seeds/graphql/queries.ts @@ -292,3 +292,26 @@ export const searchAdminUsers = gql` } } ` + +export const listContributionMessages = gql` + query ($contributionId: Float!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) { + listContributionMessages( + contributionId: $contributionId + pageSize: $pageSize + currentPage: $currentPage + order: $order + ) { + count + messages { + id + message + createdAt + updatedAt + type + userFirstName + userLastName + userId + } + } + } +` From 8b62696c91aaa8116dc5960360d586f99a6dc136 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 29 Aug 2022 13:07:24 +0200 Subject: [PATCH 340/408] Add test that listContributionMessages throws error for non authenticated user. --- .../ContributionMessageResolver.test.ts | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index f98e4f211..8d65db306 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -1,18 +1,13 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' -import { cleanDB, resetToken, testEnvironment } from '@test/helpers' +import { cleanDB, testEnvironment } from '@test/helpers' import { GraphQLError } from 'graphql' -import { userFactory } from '@/seeds/factory/user' -import { creationFactory } from '@/seeds/factory/creation' -import { creations } from '@/seeds/creation/index' -import { peterLustig } from '@/seeds/users/peter-lustig' import { createContributionMessage } from '@/seeds/graphql/mutations' +import { listContributionMessages } from '@/seeds/graphql/queries' let mutate: any, query: any, con: any let testEnv: any -let result: any beforeAll(async () => { testEnv = await testEnvironment() @@ -44,4 +39,21 @@ describe('ContributionMessageResolver', () => { }) }) }) + + describe('listContributionMessages', () => { + describe('unauthenticated', () => { + it('returns an error', async () => { + await expect( + mutate({ + mutation: listContributionMessages, + variables: { contributionId: 1 }, + }), + ).resolves.toEqual( + expect.objectContaining({ + errors: [new GraphQLError('401 Unauthorized')], + }), + ) + }) + }) + }) }) From ac4f7dc04a193b4594cbf37740d3e81bf85d4794 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 29 Aug 2022 13:16:44 +0200 Subject: [PATCH 341/408] Add test with non existing contributionId. --- .../ContributionMessageResolver.test.ts | 54 ++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index 8d65db306..c66a85700 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -1,10 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { cleanDB, testEnvironment } from '@test/helpers' +import { cleanDB, resetToken, testEnvironment } from '@test/helpers' import { GraphQLError } from 'graphql' import { createContributionMessage } from '@/seeds/graphql/mutations' -import { listContributionMessages } from '@/seeds/graphql/queries' +import { listContributionMessages, login } from '@/seeds/graphql/queries' +import { userFactory } from '@/seeds/factory/user' +import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' let mutate: any, query: any, con: any let testEnv: any @@ -38,6 +40,39 @@ describe('ContributionMessageResolver', () => { ) }) }) + + describe('authenticated', () => { + beforeAll(async () => { + await userFactory(testEnv, bibiBloxberg) + await query({ + query: login, + variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, + }) + }) + + afterAll(async () => { + await cleanDB() + resetToken() + }) + + describe('input not valid', () => { + it('throws error when contribution does not exist', async () => { + await expect( + mutate({ + mutation: createContributionMessage, + variables: { + contributionId: -1, + message: 'Test', + }, + }), + ).resolves.toEqual( + expect.objectContaining({ + errors: [new GraphQLError('Contribution not found')], + }), + ) + }) + }) + }) }) describe('listContributionMessages', () => { @@ -55,5 +90,20 @@ describe('ContributionMessageResolver', () => { ) }) }) + + describe('authenticated', () => { + beforeAll(async () => { + await userFactory(testEnv, bibiBloxberg) + await query({ + query: login, + variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, + }) + }) + + afterAll(async () => { + await cleanDB() + resetToken() + }) + }) }) }) From 4f02fcc9900875a4b1b7579e592268f23d300241 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 29 Aug 2022 13:18:28 +0200 Subject: [PATCH 342/408] add close on contribution messages list box --- admin/src/pages/CreationConfirm.vue | 1 + .../ContributionMessagesList.vue | 4 ++++ .../Contributions/ContributionListItem.vue | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index f518e1f00..ffefe5d3f 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -98,6 +98,7 @@ export default { this.pendingCreations.find((value) => { value.state = 'IN_PROGRESS' value.messageCount = value.messageCount + 1 + return null }) }, }, diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue index 896487160..5303b1f11 100644 --- a/frontend/src/components/ContributionMessages/ContributionMessagesList.vue +++ b/frontend/src/components/ContributionMessages/ContributionMessagesList.vue @@ -12,6 +12,10 @@ @get-list-contribution-messages="getListContributionMessages" @update-state="updateState" /> +
+ + {{ $t('form.close') }} +