1
0
mirror of https://github.com/flarum/core.git synced 2025-02-24 11:13:40 +01:00

Fix up Notification model

This commit is contained in:
Toby Zerner 2018-08-24 21:47:57 +09:30
parent 9792576464
commit 72d46bc461

View File

@ -1,17 +1,13 @@
import Model from '../Model';
import computed from '../utils/computed';
export default class Notification extends Model {}
Object.assign(Notification.prototype, {
contentType: Model.attribute('contentType'),
subjectId: Model.attribute('subjectId'),
content: Model.attribute('content'),
time: Model.attribute('time', Model.date),
createdAt: Model.attribute('createdAt', Model.transformDate),
isRead: Model.attribute('isRead'),
unreadCount: Model.attribute('unreadCount'),
additionalUnreadCount: computed('unreadCount', unreadCount => Math.max(0, unreadCount - 1)),
user: Model.hasOne('user'),
fromUser: Model.hasOne('fromUser'),