overleaf/services/web/app/coffee/Features/Announcements/AnnouncementsController.coffee
Henry Oswald 5a13ee1077 use anlaytis api
- don’t talk to postgres
- show recent blog post announcments
- proxy all events to analytics api
2016-11-11 17:03:09 +00:00

21 lines
567 B
CoffeeScript

AnnouncementsHandler = require("./AnnouncementsHandler")
AuthenticationController = require("../Authentication/AuthenticationController")
logger = require("logger-sharelatex")
module.exports =
getUndreadAnnouncements: (req, res, next)->
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