mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 14:45:50 +02:00
This commit is contained in:
@@ -138,6 +138,8 @@ module.exports = function (Categories) {
|
||||
|
||||
if (sort === 'most_posts') {
|
||||
set = 'cid:' + cid + ':tids:posts';
|
||||
} else if (sort === 'most_votes') {
|
||||
set = 'cid:' + cid + ':tids:votes';
|
||||
}
|
||||
|
||||
if (data.targetUid) {
|
||||
@@ -163,7 +165,7 @@ module.exports = function (Categories) {
|
||||
|
||||
Categories.getSortedSetRangeDirection = function (sort, callback) {
|
||||
sort = sort || 'newest_to_oldest';
|
||||
var direction = sort === 'newest_to_oldest' || sort === 'most_posts' ? 'highest-to-lowest' : 'lowest-to-highest';
|
||||
var direction = sort === 'newest_to_oldest' || sort === 'most_posts' || sort === 'most_votes' ? 'highest-to-lowest' : 'lowest-to-highest';
|
||||
plugins.fireHook('filter:categories.getSortedSetRangeDirection', {
|
||||
sort: sort,
|
||||
direction: direction,
|
||||
|
||||
@@ -19,6 +19,7 @@ module.exports = function (app, middleware) {
|
||||
app.get('/topic/:topic_id.rss', middleware.maintenanceMode, generateForTopic);
|
||||
app.get('/category/:category_id.rss', middleware.maintenanceMode, generateForCategory);
|
||||
app.get('/recent.rss', middleware.maintenanceMode, generateForRecent);
|
||||
app.get('/top.rss', middleware.maintenanceMode, generateForTop);
|
||||
app.get('/popular.rss', middleware.maintenanceMode, generateForPopular);
|
||||
app.get('/popular/:term.rss', middleware.maintenanceMode, generateForPopular);
|
||||
app.get('/recentposts.rss', middleware.maintenanceMode, generateForRecentPosts);
|
||||
@@ -209,6 +210,34 @@ function generateForRecent(req, res, next) {
|
||||
], next);
|
||||
}
|
||||
|
||||
function generateForTop(req, res, next) {
|
||||
if (parseInt(meta.config['feeds:disableRSS'], 10) === 1) {
|
||||
return controllers404.send404(req, res);
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
if (req.query.token && req.query.uid) {
|
||||
db.getObjectField('user:' + req.query.uid, 'rss_token', next);
|
||||
} else {
|
||||
next(null, null);
|
||||
}
|
||||
},
|
||||
function (token, next) {
|
||||
next(null, token && token === req.query.token ? req.query.uid : req.uid);
|
||||
},
|
||||
function (uid, next) {
|
||||
generateForTopics({
|
||||
uid: uid,
|
||||
title: 'Top Voted Topics',
|
||||
description: 'A list of topics that have received the most votes',
|
||||
feed_url: '/top.rss',
|
||||
site_url: '/top',
|
||||
}, 'topics:votes', req, res, next);
|
||||
},
|
||||
], next);
|
||||
}
|
||||
|
||||
function generateForPopular(req, res, next) {
|
||||
if (parseInt(meta.config['feeds:disableRSS'], 10) === 1) {
|
||||
return controllers404.send404(req, res);
|
||||
|
||||
Reference in New Issue
Block a user