From b088ec9e623842fa72a06cb828a144bcf6895635 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 27 Mar 2026 14:38:46 +0100 Subject: [PATCH] refactor(backend): remove content excerpt (#9441) --- backend/src/db/factories.ts | 6 ---- .../20260327120000-remove-content-excerpt.ts | 35 +++++++++++++++++++ backend/src/db/models/Comment.ts | 1 - backend/src/db/models/Post.ts | 1 - backend/src/db/types/Comment.ts | 1 - backend/src/db/types/Post.ts | 1 - .../queries/comments/DeleteComment.gql | 1 - .../src/graphql/queries/posts/DeletePost.gql | 2 -- backend/src/graphql/queries/posts/Post.gql | 1 - .../src/graphql/queries/users/DeleteUser.gql | 3 -- backend/src/graphql/queries/users/User.gql | 2 -- .../src/graphql/queries/users/UserEmail.gql | 2 -- .../users/UserEmailNotificationSettings.gql | 2 -- .../src/graphql/resolvers/comments.spec.ts | 1 - backend/src/graphql/resolvers/comments.ts | 1 - backend/src/graphql/resolvers/posts.spec.ts | 4 --- backend/src/graphql/resolvers/posts.ts | 1 - backend/src/graphql/resolvers/users.spec.ts | 6 ---- backend/src/graphql/resolvers/users.ts | 1 - backend/src/graphql/types/type/Comment.gql | 5 ++- backend/src/graphql/types/type/Post.gql | 3 -- backend/src/middleware/excerptMiddleware.ts | 24 ------------- .../softDelete/softDeleteMiddleware.spec.ts | 14 -------- .../softDelete/softDeleteMiddleware.ts | 1 - backend/src/middleware/xssMiddleware.ts | 2 +- ...rted_posts_including_the_one_from_above.js | 2 +- webapp/components/CommentCard/CommentCard.vue | 2 +- .../NotificationsTable.spec.js | 26 ++++++++++++-- .../NotificationsTable.story.js | 4 --- .../NotificationsTable/NotificationsTable.vue | 4 +-- webapp/components/PostTeaser/PostTeaser.vue | 10 +++--- .../features/ReportList/ReportList.vue | 2 +- .../features/ReportRow/ReportRow.vue | 4 +-- webapp/components/utils/Notifications.js | 6 ++-- webapp/graphql/CommentMutations.js | 6 ++-- webapp/graphql/CommentQuery.js | 2 +- webapp/graphql/Moderation.js | 2 +- webapp/graphql/PostMutations.js | 16 ++++----- webapp/graphql/fragments/comment.js | 1 - webapp/graphql/fragments/post.js | 1 - webapp/pages/map.vue | 2 +- webapp/plugins/vue-filters.js | 19 ++++++++-- 42 files changed, 108 insertions(+), 122 deletions(-) create mode 100644 backend/src/db/migrations/20260327120000-remove-content-excerpt.ts diff --git a/backend/src/db/factories.ts b/backend/src/db/factories.ts index 883898988..159d2439a 100644 --- a/backend/src/db/factories.ts +++ b/backend/src/db/factories.ts @@ -199,9 +199,6 @@ Factory.define('post') // Convert false to null return pinned || null }) - .attr('contentExcerpt', ['contentExcerpt', 'content'], (contentExcerpt, content) => { - return contentExcerpt || content - }) .attr('slug', ['slug', 'title'], (slug, title) => { return slug || slugify(title, { lower: true }) }) @@ -294,9 +291,6 @@ Factory.define('comment') id: uuid, content: faker.lorem.sentence, }) - .attr('contentExcerpt', ['contentExcerpt', 'content'], (contentExcerpt, content) => { - return contentExcerpt || content - }) .after(async (buildObject, options) => { const [comment, author, post] = await Promise.all([ neode.create('Comment', buildObject), diff --git a/backend/src/db/migrations/20260327120000-remove-content-excerpt.ts b/backend/src/db/migrations/20260327120000-remove-content-excerpt.ts new file mode 100644 index 000000000..2e4c57b01 --- /dev/null +++ b/backend/src/db/migrations/20260327120000-remove-content-excerpt.ts @@ -0,0 +1,35 @@ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ + +import { getDriver } from '@db/neo4j' + +export const description = 'Remove contentExcerpt property from Post and Comment nodes' + +export async function up(_next) { + const driver = getDriver() + const session = driver.session() + const transaction = session.beginTransaction() + + try { + await transaction.run(` + MATCH (n) + WHERE n:Post OR n:Comment + REMOVE n.contentExcerpt + `) + await transaction.commit() + } catch (error) { + // eslint-disable-next-line no-console + console.log(error) + await transaction.rollback() + // eslint-disable-next-line no-console + console.log('rolled back') + throw new Error(error) + } finally { + await session.close() + } +} + +export function down(_next) { + throw new Error( + 'Irreversible migration: contentExcerpt was removed and cannot be restored without regenerating from content', + ) +} diff --git a/backend/src/db/models/Comment.ts b/backend/src/db/models/Comment.ts index f4548f0c2..f935d4069 100644 --- a/backend/src/db/models/Comment.ts +++ b/backend/src/db/models/Comment.ts @@ -10,7 +10,6 @@ export default { default: () => new Date().toISOString(), }, content: { type: 'string', disallow: [null], min: 3 }, - contentExcerpt: { type: 'string', allow: [null] }, deleted: { type: 'boolean', default: false }, disabled: { type: 'boolean', default: false }, post: { diff --git a/backend/src/db/models/Post.ts b/backend/src/db/models/Post.ts index f3a6f7155..6f08705e3 100644 --- a/backend/src/db/models/Post.ts +++ b/backend/src/db/models/Post.ts @@ -19,7 +19,6 @@ export default { title: { type: 'string', disallow: [null], min: 3 }, slug: { type: 'string', allow: [null], unique: 'true' }, content: { type: 'string', disallow: [null], required: true, min: 3 }, - contentExcerpt: { type: 'string', allow: [null] }, deleted: { type: 'boolean', default: false }, disabled: { type: 'boolean', default: false }, clickedCount: { type: 'int', default: 0 }, diff --git a/backend/src/db/types/Comment.ts b/backend/src/db/types/Comment.ts index cf49b15b7..f154cd6e2 100644 --- a/backend/src/db/types/Comment.ts +++ b/backend/src/db/types/Comment.ts @@ -2,7 +2,6 @@ import type { Integer, Node } from 'neo4j-driver' export interface CommentDbProperties { content: string - contentExcerpt: string createdAt: string deleted: boolean disabled: boolean diff --git a/backend/src/db/types/Post.ts b/backend/src/db/types/Post.ts index 83bc00cbd..a80f25d48 100644 --- a/backend/src/db/types/Post.ts +++ b/backend/src/db/types/Post.ts @@ -3,7 +3,6 @@ import type { Integer, Node } from 'neo4j-driver' export interface PostDbProperties { clickedCount: number content: string - contentExcerpt: string createdAt: string deleted: boolean disabled: boolean diff --git a/backend/src/graphql/queries/comments/DeleteComment.gql b/backend/src/graphql/queries/comments/DeleteComment.gql index ae5b809da..dcf6544c5 100644 --- a/backend/src/graphql/queries/comments/DeleteComment.gql +++ b/backend/src/graphql/queries/comments/DeleteComment.gql @@ -2,7 +2,6 @@ mutation DeleteComment($id: ID!) { DeleteComment(id: $id) { id content - contentExcerpt deleted } } diff --git a/backend/src/graphql/queries/posts/DeletePost.gql b/backend/src/graphql/queries/posts/DeletePost.gql index 9c99c3691..a25d95a66 100644 --- a/backend/src/graphql/queries/posts/DeletePost.gql +++ b/backend/src/graphql/queries/posts/DeletePost.gql @@ -3,7 +3,6 @@ mutation DeletePost($id: ID!) { id deleted content - contentExcerpt image { url } @@ -11,7 +10,6 @@ mutation DeletePost($id: ID!) { id deleted content - contentExcerpt } } } diff --git a/backend/src/graphql/queries/posts/Post.gql b/backend/src/graphql/queries/posts/Post.gql index 43088c615..6aeef976e 100644 --- a/backend/src/graphql/queries/posts/Post.gql +++ b/backend/src/graphql/queries/posts/Post.gql @@ -3,7 +3,6 @@ query Post($id: ID, $filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [ id title content - contentExcerpt eventStart pinned createdAt diff --git a/backend/src/graphql/queries/users/DeleteUser.gql b/backend/src/graphql/queries/users/DeleteUser.gql index 0ae9d9e9f..95ad3ce41 100644 --- a/backend/src/graphql/queries/users/DeleteUser.gql +++ b/backend/src/graphql/queries/users/DeleteUser.gql @@ -7,19 +7,16 @@ mutation DeleteUser($id: ID!, $resource: [Deletable]) { contributions { id content - contentExcerpt deleted comments { id content - contentExcerpt deleted } } comments { id content - contentExcerpt deleted } } diff --git a/backend/src/graphql/queries/users/User.gql b/backend/src/graphql/queries/users/User.gql index e4499efe3..688b53a5a 100644 --- a/backend/src/graphql/queries/users/User.gql +++ b/backend/src/graphql/queries/users/User.gql @@ -29,7 +29,6 @@ query User($id: ID, $name: String, $email: String) { comments { id content - contentExcerpt } contributions { id @@ -39,7 +38,6 @@ query User($id: ID, $name: String, $email: String) { url } content - contentExcerpt } } isMuted diff --git a/backend/src/graphql/queries/users/UserEmail.gql b/backend/src/graphql/queries/users/UserEmail.gql index d13141619..76ba2a3e4 100644 --- a/backend/src/graphql/queries/users/UserEmail.gql +++ b/backend/src/graphql/queries/users/UserEmail.gql @@ -30,7 +30,6 @@ query UserEmail($id: ID, $name: String, $email: String) { comments { id content - contentExcerpt } contributions { id @@ -40,7 +39,6 @@ query UserEmail($id: ID, $name: String, $email: String) { url } content - contentExcerpt } } isMuted diff --git a/backend/src/graphql/queries/users/UserEmailNotificationSettings.gql b/backend/src/graphql/queries/users/UserEmailNotificationSettings.gql index e14bb4930..1da18fe48 100644 --- a/backend/src/graphql/queries/users/UserEmailNotificationSettings.gql +++ b/backend/src/graphql/queries/users/UserEmailNotificationSettings.gql @@ -29,7 +29,6 @@ query UserEmailNotificationSettings($id: ID, $name: String, $email: String) { comments { id content - contentExcerpt } contributions { id @@ -39,7 +38,6 @@ query UserEmailNotificationSettings($id: ID, $name: String, $email: String) { url } content - contentExcerpt } } isMuted diff --git a/backend/src/graphql/resolvers/comments.spec.ts b/backend/src/graphql/resolvers/comments.spec.ts index 455a2d851..719d92a35 100644 --- a/backend/src/graphql/resolvers/comments.spec.ts +++ b/backend/src/graphql/resolvers/comments.spec.ts @@ -240,7 +240,6 @@ describe('DeleteComment', () => { id: 'c456', deleted: true, content: 'UNAVAILABLE', - contentExcerpt: 'UNAVAILABLE', }, } expect(data).toMatchObject(expected) diff --git a/backend/src/graphql/resolvers/comments.ts b/backend/src/graphql/resolvers/comments.ts index 5d02d8785..31fd2fe3f 100644 --- a/backend/src/graphql/resolvers/comments.ts +++ b/backend/src/graphql/resolvers/comments.ts @@ -83,7 +83,6 @@ export default { MATCH (comment:Comment {id: $commentId}) SET comment.deleted = TRUE SET comment.content = 'UNAVAILABLE' - SET comment.contentExcerpt = 'UNAVAILABLE' RETURN comment `, { commentId: args.id }, diff --git a/backend/src/graphql/resolvers/posts.spec.ts b/backend/src/graphql/resolvers/posts.spec.ts index 4d247f95d..452e52754 100644 --- a/backend/src/graphql/resolvers/posts.spec.ts +++ b/backend/src/graphql/resolvers/posts.spec.ts @@ -2000,7 +2000,6 @@ describe('DeletePost', () => { id: 'p4711', deleted: true, content: 'UNAVAILABLE', - contentExcerpt: 'UNAVAILABLE', image: null, comments: [], }, @@ -2015,7 +2014,6 @@ describe('DeletePost', () => { 'comment', { content: 'to be deleted comment content', - contentExcerpt: 'to be deleted comment content', }, { postId: 'p4711', @@ -2030,14 +2028,12 @@ describe('DeletePost', () => { id: 'p4711', deleted: true, content: 'UNAVAILABLE', - contentExcerpt: 'UNAVAILABLE', image: null, comments: [ { deleted: true, // Should we black out the comment content in the database, too? content: 'UNAVAILABLE', - contentExcerpt: 'UNAVAILABLE', }, ], }, diff --git a/backend/src/graphql/resolvers/posts.ts b/backend/src/graphql/resolvers/posts.ts index e8e908e91..f0634d3ed 100644 --- a/backend/src/graphql/resolvers/posts.ts +++ b/backend/src/graphql/resolvers/posts.ts @@ -296,7 +296,6 @@ export default { OPTIONAL MATCH (post)<-[:COMMENTS]-(comment:Comment) SET post.deleted = TRUE SET post.content = 'UNAVAILABLE' - SET post.contentExcerpt = 'UNAVAILABLE' SET post.title = 'UNAVAILABLE' SET comment.deleted = TRUE RETURN post {.*} diff --git a/backend/src/graphql/resolvers/users.spec.ts b/backend/src/graphql/resolvers/users.spec.ts index 47dbfb85f..486519cba 100644 --- a/backend/src/graphql/resolvers/users.spec.ts +++ b/backend/src/graphql/resolvers/users.spec.ts @@ -354,13 +354,11 @@ describe('Delete a User as admin', () => { { id: 'p139', content: 'Post by user u343', - contentExcerpt: 'Post by user u343', deleted: false, comments: [ { id: 'c156', content: "A comment by someone else on user u343's post", - contentExcerpt: "A comment by someone else on user u343's post", deleted: false, }, ], @@ -370,7 +368,6 @@ describe('Delete a User as admin', () => { { id: 'c155', content: 'Comment by user u343', - contentExcerpt: 'Comment by user u343', deleted: false, }, ], @@ -400,13 +397,11 @@ describe('Delete a User as admin', () => { { id: 'p139', content: 'UNAVAILABLE', - contentExcerpt: 'UNAVAILABLE', deleted: true, comments: [ { id: 'c156', content: 'UNAVAILABLE', - contentExcerpt: 'UNAVAILABLE', deleted: true, }, ], @@ -416,7 +411,6 @@ describe('Delete a User as admin', () => { { id: 'c155', content: 'UNAVAILABLE', - contentExcerpt: 'UNAVAILABLE', deleted: true, }, ], diff --git a/backend/src/graphql/resolvers/users.ts b/backend/src/graphql/resolvers/users.ts index 25d122e34..fc009da6b 100644 --- a/backend/src/graphql/resolvers/users.ts +++ b/backend/src/graphql/resolvers/users.ts @@ -223,7 +223,6 @@ export default { OPTIONAL MATCH (resource)<-[:COMMENTS]-(comment:Comment) SET resource.deleted = true SET resource.content = 'UNAVAILABLE' - SET resource.contentExcerpt = 'UNAVAILABLE' SET resource.language = 'UNAVAILABLE' SET resource.createdAt = 'UNAVAILABLE' SET resource.updatedAt = 'UNAVAILABLE' diff --git a/backend/src/graphql/types/type/Comment.gql b/backend/src/graphql/types/type/Comment.gql index cbf954efb..3748b14c0 100644 --- a/backend/src/graphql/types/type/Comment.gql +++ b/backend/src/graphql/types/type/Comment.gql @@ -41,7 +41,6 @@ type Comment { activityId: String author: User @relation(name: "WROTE", direction: "IN") content: String! - contentExcerpt: String post: Post @relation(name: "COMMENTS", direction: "OUT") createdAt: String updatedAt: String @@ -81,7 +80,7 @@ type Query { } type Mutation { - CreateComment(id: ID, postId: ID!, content: String!, contentExcerpt: String): Comment - UpdateComment(id: ID!, content: String!, contentExcerpt: String): Comment + CreateComment(id: ID, postId: ID!, content: String!): Comment + UpdateComment(id: ID!, content: String!): Comment DeleteComment(id: ID!): Comment } diff --git a/backend/src/graphql/types/type/Post.gql b/backend/src/graphql/types/type/Post.gql index 919eb64a4..e61b013cf 100644 --- a/backend/src/graphql/types/type/Post.gql +++ b/backend/src/graphql/types/type/Post.gql @@ -129,7 +129,6 @@ type Post { title: String! slug: String! content: String! - contentExcerpt: String image: Image @relation(name: "HERO_IMAGE", direction: "OUT") visibility: Visibility deleted: Boolean @@ -230,7 +229,6 @@ type Mutation { visibility: Visibility language: String categoryIds: [ID] - contentExcerpt: String groupId: ID postType: PostType = Article eventInput: _EventInput @@ -240,7 +238,6 @@ type Mutation { title: String! slug: String content: String! - contentExcerpt: String image: ImageInput visibility: Visibility language: String diff --git a/backend/src/middleware/excerptMiddleware.ts b/backend/src/middleware/excerptMiddleware.ts index b3b23555a..efa002cc8 100644 --- a/backend/src/middleware/excerptMiddleware.ts +++ b/backend/src/middleware/excerptMiddleware.ts @@ -20,33 +20,9 @@ const updateGroup: IMiddlewareResolver = async (resolve, root, args, context, in return resolve(root, args, context, info) } -const createPost: IMiddlewareResolver = async (resolve, root, args, context, info) => { - args.contentExcerpt = trunc(args.content, 120).html - return resolve(root, args, context, info) -} - -const updatePost: IMiddlewareResolver = async (resolve, root, args, context, info) => { - args.contentExcerpt = trunc(args.content, 120).html - return resolve(root, args, context, info) -} - -const createComment: IMiddlewareResolver = async (resolve, root, args, context, info) => { - args.contentExcerpt = trunc(args.content, 180).html - return resolve(root, args, context, info) -} - -const updateComment: IMiddlewareResolver = async (resolve, root, args, context, info) => { - args.contentExcerpt = trunc(args.content, 180).html - return resolve(root, args, context, info) -} - export default { Mutation: { CreateGroup: createGroup, UpdateGroup: updateGroup, - CreatePost: createPost, - UpdatePost: updatePost, - CreateComment: createComment, - UpdateComment: updateComment, }, } diff --git a/backend/src/middleware/softDelete/softDeleteMiddleware.spec.ts b/backend/src/middleware/softDelete/softDeleteMiddleware.spec.ts index c45cb4fb9..2232d57e1 100644 --- a/backend/src/middleware/softDelete/softDeleteMiddleware.spec.ts +++ b/backend/src/middleware/softDelete/softDeleteMiddleware.spec.ts @@ -116,7 +116,6 @@ beforeAll(async () => { id: 'p2', title: 'Disabled post', content: 'This is an offensive post content', - contentExcerpt: 'This is an offensive post content', deleted: false, }, { @@ -132,7 +131,6 @@ beforeAll(async () => { { id: 'c1', content: 'Disabled comment', - contentExcerpt: 'Disabled comment', }, { author: troll, @@ -252,9 +250,6 @@ describe('softDeleteMiddleware', () => { it('displays content', () => { expect(subject.content).toEqual('This is an offensive post content') }) - it('displays contentExcerpt', () => { - expect(subject.contentExcerpt).toEqual('This is an offensive post content') - }) it('displays image', () => { expect(subject.image).toEqual({ url: expect.stringMatching('http://localhost/some/offensive/image.jpg'), @@ -268,9 +263,6 @@ describe('softDeleteMiddleware', () => { it('displays content', () => { expect(subject.content).toEqual('Disabled comment') }) - it('displays contentExcerpt', () => { - expect(subject.contentExcerpt).toEqual('Disabled comment') - }) }) }) @@ -308,9 +300,6 @@ describe('softDeleteMiddleware', () => { it('obfuscates content', () => { expect(subject.content).toEqual('UNAVAILABLE') }) - it('obfuscates contentExcerpt', () => { - expect(subject.contentExcerpt).toEqual('UNAVAILABLE') - }) it('obfuscates image', () => { expect(subject.image).toEqual(null) }) @@ -322,9 +311,6 @@ describe('softDeleteMiddleware', () => { it('obfuscates content', () => { expect(subject.content).toEqual('UNAVAILABLE') }) - it('obfuscates contentExcerpt', () => { - expect(subject.contentExcerpt).toEqual('UNAVAILABLE') - }) }) }) }) diff --git a/backend/src/middleware/softDelete/softDeleteMiddleware.ts b/backend/src/middleware/softDelete/softDeleteMiddleware.ts index 6f277e7d6..4d19b694b 100644 --- a/backend/src/middleware/softDelete/softDeleteMiddleware.ts +++ b/backend/src/middleware/softDelete/softDeleteMiddleware.ts @@ -20,7 +20,6 @@ const setDefaultFilters: IMiddlewareResolver = async (resolve, root, args, conte const obfuscate: IMiddlewareResolver = async (resolve, root, args, context, info) => { if (root.deleted || (!isModerator(context) && root.disabled)) { root.content = 'UNAVAILABLE' - root.contentExcerpt = 'UNAVAILABLE' root.title = 'UNAVAILABLE' root.slug = 'UNAVAILABLE' root.avatar = null diff --git a/backend/src/middleware/xssMiddleware.ts b/backend/src/middleware/xssMiddleware.ts index e7863efb2..3076b424c 100644 --- a/backend/src/middleware/xssMiddleware.ts +++ b/backend/src/middleware/xssMiddleware.ts @@ -41,7 +41,7 @@ const walkRecursive = (data, fields, fieldName, callback, _key?) => { // exclamation mark separates field names, that should not be sanitized const fields = [ { field: 'content', excludes: ['CreateMessage', 'Message'] }, - { field: 'contentExcerpt' }, + { field: 'reasonDescription' }, { field: 'description', excludes: ['embed'] }, { field: 'descriptionExcerpt' }, diff --git a/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js b/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js index ea7abf3a1..24a98b990 100644 --- a/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js +++ b/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js @@ -34,7 +34,7 @@ defineStep('I see all the reported posts including the one from above', () => { } ... on Comment { id - contentExcerpt + content disabled deleted author { diff --git a/webapp/components/CommentCard/CommentCard.vue b/webapp/components/CommentCard/CommentCard.vue index 06b7d7148..64d87e3b2 100644 --- a/webapp/components/CommentCard/CommentCard.vue +++ b/webapp/components/CommentCard/CommentCard.vue @@ -159,7 +159,7 @@ export default { titleIdent: 'delete.comment.title', messageIdent: 'delete.comment.message', messageParams: { - name: this.$filters.truncate(this.comment.contentExcerpt, 30), + name: this.$filters.truncate(this.$filters.removeHtml(this.comment.content), 30), }, buttons: { confirm: { diff --git a/webapp/components/NotificationsTable/NotificationsTable.spec.js b/webapp/components/NotificationsTable/NotificationsTable.spec.js index 35ddaf9b7..135d784ea 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.spec.js +++ b/webapp/components/NotificationsTable/NotificationsTable.spec.js @@ -100,7 +100,7 @@ describe('NotificationsTable.vue', () => { it("renders the Post's content", () => { const boldTags = firstRowNotification.findAll('p') const content = boldTags.filter( - (element) => element.text() === postNotification.from.contentExcerpt, + (element) => element.text() === postNotification.from.content, ) expect(content.exists()).toBe(true) }) @@ -133,12 +133,34 @@ describe('NotificationsTable.vue', () => { it("renders the Post's content", () => { const boldTags = secondRowNotification.findAll('p') const content = boldTags.filter( - (element) => element.text() === commentNotification.from.contentExcerpt, + (element) => element.text() === commentNotification.from.content, ) expect(content.exists()).toBe(true) }) }) + describe('fallback to descriptionExcerpt when content is empty', () => { + it('renders descriptionExcerpt if content is missing', () => { + const fallbackNotification = { + read: false, + reason: 'mentioned_in_post', + from: { + __typename: 'Post', + id: 'post-fallback', + title: 'fallback post', + slug: 'fallback-post', + content: '', + descriptionExcerpt: 'fallback description text', + author: { id: 'u1', slug: 'user', name: 'User' }, + }, + } + propsData.notifications = [fallbackNotification] + wrapper = Wrapper() + const description = wrapper.find('.notification-description') + expect(description.text()).toBe('fallback description text') + }) + }) + describe('unread status', () => { it('does not have class `notification-status`', () => { expect(wrapper.find('.notification-status').exists()).toBe(false) diff --git a/webapp/components/NotificationsTable/NotificationsTable.story.js b/webapp/components/NotificationsTable/NotificationsTable.story.js index 1d27f6532..f7edd28d4 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.story.js +++ b/webapp/components/NotificationsTable/NotificationsTable.story.js @@ -32,8 +32,6 @@ export const notifications = [ deleted: false, content: '

@peter-lustig

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Turpis egestas pretium aenean pharetra magna ac placerat. Tempor id eu nisl nunc mi ipsum faucibus vitae. Nibh praesent tristique magna sit amet purus gravida quis blandit. Magna eget est lorem ipsum dolor. In fermentum posuere urna nec. Eleifend donec pretium vulputate sapien nec sagittis aliquam. Augue interdum velit euismod in pellentesque. Id diam maecenas ultricies mi eget mauris pharetra. Donec pretium vulputate sapien nec. Dolor morbi non arcu risus quis varius quam quisque. Blandit turpis cursus in hac habitasse. Est ultricies integer quis auctor elit sed vulputate mi sit. Nunc consequat interdum varius sit amet mattis vulputate enim. Semper feugiat nibh sed pulvinar. Eget felis eget nunc lobortis mattis aliquam. Ultrices vitae auctor eu augue. Tellus molestie nunc non blandit massa enim nec dui. Pharetra massa massa ultricies mi quis hendrerit dolor. Nisl suscipit adipiscing bibendum est ultricies integer.

', - contentExcerpt: - '

@peter-lustig

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Turpis egestas pretium aenean pharetra …

', ...post, author: user, }, @@ -53,8 +51,6 @@ export const notifications = [ deleted: false, content: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Turpis egestas pretium aenean pharetra magna ac placerat. Tempor id eu nisl nunc mi ipsum faucibus vitae. Nibh praesent tristique magna sit amet purus gravida quis blandit. Magna eget est lorem ipsum dolor. In fermentum posuere urna nec. Eleifend donec pretium vulputate sapien nec sagittis aliquam. Augue interdum velit euismod in pellentesque. Id diam maecenas ultricies mi eget mauris pharetra. Donec pretium vulputate sapien nec. Dolor morbi non arcu risus quis varius quam quisque. Blandit turpis cursus in hac habitasse. Est ultricies integer quis auctor elit sed vulputate mi sit. Nunc consequat interdum varius sit amet mattis vulputate enim. Semper feugiat nibh sed pulvinar. Eget felis eget nunc lobortis mattis aliquam. Ultrices vitae auctor eu augue. Tellus molestie nunc non blandit massa enim nec dui. Pharetra massa massa ultricies mi quis hendrerit dolor. Nisl suscipit adipiscing bibendum est ultricies integer.

@peter-lustig

', - contentExcerpt: - '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Turpis egestas pretium aenean pharetra magna ac …

', ...post, author: user, }, diff --git a/webapp/components/NotificationsTable/NotificationsTable.vue b/webapp/components/NotificationsTable/NotificationsTable.vue index 175a10e74..1b0edebd8 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.vue +++ b/webapp/components/NotificationsTable/NotificationsTable.vue @@ -72,8 +72,8 @@ :class="{ 'notification-status': notification.read }" > {{ - notification.from.contentExcerpt || - notification.from.descriptionExcerpt | removeHtml + $filters.removeHtml(notification.from.content) || + $filters.removeHtml(notification.from.descriptionExcerpt) }}

diff --git a/webapp/components/PostTeaser/PostTeaser.vue b/webapp/components/PostTeaser/PostTeaser.vue index 9518d16dd..6c4addd19 100644 --- a/webapp/components/PostTeaser/PostTeaser.vue +++ b/webapp/components/PostTeaser/PostTeaser.vue @@ -66,9 +66,7 @@ /> - - -
+
{{ excerpt }}