mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
19 lines
785 B
CoffeeScript
19 lines
785 B
CoffeeScript
NotificationsHandler = require("./NotificationsHandler")
|
|
logger = require("logger-sharelatex")
|
|
_ = require("underscore")
|
|
|
|
module.exports =
|
|
|
|
getAllUnreadNotifications: (req, res)->
|
|
NotificationsHandler.getUserNotifications req.session.user._id, (err, unreadNotifications)->
|
|
unreadNotifications = _.map unreadNotifications, (notification)->
|
|
notification.html = req.i18n.translate(notification.templateKey, notification.messageOpts)
|
|
return notification
|
|
res.send(unreadNotifications)
|
|
|
|
markNotificationAsRead: (req, res)->
|
|
user_id = req.session.user._id
|
|
notification_id = req.params.notification_id
|
|
NotificationsHandler.markAsRead user_id, notification_id, ->
|
|
res.send()
|
|
logger.log user_id:user_id, notification_id:notification_id, "mark notification as read"
|