diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9564aa2f7..de171cc61 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -267,7 +267,7 @@ jobs: report_name: Coverage Webapp type: lcov result_path: ./coverage/lcov.info - min_coverage: 65 + min_coverage: 64 token: ${{ github.token }} ############################################################################## diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 0e14841d1..1ef1777fe 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -138,6 +138,7 @@ describe('ContributionForm.vue', () => { categoryIds: [], id: null, image: null, + groupId: null, }, } postTitleInput = wrapper.find('.ds-input') @@ -260,6 +261,7 @@ describe('ContributionForm.vue', () => { content: propsData.contribution.content, categoryIds: [], id: propsData.contribution.id, + groupId: null, image: { sensitive: false, }, diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 6eb1ebbbc..0428b2e23 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -99,6 +99,10 @@ export default { type: Object, default: () => ({}), }, + groupId: { + type: String, + default: () => null, + }, }, data() { const { title, content, image, categories } = this.contribution @@ -173,6 +177,7 @@ export default { categoryIds, id: this.contribution.id || null, image, + groupId: this.groupId, }, }) .then(({ data }) => { diff --git a/webapp/graphql/PostMutations.js b/webapp/graphql/PostMutations.js index ee61efc3b..8880a93b0 100644 --- a/webapp/graphql/PostMutations.js +++ b/webapp/graphql/PostMutations.js @@ -3,8 +3,20 @@ import gql from 'graphql-tag' export default () => { return { CreatePost: gql` - mutation ($title: String!, $content: String!, $categoryIds: [ID], $image: ImageInput) { - CreatePost(title: $title, content: $content, categoryIds: $categoryIds, image: $image) { + mutation ( + $title: String! + $content: String! + $categoryIds: [ID] + $image: ImageInput + $groupId: ID + ) { + CreatePost( + title: $title + content: $content + categoryIds: $categoryIds + image: $image + groupId: $groupId + ) { title slug content diff --git a/webapp/graphql/PostQuery.js b/webapp/graphql/PostQuery.js index 38c90e438..478291c82 100644 --- a/webapp/graphql/PostQuery.js +++ b/webapp/graphql/PostQuery.js @@ -39,6 +39,11 @@ export default (i18n) => { ...locationAndBadges } } + group { + id + name + slug + } } } ` diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 6375ca48f..d0a4d14f0 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -605,7 +605,19 @@ "submitted": "Kommentar gesendet", "updated": "Änderungen gespeichert" }, + "createNewPost": { + "forGroup": { + "title": "Für die Gruppe „{name}“" + }, + "title": "Erstelle einen neuen Beitrag" + }, "edited": "bearbeitet", + "editPost": { + "forGroup": { + "title": "Für die Gruppe „{name}“" + }, + "title": "Bearbeite deinen Beitrag" + }, "menu": { "delete": "Beitrag löschen", "edit": "Beitrag bearbeiten", @@ -618,6 +630,12 @@ "pinned": "Meldung", "takeAction": { "name": "Aktiv werden" + }, + "viewPost": { + "forGroup": { + "title": "In der Gruppe „{name}“" + }, + "title": "Beitrag" } }, "profile": { diff --git a/webapp/locales/en.json b/webapp/locales/en.json index aab9c6f83..bfc825b90 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -605,7 +605,19 @@ "submitted": "Comment submitted!", "updated": "Changes saved!" }, + "createNewPost": { + "forGroup": { + "title": "For The Group “{name}”" + }, + "title": "Create A New Post" + }, "edited": "edited", + "editPost": { + "forGroup": { + "title": "For The Group “{name}”" + }, + "title": "Edit Your Post" + }, "menu": { "delete": "Delete post", "edit": "Edit post", @@ -618,6 +630,12 @@ "pinned": "Announcement", "takeAction": { "name": "Take action" + }, + "viewPost": { + "forGroup": { + "title": "In The Group “{name}”" + }, + "title": "Post" } }, "profile": { diff --git a/webapp/pages/group/_id/_slug.spec.js b/webapp/pages/group/_id/_slug.spec.js index e70df568a..058b024bf 100644 --- a/webapp/pages/group/_id/_slug.spec.js +++ b/webapp/pages/group/_id/_slug.spec.js @@ -8,8 +8,8 @@ localVue.filter('date', (d) => d) config.stubs['client-only'] = '' config.stubs['v-popover'] = '' config.stubs['nuxt-link'] = '' -// config.stubs['infinite-loading'] = '' -// config.stubs['follow-list'] = '' +config.stubs['infinite-loading'] = '' +config.stubs['follow-list'] = '' describe('GroupProfileSlug', () => { let wrapper @@ -196,10 +196,11 @@ describe('GroupProfileSlug', () => { }) describe('mount', () => { - Wrapper = () => { + Wrapper = (data = () => {}) => { return mount(GroupProfileSlug, { mocks, localVue, + data, }) } @@ -213,15 +214,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...yogaPractice, - myRole: 'owner', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: 'owner', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -365,15 +367,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...yogaPractice, - myRole: 'usual', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: 'usual', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -477,15 +480,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...yogaPractice, - myRole: 'pending', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: 'pending', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -589,15 +593,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...yogaPractice, - myRole: null, - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: null, + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -705,15 +710,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...schoolForCitizens, - myRole: 'owner', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...schoolForCitizens, + myRole: 'owner', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -821,15 +827,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...schoolForCitizens, - myRole: 'usual', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...schoolForCitizens, + myRole: 'usual', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -937,15 +944,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...schoolForCitizens, - myRole: 'pending', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...schoolForCitizens, + myRole: 'pending', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -1053,15 +1061,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...schoolForCitizens, - myRole: null, - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...schoolForCitizens, + myRole: null, + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -1173,15 +1182,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...investigativeJournalism, - myRole: 'owner', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...investigativeJournalism, + myRole: 'owner', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -1292,15 +1302,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...investigativeJournalism, - myRole: 'usual', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...investigativeJournalism, + myRole: 'usual', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -1411,15 +1422,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...investigativeJournalism, - myRole: 'pending', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...investigativeJournalism, + myRole: 'pending', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) @@ -1518,15 +1530,16 @@ describe('GroupProfileSlug', () => { 'auth/isModerator': () => false, }, } - wrapper = Wrapper() - wrapper.setData({ - Group: [ - { - ...investigativeJournalism, - myRole: null, - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + wrapper = Wrapper(() => { + return { + Group: [ + { + ...investigativeJournalism, + myRole: null, + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } }) }) diff --git a/webapp/pages/group/_id/_slug.vue b/webapp/pages/group/_id/_slug.vue index ab342480c..0c9c69c85 100644 --- a/webapp/pages/group/_id/_slug.vue +++ b/webapp/pages/group/_id/_slug.vue @@ -250,10 +250,9 @@ - + - + @@ -307,11 +306,11 @@ - - diff --git a/webapp/pages/post/_id/_slug/index.spec.js b/webapp/pages/post/_id/_slug/index.spec.js index 4737386ef..2dd4522b2 100644 --- a/webapp/pages/post/_id/_slug/index.spec.js +++ b/webapp/pages/post/_id/_slug/index.spec.js @@ -56,6 +56,10 @@ describe('PostSlug', () => { }, $route: { hash: '', + params: { + slug: 'slug', + id: 'id', + }, }, // If you are mocking the router, then don't use VueRouter with localVue: https://vue-test-utils.vuejs.org/guides/using-with-vue-router.html $router: { diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 724704f67..0516ec510 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -1,107 +1,129 @@ @@ -167,6 +189,31 @@ export default { }, 50) }, computed: { + routes() { + const { slug, id } = this.$route.params + return [ + { + name: this.$t('common.post', null, 1), + path: `/post/${id}/${slug}`, + children: [ + { + name: this.$t('common.comment', null, 2), + path: `/post/${id}/${slug}#comments`, + }, + // TODO implement + /* { + name: this.$t('common.letsTalk'), + path: `/post/${id}/${slug}#lets-talk` + }, */ + // TODO implement + /* { + name: this.$t('common.versus'), + path: `/post/${id}/${slug}#versus` + } */ + ], + }, + ] + }, menuModalsData() { return postMenuModalsData( // "this.post" may not always be defined at the beginning … @@ -266,6 +313,11 @@ export default { }