mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 04:33:47 +08:00
Implement notification excerpts
This commit is contained in:
parent
6606f416af
commit
1930fcdd92
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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."
|
||||
|
|
Loading…
Reference in New Issue
Block a user