stop the /announcements call at controller level

This commit is contained in:
Henry Oswald 2016-11-11 17:15:36 +00:00
parent 5a13ee1077
commit 666bfdf967
2 changed files with 3 additions and 3 deletions

View file

@ -6,6 +6,9 @@ logger = require("logger-sharelatex")
module.exports = module.exports =
getUndreadAnnouncements: (req, res, next)-> getUndreadAnnouncements: (req, res, next)->
if !settings?.apis?.analytics?.url? or !settings.apis.blog.url?
return res.json []
user_id = AuthenticationController.getLoggedInUserId(req) user_id = AuthenticationController.getLoggedInUserId(req)
logger.log {user_id}, "getting unread announcements" logger.log {user_id}, "getting unread announcements"
AnnouncementsHandler.getUnreadAnnouncements user_id, (err, announcements)-> AnnouncementsHandler.getUnreadAnnouncements user_id, (err, announcements)->

View file

@ -8,9 +8,6 @@ settings = require("settings-sharelatex")
module.exports = module.exports =
getUnreadAnnouncements : (user_id, callback = (err, announcements)->)-> getUnreadAnnouncements : (user_id, callback = (err, announcements)->)->
if !settings?.apis?.analytics?.url? or !settings.apis.blog.url?
return callback null, []
async.parallel { async.parallel {
lastEvent: (cb)-> lastEvent: (cb)->
AnalyticsManager.getLastOccurance user_id, "announcement-alert-dismissed", cb AnalyticsManager.getLastOccurance user_id, "announcement-alert-dismissed", cb