mirror of
https://github.com/flarum/core.git
synced 2025-08-06 16:36:47 +02:00
Implement notifications
This commit is contained in:
21
ember/app/models/notification.js
Normal file
21
ember/app/models/notification.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
contentType: DS.attr('string'),
|
||||
subjectId: DS.attr('number'),
|
||||
content: DS.attr(),
|
||||
time: DS.attr('date'),
|
||||
isRead: DS.attr('boolean'),
|
||||
unreadCount: DS.attr('number'),
|
||||
additionalUnreadCount: Ember.computed('unreadCount', function() {
|
||||
return Math.max(0, this.get('unreadCount') - 1);
|
||||
}),
|
||||
|
||||
decodedContent: Ember.computed('content', function() {
|
||||
return JSON.parse(this.get('content'));
|
||||
}),
|
||||
|
||||
user: DS.belongsTo('user'),
|
||||
sender: DS.belongsTo('user'),
|
||||
subject: DS.belongsTo('subject', {polymorphic: true})
|
||||
});
|
Reference in New Issue
Block a user