all files / src/controllers/ recent.js

41.18% Statements 7/17
0% Branches 0/8
0% Functions 0/2
41.18% Lines 7/17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                                                 
 
'use strict';
 
var nconf = require('nconf');
 
var topics = require('../topics');
var meta = require('../meta');
var helpers = require('./helpers');
 
var recentController = {};
 
recentController.get = function(req, res, next) {
 
	var stop = (parseInt(meta.config.topicsPerList, 10) || 20) - 1;
 
	topics.getTopicsFromSet('topics:recent', req.uid, 0, stop, function(err, data) {
		if (err) {
			return next(err);
		}
 
		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]]'}]);
		}
 
		res.render('recent', data);
	});
};
 
module.exports = recentController;