Implement notification excerpts

This commit is contained in:
Toby Zerner 2015-08-21 09:54:57 +09:30
parent 6606f416af
commit 1930fcdd92
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 PostMentionedNotification extends Notification {
icon() {
@ -18,7 +19,6 @@ export default class PostMentionedNotification extends Notification {
content() {
const notification = this.props.notification;
const post = notification.subject();
const auc = notification.additionalUnreadCount();
const user = notification.sender();
@ -27,8 +27,11 @@ export default class PostMentionedNotification extends Notification {
username: auc ? punctuate([
username(user),
app.trans('mentions.others', {count: auc})
]) : undefined,
number: post.number()
]) : undefined
});
}
excerpt() {
return truncate(this.props.notification.subject().contentPlain(), 100);
}
}

View File

@ -1,6 +1,6 @@
mentions:
reply_to_post: "Reply to #{number}"
post_mentioned_notification: "{username} replied to your post #{number}"
post_mentioned_notification: "{username} replied to your post"
others: "{count} others"
user_mentioned_notification: "{username} mentioned you"
post_mentioned_by: "{users} replied to this."