recent style

v1.18.x
barisusakli 9 years ago
parent 8220567b5b
commit 1c29722ac4

@ -1,11 +1,12 @@
'use strict'; 'use strict';
var nconf = require('nconf'), var nconf = require('nconf');
topics = require('../topics'), var async = require('async');
meta = require('../meta'), var topics = require('../topics');
helpers = require('./helpers'), var meta = require('../meta');
plugins = require('../plugins'); var helpers = require('./helpers');
var plugins = require('../plugins');
var recentController = {}; var recentController = {};
@ -13,24 +14,25 @@ recentController.get = function(req, res, next) {
var stop = (parseInt(meta.config.topicsPerList, 10) || 20) - 1; var stop = (parseInt(meta.config.topicsPerList, 10) || 20) - 1;
topics.getTopicsFromSet('topics:recent', req.uid, 0, stop, function(err, data) { async.waterfall([
function (next) {
topics.getTopicsFromSet('topics:recent', req.uid, 0, stop, next);
},
function (data, next) {
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data.rssFeedUrl = nconf.get('relative_path') + '/recent.rss';
data.title = '[[pages:recent]]';
if (req.path.startsWith('/api/recent') || req.path.startsWith('/recent')) {
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[recent:title]]'}]);
}
plugins.fireHook('filter:recent.build', {req: req, res: res, templateData: data}, next);
}
], function(err, data) {
if (err) { if (err) {
return next(err); return next(err);
} }
res.render('recent', data.templateData);
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data.rssFeedUrl = nconf.get('relative_path') + '/recent.rss';
data.title = '[[pages:recent]]';
if (req.path.startsWith('/api/recent') || req.path.startsWith('/recent')) {
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[recent:title]]'}]);
}
plugins.fireHook('filter:recent.build', {req: req, res: res, templateData: data}, function(err, data) {
if (err) {
return next(err);
}
res.render('recent', data.templateData);
});
}); });
}; };

Loading…
Cancel
Save