diff --git a/backend/src/db/graphql/groups.js b/backend/src/db/graphql/groups.js index 150bb5e9a..ff63f1a25 100644 --- a/backend/src/db/graphql/groups.js +++ b/backend/src/db/graphql/groups.js @@ -161,15 +161,17 @@ export const groupQuery = gql` description groupType actionRadius - myRole categories { id slug name icon } - # avatar # test this as result + avatar { + url + } # locationName # test this as result + myRole } } ` diff --git a/backend/src/middleware/sluggifyMiddleware.js b/backend/src/middleware/sluggifyMiddleware.js index 8fd200e8f..5ef2944be 100644 --- a/backend/src/middleware/sluggifyMiddleware.js +++ b/backend/src/middleware/sluggifyMiddleware.js @@ -31,7 +31,9 @@ export default { return resolve(root, args, context, info) }, UpdateGroup: async (resolve, root, args, context, info) => { - args.slug = args.slug || (await uniqueSlug(args.name, isUniqueFor(context, 'Group'))) + if (args.name) { + args.slug = args.slug || (await uniqueSlug(args.name, isUniqueFor(context, 'Group'))) + } return resolve(root, args, context, info) }, CreatePost: async (resolve, root, args, context, info) => { @@ -39,6 +41,7 @@ export default { return resolve(root, args, context, info) }, UpdatePost: async (resolve, root, args, context, info) => { + // TODO: is this absolutely correct, see condition in 'UpdateGroup' above? may it works accidentally, because args.slug is always send? args.slug = args.slug || (await uniqueSlug(args.title, isUniqueFor(context, 'Post'))) return resolve(root, args, context, info) }, diff --git a/backend/src/schema/resolvers/groups.js b/backend/src/schema/resolvers/groups.js index 2111aa54a..9aac2ab6a 100644 --- a/backend/src/schema/resolvers/groups.js +++ b/backend/src/schema/resolvers/groups.js @@ -137,6 +137,7 @@ export default { const { categoryIds } = params const { id: groupId, avatar: avatarInput } = params delete params.categoryIds + delete params.avatar if (CONFIG.CATEGORIES_ACTIVE && categoryIds) { if (categoryIds.length < CATEGORIES_MIN) { throw new UserInputError('Too view categories!') @@ -270,6 +271,9 @@ export default { hasMany: { categories: '-[:CATEGORIZED]->(related:Category)', }, + hasOne: { + avatar: '-[:AVATAR_IMAGE]->(related:Image)', + }, }), }, } diff --git a/cypress/integration/Post.Comment/I_should_see_my_comment.js b/cypress/integration/Post.Comment/I_should_see_my_comment.js index 356593f9c..8d439b112 100644 --- a/cypress/integration/Post.Comment/I_should_see_my_comment.js +++ b/cypress/integration/Post.Comment/I_should_see_my_comment.js @@ -5,7 +5,7 @@ Then("I should see my comment", () => { .should("contain", "Ocelot.social rocks") .get(".user-teaser span.slug") .should("contain", "@peter-pan") // specific enough - .get(".user-avatar img") + .get(".profile-avatar img") .should("have.attr", "src") .and("contain", 'https://') // some url .get(".user-teaser > .info > .text") diff --git a/cypress/integration/UserProfile.Avatar/I_cannot_upload_a_picture.js b/cypress/integration/UserProfile.Avatar/I_cannot_upload_a_picture.js index d20a181f2..8b501f3f5 100644 --- a/cypress/integration/UserProfile.Avatar/I_cannot_upload_a_picture.js +++ b/cypress/integration/UserProfile.Avatar/I_cannot_upload_a_picture.js @@ -4,5 +4,5 @@ Then("I cannot upload a picture", () => { cy.get(".base-card") .children() .should("not.have.id", "customdropzone") - .should("have.class", "user-avatar"); + .should("have.class", "profile-avatar"); }); \ No newline at end of file diff --git a/cypress/integration/UserProfile.Avatar/I_should_be_able_to_change_my_profile_picture.js b/cypress/integration/UserProfile.Avatar/I_should_be_able_to_change_my_profile_picture.js index f92789ef8..366fd8292 100644 --- a/cypress/integration/UserProfile.Avatar/I_should_be_able_to_change_my_profile_picture.js +++ b/cypress/integration/UserProfile.Avatar/I_should_be_able_to_change_my_profile_picture.js @@ -9,7 +9,7 @@ Then("I should be able to change my profile picture", () => { { subjectType: "drag-n-drop", force: true } ); }); - cy.get(".profile-avatar img") + cy.get(".profile-page-avatar img") .should("have.attr", "src") .and("contains", "onourjourney"); cy.contains(".iziToast-message", "Upload successful") diff --git a/webapp/components/AvatarMenu/AvatarMenu.spec.js b/webapp/components/AvatarMenu/AvatarMenu.spec.js index 85f5c32a8..77de68de4 100644 --- a/webapp/components/AvatarMenu/AvatarMenu.spec.js +++ b/webapp/components/AvatarMenu/AvatarMenu.spec.js @@ -42,9 +42,9 @@ describe('AvatarMenu.vue', () => { wrapper = Wrapper() }) - it('renders the UserAvatar component', () => { + it('renders the ProfileAvatar component', () => { wrapper.find('.avatar-menu-trigger').trigger('click') - expect(wrapper.find('.user-avatar').exists()).toBe(true) + expect(wrapper.find('.profile-avatar').exists()).toBe(true) }) describe('given a userName', () => { diff --git a/webapp/components/AvatarMenu/AvatarMenu.vue b/webapp/components/AvatarMenu/AvatarMenu.vue index d47eb2d68..061e96221 100644 --- a/webapp/components/AvatarMenu/AvatarMenu.vue +++ b/webapp/components/AvatarMenu/AvatarMenu.vue @@ -11,7 +11,7 @@ " @click.prevent="toggleMenu" > - + @@ -50,12 +50,12 @@ diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 4fef7d3aa..bfb7adf0d 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -7,10 +7,10 @@ :class="{ 'disabled-content': user.disabled }" style="position: relative; height: auto; overflow: visible" > - - - - + + + +