From d8507f599d3fd592bfccc05915a2866bd86d9fc0 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 21 Aug 2015 09:55:08 +0930 Subject: [PATCH] Implement notification excerpts --- .../js/forum/src/components/PostLikedNotification.js | 9 ++++++--- extensions/likes/locale/en.yml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/extensions/likes/js/forum/src/components/PostLikedNotification.js b/extensions/likes/js/forum/src/components/PostLikedNotification.js index a07b86467..89156493e 100644 --- a/extensions/likes/js/forum/src/components/PostLikedNotification.js +++ b/extensions/likes/js/forum/src/components/PostLikedNotification.js @@ -1,6 +1,7 @@ import Notification from 'flarum/components/Notification'; import username from 'flarum/helpers/username'; import punctuate from 'flarum/helpers/punctuate'; +import { truncate } from 'flarum/utils/string'; export default class PostLikedNotification extends Notification { icon() { @@ -13,7 +14,6 @@ export default class PostLikedNotification extends Notification { content() { const notification = this.props.notification; - const post = notification.subject(); const user = notification.sender(); const auc = notification.additionalUnreadCount(); @@ -22,8 +22,11 @@ export default class PostLikedNotification extends Notification { username: auc ? punctuate([ username(user), app.trans('likes.others', {count: auc}) - ]) : undefined, - number: post.number() + ]) : undefined }); } + + excerpt() { + return truncate(this.props.notification.subject().contentPlain(), 100); + } } diff --git a/extensions/likes/locale/en.yml b/extensions/likes/locale/en.yml index 750fa2062..3fa9b2f62 100644 --- a/extensions/likes/locale/en.yml +++ b/extensions/likes/locale/en.yml @@ -1,5 +1,5 @@ likes: - post_liked_notification: "{username} liked your post #{number}" + post_liked_notification: "{username} liked your post" post_likes_modal_title: Users Who Like This post_liked_by_self: "{users} like this." post_liked_by: