1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

Implement notification excerpts

This commit is contained in:
Toby Zerner
2015-08-21 09:55:08 +09:30
parent 21ad0d8203
commit d8507f599d
2 changed files with 7 additions and 4 deletions

View File

@@ -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);
}
}