From e2bb04ce34c3fc200fe64406f20e05dd84ebd42b Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 3 Dec 2018 09:37:01 +1030 Subject: [PATCH] Truncate notification excerpts --- .../js/src/forum/components/PostMentionedNotification.js | 3 ++- .../js/src/forum/components/UserMentionedNotification.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/mentions/js/src/forum/components/PostMentionedNotification.js b/extensions/mentions/js/src/forum/components/PostMentionedNotification.js index db7ac4cc6..64ab88159 100644 --- a/extensions/mentions/js/src/forum/components/PostMentionedNotification.js +++ b/extensions/mentions/js/src/forum/components/PostMentionedNotification.js @@ -1,4 +1,5 @@ import Notification from 'flarum/components/Notification'; +import { truncate } from 'flarum/utils/string'; export default class PostMentionedNotification extends Notification { icon() { @@ -21,6 +22,6 @@ export default class PostMentionedNotification extends Notification { } excerpt() { - return this.props.notification.subject().contentPlain(); + return truncate(this.props.notification.subject().contentPlain(), 200); } } diff --git a/extensions/mentions/js/src/forum/components/UserMentionedNotification.js b/extensions/mentions/js/src/forum/components/UserMentionedNotification.js index 0cf183676..6808a06cf 100644 --- a/extensions/mentions/js/src/forum/components/UserMentionedNotification.js +++ b/extensions/mentions/js/src/forum/components/UserMentionedNotification.js @@ -1,4 +1,5 @@ import Notification from 'flarum/components/Notification'; +import { truncate } from 'flarum/utils/string'; export default class UserMentionedNotification extends Notification { icon() { @@ -18,6 +19,6 @@ export default class UserMentionedNotification extends Notification { } excerpt() { - return this.props.notification.subject().contentPlain(); + return truncate(this.props.notification.subject().contentPlain(), 200); } }