-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathactivity-notification.js
More file actions
46 lines (36 loc) · 1.37 KB
/
activity-notification.js
File metadata and controls
46 lines (36 loc) · 1.37 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Ember from 'ember';
const {
get,
computed,
computed: {
alias,
},
Component,
} = Ember;
export default Component.extend({
classNames: ['flaredown-white-box'],
classNameBindings: ['unreadClass:unreadNotification'],
notificationAnchor: computed('notification.kind', function() {
if( get(this, 'notification.kind') === 'reaction' && get(this, 'notification.notificateableType') === 'post') {
return 'emoji-reactions';
} else {
return `anchor-${get(this, 'notification.notificateableId')}`;
}
}),
people: computed('notification.count', function() {
const count = get(this, 'notification.count');
return `${count} ${count > 1 ? 'people' : 'person'}`;
}),
didWhat: computed('notification.kind', function() {
return get(this, 'notification.kind') === 'comment' ? 'responded' : 'reacted';
}),
fullResponse: computed('people', 'notification.{kind,notifier_username}', function() {
if(get(this, 'notification.kind') === 'mention') {
return (`<b>${get(this, 'notification.notifier_username')}</b> mentioned you in a comment` ).htmlSafe();
} else {
const response = get(this, 'notification.kind') === 'comment' ? 'responded' : 'reacted';
return (`<b>${get(this, 'people')}</b> ${response} to ${get(this, 'notification.postTitle')}`).htmlSafe();
}
}),
unreadClass: alias('notification.unread'),
});