diff --git a/CHANGELOG.md b/CHANGELOG.md index 63b0c2c90..46a704739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,56 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.12.1](https://github.com/gradido/gradido/compare/1.12.0...1.12.1) + +- fix: 🍰 Show Not Icons In `allContribution` List [`#2195`](https://github.com/gradido/gradido/pull/2195) + +#### [1.12.0](https://github.com/gradido/gradido/compare/1.11.0...1.12.0) + +> 12 September 2022 + +- release: v1.12.0 [`#2191`](https://github.com/gradido/gradido/pull/2191) +- if message empty else disabled button [`#2189`](https://github.com/gradido/gradido/pull/2189) +- messages show if Confirmed [`#2185`](https://github.com/gradido/gradido/pull/2185) +- text in messages smaller [`#2186`](https://github.com/gradido/gradido/pull/2186) +- feat: 🍰 Klicktipp retrieve not registered email [`#2181`](https://github.com/gradido/gradido/pull/2181) +- fix: 🍰 isModerator on messages to switch the messages side in the messages overview [`#2182`](https://github.com/gradido/gradido/pull/2182) +- Refactor locales for Nederlands [`#2174`](https://github.com/gradido/gradido/pull/2174) +- Add is moderator to contribution message [`#2180`](https://github.com/gradido/gradido/pull/2180) +- feat: 🍰 Moderator Cannot Answer Himself [`#2178`](https://github.com/gradido/gradido/pull/2178) +- refactor: Improve Statistics Query [`#2170`](https://github.com/gradido/gradido/pull/2170) +- fix: Remove Statistics from Wallet [`#2171`](https://github.com/gradido/gradido/pull/2171) +- feat: 🍰 Contribution Messages In Frontend [`#2164`](https://github.com/gradido/gradido/pull/2164) +- feat: 🚀 CRUD For Contribution Messages [`#2149`](https://github.com/gradido/gradido/pull/2149) +- fix: 🍰 Decay Calculation In Community Statistics [`#2167`](https://github.com/gradido/gradido/pull/2167) +- chore: 🍰 Remove Fetch Policy Network Only From Statistics [`#2159`](https://github.com/gradido/gradido/pull/2159) +- feat: 🍰 Remove Some Statistics Data From Frontend [`#2153`](https://github.com/gradido/gradido/pull/2153) +- feat: 🍰 Add Toogle Collaps On Language Name [`#2156`](https://github.com/gradido/gradido/pull/2156) +- 2145 corrections style for frontend [`#2147`](https://github.com/gradido/gradido/pull/2147) +- 2072 feature usecase contribution messaging [`#2073`](https://github.com/gradido/gradido/pull/2073) +- 2151 add hint to redeem link [`#2158`](https://github.com/gradido/gradido/pull/2158) +- 🍰 Create `contribution messages` table [`#2137`](https://github.com/gradido/gradido/pull/2137) +- feat: 🍰 Add The Languages French And Dutch [`#2138`](https://github.com/gradido/gradido/pull/2138) +- 1973 list open contribution links in the wallet [`#1975`](https://github.com/gradido/gradido/pull/1975) +- feat: 🍰 Admin Interface Displays Statistics [`#2124`](https://github.com/gradido/gradido/pull/2124) +- feat: Statistics Resolver [`#2041`](https://github.com/gradido/gradido/pull/2041) +- 2116 retrieve admin and moderators [`#2127`](https://github.com/gradido/gradido/pull/2127) +- 2125 feature gradido id: new column gradidoid in users table [`#2126`](https://github.com/gradido/gradido/pull/2126) +- 2119 new menu item gdt [`#2120`](https://github.com/gradido/gradido/pull/2120) +- feat: Migrate Contributions Table [`#2136`](https://github.com/gradido/gradido/pull/2136) +- chore: 🍰 Refactor Contribution Form Logic And Write Tests [`#2092`](https://github.com/gradido/gradido/pull/2092) +- fix: 🍰 Add `emailChecked` Before Changing `optIn` State & Log Error On klicktipp Middleware [`#2107`](https://github.com/gradido/gradido/pull/2107) +- Add RIGHTS.LIST_CONTRIBUTION_LINKS to ROLE_USER [`#2123`](https://github.com/gradido/gradido/pull/2123) +- 2121 translate locales to spanish [`#2122`](https://github.com/gradido/gradido/pull/2122) +- add formatter on input amount replace point and comma [`#2115`](https://github.com/gradido/gradido/pull/2115) +- remove required from form.memo [`#2114`](https://github.com/gradido/gradido/pull/2114) +- Fix pagination ellipsis [`#2104`](https://github.com/gradido/gradido/pull/2104) + #### [1.11.0](https://github.com/gradido/gradido/compare/1.10.1...1.11.0) +> 28 July 2022 + +- release: Version 1.11.0 [`#2103`](https://github.com/gradido/gradido/pull/2103) - Fix navbar community item [`#2102`](https://github.com/gradido/gradido/pull/2102) - Add validation date info to copied text after transaction link creation [`#2101`](https://github.com/gradido/gradido/pull/2101) - Remove member area from menu (desktop and mobile), when user has no elopage account [`#2099`](https://github.com/gradido/gradido/pull/2099) diff --git a/admin/package.json b/admin/package.json index 9879064de..f56ae0a87 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.11.0", + "version": "1.12.1", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js b/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js new file mode 100644 index 000000000..62fcab505 --- /dev/null +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js @@ -0,0 +1,111 @@ +import { mount } from '@vue/test-utils' +import ContributionMessagesFormular from './ContributionMessagesFormular.vue' +import { toastErrorSpy, toastSuccessSpy } from '../../../test/testSetup' + +const localVue = global.localVue + +const apolloMutateMock = jest.fn().mockResolvedValue() + +describe('ContributionMessagesFormular', () => { + let wrapper + + const propsData = { + contributionId: 42, + } + + const mocks = { + $t: jest.fn((t) => t), + $apollo: { + mutate: apolloMutateMock, + }, + $i18n: { + locale: 'en', + }, + } + + const Wrapper = () => { + return mount(ContributionMessagesFormular, { + localVue, + mocks, + propsData, + }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has a DIV .contribution-messages-formular', () => { + expect(wrapper.find('div.contribution-messages-formular').exists()).toBe(true) + }) + + describe('on trigger reset', () => { + beforeEach(async () => { + wrapper.setData({ + form: { + text: 'text form message', + }, + }) + await wrapper.find('form').trigger('reset') + }) + + it('form has empty text', () => { + expect(wrapper.vm.form).toEqual({ + text: '', + }) + }) + }) + + describe('on trigger submit', () => { + beforeEach(async () => { + wrapper.setData({ + form: { + text: 'text form message', + }, + }) + await wrapper.find('form').trigger('submit') + }) + + it('emitted "get-list-contribution-messages" with data', async () => { + expect(wrapper.emitted('get-list-contribution-messages')).toEqual( + expect.arrayContaining([expect.arrayContaining([42])]), + ) + }) + + it('emitted "update-state" with data', async () => { + expect(wrapper.emitted('update-state')).toEqual( + expect.arrayContaining([expect.arrayContaining([42])]), + ) + }) + }) + + describe('send contribution message with error', () => { + beforeEach(async () => { + apolloMutateMock.mockRejectedValue({ message: 'OUCH!' }) + wrapper = Wrapper() + await wrapper.find('form').trigger('submit') + }) + + it('toasts an error message', () => { + expect(toastErrorSpy).toBeCalledWith('OUCH!') + }) + }) + + describe('send contribution message with success', () => { + beforeEach(async () => { + wrapper.setData({ + form: { + text: 'text form message', + }, + }) + wrapper = Wrapper() + await wrapper.find('form').trigger('submit') + }) + + it('toasts an success message', () => { + expect(toastSuccessSpy).toBeCalledWith('message.request') + }) + }) + }) +}) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue new file mode 100644 index 000000000..a0e790abe --- /dev/null +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -0,0 +1,77 @@ + + diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.spec.js b/admin/src/components/ContributionMessages/ContributionMessagesList.spec.js new file mode 100644 index 000000000..0bca08b2a --- /dev/null +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.spec.js @@ -0,0 +1,56 @@ +import { mount } from '@vue/test-utils' +import ContributionMessagesList from './ContributionMessagesList.vue' + +const localVue = global.localVue + +const apolloQueryMock = jest.fn().mockResolvedValue() + +describe('ContributionMessagesList', () => { + let wrapper + + const propsData = { + contributionId: 42, + } + + const mocks = { + $t: jest.fn((t) => t), + $i18n: { + locale: 'en', + }, + $apollo: { + query: apolloQueryMock, + }, + } + + const Wrapper = () => { + return mount(ContributionMessagesList, { + localVue, + mocks, + propsData, + }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('sends query to Apollo when created', () => { + expect(apolloQueryMock).toBeCalledWith( + expect.objectContaining({ + variables: { + contributionId: propsData.contributionId, + }, + }), + ) + }) + + it('has a DIV .contribution-messages-list', () => { + expect(wrapper.find('div.contribution-messages-list').exists()).toBe(true) + }) + + it('has a Component ContributionMessagesFormular', () => { + expect(wrapper.findComponent({ name: 'ContributionMessagesFormular' }).exists()).toBe(true) + }) + }) +}) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesList.vue b/admin/src/components/ContributionMessages/ContributionMessagesList.vue new file mode 100644 index 000000000..8f5a3e119 --- /dev/null +++ b/admin/src/components/ContributionMessages/ContributionMessagesList.vue @@ -0,0 +1,69 @@ + + + diff --git a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.spec.js b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.spec.js new file mode 100644 index 000000000..7cca315d7 --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.spec.js @@ -0,0 +1,58 @@ +import { mount } from '@vue/test-utils' +import ContributionMessagesListItem from './ContributionMessagesListItem.vue' + +const localVue = global.localVue + +describe('ContributionMessagesListItem', () => { + let wrapper + + const mocks = { + $t: jest.fn((t) => t), + $d: jest.fn((d) => d), + $store: { + state: { + moderator: { + id: 107, + }, + }, + }, + } + + const propsData = { + contributionId: 42, + state: 'PENDING0', + message: { + id: 111, + message: 'asd asda sda sda', + createdAt: '2022-08-29T12:23:27.000Z', + updatedAt: null, + type: 'DIALOG', + userFirstName: 'Peter', + userLastName: 'Lustig', + userId: 107, + __typename: 'ContributionMessage', + }, + } + + const Wrapper = () => { + return mount(ContributionMessagesListItem, { + localVue, + mocks, + propsData, + }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has a DIV .contribution-messages-list-item', () => { + expect(wrapper.find('div.contribution-messages-list-item').exists()).toBe(true) + }) + + it('props.message.default', () => { + expect(wrapper.vm.$options.props.message.default.call()).toEqual({}) + }) + }) +}) diff --git a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue new file mode 100644 index 000000000..fa5bdd940 --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue @@ -0,0 +1,27 @@ + + diff --git a/admin/src/components/ContributionMessages/slots/IsModerator.spec.js b/admin/src/components/ContributionMessages/slots/IsModerator.spec.js new file mode 100644 index 000000000..b1e09da94 --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/IsModerator.spec.js @@ -0,0 +1,49 @@ +import { mount } from '@vue/test-utils' +import IsModerator from './IsModerator.vue' + +const localVue = global.localVue + +describe('IsModerator', () => { + let wrapper + + const mocks = { + $t: jest.fn((t) => t), + $d: jest.fn((d) => d), + } + + const propsData = { + message: { + id: 111, + message: 'asd asda sda sda', + createdAt: '2022-08-29T12:23:27.000Z', + updatedAt: null, + type: 'DIALOG', + userFirstName: 'Peter', + userLastName: 'Lustig', + userId: 107, + __typename: 'ContributionMessage', + }, + } + + const Wrapper = () => { + return mount(IsModerator, { + localVue, + mocks, + propsData, + }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has a DIV .slot-is-moderator', () => { + expect(wrapper.find('div.slot-is-moderator').exists()).toBe(true) + }) + + it('props.message.default', () => { + expect(wrapper.vm.$options.props.message.default.call()).toEqual({}) + }) + }) +}) diff --git a/admin/src/components/ContributionMessages/slots/IsModerator.vue b/admin/src/components/ContributionMessages/slots/IsModerator.vue new file mode 100644 index 000000000..0224e042f --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/IsModerator.vue @@ -0,0 +1,37 @@ + + + diff --git a/admin/src/components/ContributionMessages/slots/IsNotModerator.spec.js b/admin/src/components/ContributionMessages/slots/IsNotModerator.spec.js new file mode 100644 index 000000000..24152ad1e --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/IsNotModerator.spec.js @@ -0,0 +1,49 @@ +import { mount } from '@vue/test-utils' +import IsNotModerator from './IsNotModerator.vue' + +const localVue = global.localVue + +describe('IsNotModerator', () => { + let wrapper + + const mocks = { + $t: jest.fn((t) => t), + $d: jest.fn((d) => d), + } + + const propsData = { + message: { + id: 113, + message: 'asda sdad ad asdasd ', + createdAt: '2022-08-29T12:25:34.000Z', + updatedAt: null, + type: 'DIALOG', + userFirstName: 'Bibi', + userLastName: 'Bloxberg', + userId: 108, + __typename: 'ContributionMessage', + }, + } + + const Wrapper = () => { + return mount(IsNotModerator, { + localVue, + mocks, + propsData, + }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has a DIV .slot-is-not-moderator', () => { + expect(wrapper.find('div.slot-is-not-moderator').exists()).toBe(true) + }) + + it('props.message.default', () => { + expect(wrapper.vm.$options.props.message.default.call()).toEqual({}) + }) + }) +}) diff --git a/admin/src/components/ContributionMessages/slots/IsNotModerator.vue b/admin/src/components/ContributionMessages/slots/IsNotModerator.vue new file mode 100644 index 000000000..64946c557 --- /dev/null +++ b/admin/src/components/ContributionMessages/slots/IsNotModerator.vue @@ -0,0 +1,34 @@ + + + diff --git a/admin/src/components/Tables/OpenCreationsTable.vue b/admin/src/components/Tables/OpenCreationsTable.vue index 3ebc81fba..af9947f85 100644 --- a/admin/src/components/Tables/OpenCreationsTable.vue +++ b/admin/src/components/Tables/OpenCreationsTable.vue @@ -12,20 +12,42 @@