mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-31 19:15:58 +01:00
This commit is contained in:
@@ -69,9 +69,9 @@
|
|||||||
"nodebb-plugin-spam-be-gone": "0.5.1",
|
"nodebb-plugin-spam-be-gone": "0.5.1",
|
||||||
"nodebb-rewards-essentials": "0.0.9",
|
"nodebb-rewards-essentials": "0.0.9",
|
||||||
"nodebb-theme-lavender": "5.0.0",
|
"nodebb-theme-lavender": "5.0.0",
|
||||||
"nodebb-theme-persona": "7.2.5",
|
"nodebb-theme-persona": "7.2.6",
|
||||||
"nodebb-theme-slick": "1.1.2",
|
"nodebb-theme-slick": "1.1.2",
|
||||||
"nodebb-theme-vanilla": "8.1.2",
|
"nodebb-theme-vanilla": "8.1.3",
|
||||||
"nodebb-widget-essentials": "4.0.1",
|
"nodebb-widget-essentials": "4.0.1",
|
||||||
"nodemailer": "4.4.0",
|
"nodemailer": "4.4.0",
|
||||||
"passport": "^0.4.0",
|
"passport": "^0.4.0",
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
"topics": "Topics",
|
"topics": "Topics",
|
||||||
"posts": "Posts",
|
"posts": "Posts",
|
||||||
"best": "Best",
|
"best": "Best",
|
||||||
|
"votes": "Votes",
|
||||||
"upvoters": "Upvoters",
|
"upvoters": "Upvoters",
|
||||||
"upvoted": "Upvoted",
|
"upvoted": "Upvoted",
|
||||||
"downvoters": "Downvoters",
|
"downvoters": "Downvoters",
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ module.exports = function (Categories) {
|
|||||||
|
|
||||||
if (sort === 'most_posts') {
|
if (sort === 'most_posts') {
|
||||||
set = 'cid:' + cid + ':tids:posts';
|
set = 'cid:' + cid + ':tids:posts';
|
||||||
|
} else if (sort === 'most_votes') {
|
||||||
|
set = 'cid:' + cid + ':tids:votes';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.targetUid) {
|
if (data.targetUid) {
|
||||||
@@ -163,7 +165,7 @@ module.exports = function (Categories) {
|
|||||||
|
|
||||||
Categories.getSortedSetRangeDirection = function (sort, callback) {
|
Categories.getSortedSetRangeDirection = function (sort, callback) {
|
||||||
sort = sort || 'newest_to_oldest';
|
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', {
|
plugins.fireHook('filter:categories.getSortedSetRangeDirection', {
|
||||||
sort: sort,
|
sort: sort,
|
||||||
direction: direction,
|
direction: direction,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ module.exports = function (app, middleware) {
|
|||||||
app.get('/topic/:topic_id.rss', middleware.maintenanceMode, generateForTopic);
|
app.get('/topic/:topic_id.rss', middleware.maintenanceMode, generateForTopic);
|
||||||
app.get('/category/:category_id.rss', middleware.maintenanceMode, generateForCategory);
|
app.get('/category/:category_id.rss', middleware.maintenanceMode, generateForCategory);
|
||||||
app.get('/recent.rss', middleware.maintenanceMode, generateForRecent);
|
app.get('/recent.rss', middleware.maintenanceMode, generateForRecent);
|
||||||
|
app.get('/top.rss', middleware.maintenanceMode, generateForTop);
|
||||||
app.get('/popular.rss', middleware.maintenanceMode, generateForPopular);
|
app.get('/popular.rss', middleware.maintenanceMode, generateForPopular);
|
||||||
app.get('/popular/:term.rss', middleware.maintenanceMode, generateForPopular);
|
app.get('/popular/:term.rss', middleware.maintenanceMode, generateForPopular);
|
||||||
app.get('/recentposts.rss', middleware.maintenanceMode, generateForRecentPosts);
|
app.get('/recentposts.rss', middleware.maintenanceMode, generateForRecentPosts);
|
||||||
@@ -209,6 +210,34 @@ function generateForRecent(req, res, next) {
|
|||||||
], 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) {
|
function generateForPopular(req, res, next) {
|
||||||
if (parseInt(meta.config['feeds:disableRSS'], 10) === 1) {
|
if (parseInt(meta.config['feeds:disableRSS'], 10) === 1) {
|
||||||
return controllers404.send404(req, res);
|
return controllers404.send404(req, res);
|
||||||
|
|||||||
@@ -449,6 +449,15 @@ describe('Controllers', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should load recent rss feed', function (done) {
|
||||||
|
request(nconf.get('url') + '/top.rss', function (err, res, body) {
|
||||||
|
assert.ifError(err);
|
||||||
|
assert.equal(res.statusCode, 200);
|
||||||
|
assert(body);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should load popular rss feed', function (done) {
|
it('should load popular rss feed', function (done) {
|
||||||
request(nconf.get('url') + '/popular.rss', function (err, res, body) {
|
request(nconf.get('url') + '/popular.rss', function (err, res, body) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ describe('feeds', function () {
|
|||||||
nconf.get('url') + '/topic/' + tid + '.rss',
|
nconf.get('url') + '/topic/' + tid + '.rss',
|
||||||
nconf.get('url') + '/category/' + cid + '.rss',
|
nconf.get('url') + '/category/' + cid + '.rss',
|
||||||
nconf.get('url') + '/recent.rss',
|
nconf.get('url') + '/recent.rss',
|
||||||
|
nconf.get('url') + '/top.rss',
|
||||||
nconf.get('url') + '/popular.rss',
|
nconf.get('url') + '/popular.rss',
|
||||||
nconf.get('url') + '/popular/day.rss',
|
nconf.get('url') + '/popular/day.rss',
|
||||||
nconf.get('url') + '/recentposts.rss',
|
nconf.get('url') + '/recentposts.rss',
|
||||||
|
|||||||
Reference in New Issue
Block a user