mirror of
https://github.com/flarum/framework.git
synced 2024-12-18 11:03:52 +08:00
Implement notification excerpts
This commit is contained in:
parent
21ad0d8203
commit
d8507f599d
|
@ -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 PostLikedNotification extends Notification {
|
export default class PostLikedNotification extends Notification {
|
||||||
icon() {
|
icon() {
|
||||||
|
@ -13,7 +14,6 @@ export default class PostLikedNotification extends Notification {
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
const notification = this.props.notification;
|
const notification = this.props.notification;
|
||||||
const post = notification.subject();
|
|
||||||
const user = notification.sender();
|
const user = notification.sender();
|
||||||
const auc = notification.additionalUnreadCount();
|
const auc = notification.additionalUnreadCount();
|
||||||
|
|
||||||
|
@ -22,8 +22,11 @@ export default class PostLikedNotification extends Notification {
|
||||||
username: auc ? punctuate([
|
username: auc ? punctuate([
|
||||||
username(user),
|
username(user),
|
||||||
app.trans('likes.others', {count: auc})
|
app.trans('likes.others', {count: auc})
|
||||||
]) : undefined,
|
]) : undefined
|
||||||
number: post.number()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
excerpt() {
|
||||||
|
return truncate(this.props.notification.subject().contentPlain(), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
likes:
|
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_likes_modal_title: Users Who Like This
|
||||||
post_liked_by_self: "{users} like this."
|
post_liked_by_self: "{users} like this."
|
||||||
post_liked_by:
|
post_liked_by:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user