From feb905b489dbcdcd89034bbcc38c61b426b891ea Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 15 Jan 2026 17:25:43 +0100 Subject: [PATCH] unpinpost --- backend/src/graphql/resolvers/posts.ts | 5 +++-- webapp/components/ContentMenu/ContentMenu.vue | 11 ++++------- webapp/components/PostTeaser/PostTeaser.vue | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/backend/src/graphql/resolvers/posts.ts b/backend/src/graphql/resolvers/posts.ts index dc23334f4..fdfb04c91 100644 --- a/backend/src/graphql/resolvers/posts.ts +++ b/backend/src/graphql/resolvers/posts.ts @@ -503,9 +503,10 @@ export default { unpinGroupPost: async (_parent, params, context, _resolveInfo) => { const result = await context.database.write({ query: ` - MATCH [pinned:GROUP_PINNED]->(post:Post {id: $postId}) + MATCH (post:Post {id: $postId}) + OPTIONAL MATCH (:User)-[pinned:GROUP_PINNED]->(post) DELETE pinned - RETURN post`, + RETURN post {.*}`, variables: { postId: params.id }, }) diff --git a/webapp/components/ContentMenu/ContentMenu.vue b/webapp/components/ContentMenu/ContentMenu.vue index ee4b1eb0c..86e02152a 100644 --- a/webapp/components/ContentMenu/ContentMenu.vue +++ b/webapp/components/ContentMenu/ContentMenu.vue @@ -249,19 +249,16 @@ export default { this.resourceType === 'contribution' && this.resource.group && this.resource.group.myRole === 'owner' && - (this.canBeGroupPinned || this.resource.groupPinnedBy) + (this.canBeGroupPinned || this.resource.groupPinned) ) { routes.push({ - label: this.resource.groupPinnedBy + label: this.resource.groupPinned ? this.$t(`post.menu.groupUnpin`) : this.$t(`post.menu.groupPin`), callback: () => { - this.$emit( - this.resource.groupPinnedBy ? 'unpinGroupPost' : 'pinGroupPost', - this.resource, - ) + this.$emit(this.resource.groupPinned ? 'unpinGroupPost' : 'pinGroupPost', this.resource) }, - icon: this.resource.groupPinnedBy ? 'unlink' : 'link', + icon: this.resource.groupPinned ? 'unlink' : 'link', }) } diff --git a/webapp/components/PostTeaser/PostTeaser.vue b/webapp/components/PostTeaser/PostTeaser.vue index 9d9fdb5a6..051ef61d1 100644 --- a/webapp/components/PostTeaser/PostTeaser.vue +++ b/webapp/components/PostTeaser/PostTeaser.vue @@ -240,7 +240,7 @@ export default { this.$emit('pinGroupPost', post) }, unpinGroupPost(post) { - this.$emit('unpinPost', post) + this.$emit('unpinGroupPost', post) }, pushPost(post) { this.$emit('pushPost', post)