mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
24 lines
656 B
CoffeeScript
24 lines
656 B
CoffeeScript
AnnouncementsHandler = require("./AnnouncementsHandler")
|
|
AuthenticationController = require("../Authentication/AuthenticationController")
|
|
logger = require("logger-sharelatex")
|
|
|
|
|
|
module.exports =
|
|
|
|
getUndreadAnnouncements: (req, res, next)->
|
|
if !settings?.apis?.analytics?.url? or !settings.apis.blog.url?
|
|
return res.json []
|
|
|
|
user_id = AuthenticationController.getLoggedInUserId(req)
|
|
logger.log {user_id}, "getting unread announcements"
|
|
AnnouncementsHandler.getUnreadAnnouncements user_id, (err, announcements)->
|
|
if err?
|
|
logger.err {err, user_id}, "unable to get unread announcements"
|
|
next(err)
|
|
else
|
|
res.json announcements
|
|
|
|
|
|
|
|
|
|
|