mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 12:43:52 +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 Notification from 'flarum/components/Notification';
|
||||||
import username from 'flarum/helpers/username';
|
import username from 'flarum/helpers/username';
|
||||||
import punctuate from 'flarum/helpers/punctuate';
|
import punctuate from 'flarum/helpers/punctuate';
|
||||||
|
import { truncate } from 'flarum/utils/string';
|
||||||
|
|
||||||
export default class PostMentionedNotification extends Notification {
|
export default class PostMentionedNotification extends Notification {
|
||||||
icon() {
|
icon() {
|
||||||
|
@ -18,7 +19,6 @@ export default class PostMentionedNotification extends Notification {
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
const notification = this.props.notification;
|
const notification = this.props.notification;
|
||||||
const post = notification.subject();
|
|
||||||
const auc = notification.additionalUnreadCount();
|
const auc = notification.additionalUnreadCount();
|
||||||
const user = notification.sender();
|
const user = notification.sender();
|
||||||
|
|
||||||
|
@ -27,8 +27,11 @@ export default class PostMentionedNotification extends Notification {
|
||||||
username: auc ? punctuate([
|
username: auc ? punctuate([
|
||||||
username(user),
|
username(user),
|
||||||
app.trans('mentions.others', {count: auc})
|
app.trans('mentions.others', {count: auc})
|
||||||
]) : undefined,
|
]) : undefined
|
||||||
number: post.number()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
excerpt() {
|
||||||
|
return truncate(this.props.notification.subject().contentPlain(), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
mentions:
|
mentions:
|
||||||
reply_to_post: "Reply to #{number}"
|
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"
|
others: "{count} others"
|
||||||
user_mentioned_notification: "{username} mentioned you"
|
user_mentioned_notification: "{username} mentioned you"
|
||||||
post_mentioned_by: "{users} replied to this."
|
post_mentioned_by: "{users} replied to this."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user