diff --git a/api/src/services/activity.ts b/api/src/services/activity.ts index fb7f704ebc..64ef0be871 100644 --- a/api/src/services/activity.ts +++ b/api/src/services/activity.ts @@ -10,6 +10,7 @@ import logger from '../logger'; import { userName } from '../utils/user-name'; import { uniq } from 'lodash'; import env from '../env'; +import validateUUID from 'uuid-validate'; export class ActivityService extends ItemsService { notificationsService: NotificationsService; @@ -66,10 +67,13 @@ export class ActivityService extends ItemsService { let comment = data.comment; for (const mention of mentions) { - comment = comment.replace(mention, userPreviews[mention.substring(1)] ?? '@Unknown User'); + const uuid = mention.substring(1); + // We only match on UUIDs in the first place. This is just an extra sanity check + if (validateUUID(uuid) === false) continue; + comment = comment.replace(new RegExp(mention, 'gm'), userPreviews[uuid] ?? '@Unknown User'); } - comment = `> ${comment}`; + comment = `> ${comment.replace(/\n+/gm, '\n> ')}`; const message = ` Hello ${userName(user)}, diff --git a/app/src/components/v-template-input.vue b/app/src/components/v-template-input.vue index 419c684248..5bab5e23f3 100644 --- a/app/src/components/v-template-input.vue +++ b/app/src/components/v-template-input.vue @@ -10,7 +10,7 @@ diff --git a/app/src/views/private/components/comments-sidebar-detail/comments-sidebar-detail.vue b/app/src/views/private/components/comments-sidebar-detail/comments-sidebar-detail.vue index 4a727cff80..8c5ad6cf9a 100644 --- a/app/src/views/private/components/comments-sidebar-detail/comments-sidebar-detail.vue +++ b/app/src/views/private/components/comments-sidebar-detail/comments-sidebar-detail.vue @@ -109,7 +109,7 @@ export default defineComponent({ return { ...comment, - display: newCommentText, + display: newCommentText.replaceAll('\n', '
'), }; });