forked from flarum/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostMentionedNotification.js
More file actions
29 lines (23 loc) · 882 Bytes
/
Copy pathPostMentionedNotification.js
File metadata and controls
29 lines (23 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import app from 'flarum/forum/app';
import Notification from 'flarum/forum/components/Notification';
import { truncate } from 'flarum/common/utils/string';
export default class PostMentionedNotification extends Notification {
icon() {
return 'fas fa-reply';
}
href() {
const notification = this.attrs.notification;
const post = notification.subject();
const content = notification.content();
const discussion = content?.discussionId ?? post.discussion();
return app.route.discussion(discussion, content?.replyNumber);
}
content() {
const notification = this.attrs.notification;
const user = notification.fromUser();
return app.translator.trans('flarum-mentions.forum.notifications.post_mentioned_text', { user, count: 1 });
}
excerpt() {
return truncate(this.attrs.notification.subject().contentPlain() || '', 200);
}
}