Node.js based forum software built for the modern web
closes #6013
Barış Soner Uşaklıd5d6748c71bf
diff --git a/package.json b/package.jsonindex e589e41c2c..71db61c87d 100644--- a/package.json+++ b/package.json@@ -67,9 +67,9 @@"nodebb-plugin-spam-be-gone": "0.5.1","nodebb-rewards-essentials": "0.0.9","nodebb-theme-lavender": "4.1.1",- "nodebb-theme-persona": "6.1.5",+ "nodebb-theme-persona": "6.1.6","nodebb-theme-slick": "1.1.1",- "nodebb-theme-vanilla": "7.1.3",+ "nodebb-theme-vanilla": "7.1.4","nodebb-widget-essentials": "3.0.7","nodemailer": "4.3.0","passport": "^0.4.0",diff --git a/public/language/en-GB/pages.json b/public/language/en-GB/pages.jsonindex 9ffc04c321..c89266b661 100644--- a/public/language/en-GB/pages.json+++ b/public/language/en-GB/pages.json@@ -50,6 +50,7 @@"account/bookmarks": "%1's Bookmarked Posts","account/settings": "User Settings","account/watched": "Topics watched by %1",+ "account/ignored": "Topics ignored by %1","account/upvoted": "Posts upvoted by %1","account/downvoted": "Posts downvoted by %1","account/best": "Best posts made by %1",diff --git a/public/language/en-GB/user.json b/public/language/en-GB/user.jsonindex ba61113160..3916663282 100644--- a/public/language/en-GB/user.json+++ b/public/language/en-GB/user.json@@ -27,6 +27,7 @@"reputation": "Reputation","bookmarks":"Bookmarks","watched": "Watched",+ "ignored": "Ignored","followers": "Followers","following": "Following","aboutme": "About me",@@ -92,6 +93,7 @@"has_no_posts": "This user hasn't posted anything yet.","has_no_topics": "This user hasn't posted any topics yet.","has_no_watched_topics": "This user hasn't watched any topics yet.",+ "has_no_ignored_topics": "This user hasn't ignored any topics yet.","has_no_upvoted_posts": "This user hasn't upvoted any posts yet.","has_no_downvoted_posts": "This user hasn't downvoted any posts yet.","has_no_voted_posts": "This user has no voted posts",diff --git a/src/controllers/accounts/posts.js b/src/controllers/accounts/posts.jsindex 2f603b8015..87b9cead9d 100644--- a/src/controllers/accounts/posts.js+++ b/src/controllers/accounts/posts.js@@ -11,7 +11,7 @@ var pagination = require('../../pagination');var helpers = require('../helpers');var accountHelpers = require('./helpers');-var postsController = {};+var postsController = module.exports;var templateToData = {'account/bookmarks': {@@ -50,6 +50,12 @@ var templateToData = {noItemsFoundKey: '[[user:has_no_watched_topics]]',crumb: '[[user:watched]]',},+ 'account/ignored': {+ set: 'ignored_tids',+ type: 'topics',+ noItemsFoundKey: '[[user:has_no_ignored_topics]]',+ crumb: '[[user:ignored]]',+ },'account/topics': {set: 'topics',type: 'topics',@@ -82,6 +88,10 @@ postsController.getWatchedTopics = function (req, res, next) {getFromUserSet('account/watched', req, res, next);};+postsController.getIgnoredTopics = function (req, res, next) {+ getFromUserSet('account/ignored', req, res, next);+};+postsController.getTopics = function (req, res, next) {getFromUserSet('account/topics', req, res, next);};@@ -93,6 +103,7 @@ function getFromUserSet(template, req, res, callback) {var userData;var itemsPerPage;var page = Math.max(1, parseInt(req.query.page, 10) || 1);+async.waterfall([function (next) {async.parallel({@@ -130,23 +141,20 @@ function getFromUserSet(template, req, res, callback) {},}, next);},- ], function (err, results) {- if (err) {- return callback(err);- }-- userData[data.type] = results.data[data.type];- userData.nextStart = results.data.nextStart;+ function (results) {+ userData[data.type] = results.data[data.type];+ userData.nextStart = results.data.nextStart;- var pageCount = Math.ceil(results.itemCount / itemsPerPage);- userData.pagination = pagination.create(page, pageCount);+ var pageCount = Math.ceil(results.itemCount / itemsPerPage);+ userData.pagination = pagination.create(page, pageCount);- userData.noItemsFoundKey = data.noItemsFoundKey;- userData.title = '[[pages:' + data.template + ', ' + userData.username + ']]';- userData.breadcrumbs = helpers.buildBreadcrumbs([{ text: userData.username, url: '/user/' + userData.userslug }, { text: data.crumb }]);+ userData.noItemsFoundKey = data.noItemsFoundKey;+ userData.title = '[[pages:' + data.template + ', ' + userData.username + ']]';+ userData.breadcrumbs = helpers.buildBreadcrumbs([{ text: userData.username, url: '/user/' + userData.userslug }, { text: data.crumb }]);- res.render(data.template, userData);- });+ res.render(data.template, userData);+ },+ ], callback);}module.exports = postsController;diff --git a/src/routes/accounts.js b/src/routes/accounts.jsindex a462399b40..336a38e442 100644--- a/src/routes/accounts.js+++ b/src/routes/accounts.js@@ -19,6 +19,7 @@ module.exports = function (app, middleware, controllers) {setupPageRoute(app, '/user/:userslug/bookmarks', middleware, accountMiddlewares, controllers.accounts.posts.getBookmarks);setupPageRoute(app, '/user/:userslug/watched', middleware, accountMiddlewares, controllers.accounts.posts.getWatchedTopics);+ setupPageRoute(app, '/user/:userslug/ignored', middleware, accountMiddlewares, controllers.accounts.posts.getIgnoredTopics);setupPageRoute(app, '/user/:userslug/upvoted', middleware, accountMiddlewares, controllers.accounts.posts.getUpVotedPosts);setupPageRoute(app, '/user/:userslug/downvoted', middleware, accountMiddlewares, controllers.accounts.posts.getDownVotedPosts);setupPageRoute(app, '/user/:userslug/edit', middleware, accountMiddlewares, controllers.accounts.edit.get);diff --git a/test/controllers.js b/test/controllers.jsindex c4c46ac38d..a088543672 100644--- a/test/controllers.js+++ b/test/controllers.js@@ -945,6 +945,15 @@ describe('Controllers', function () {});});+ it('should load /user/foo/ignored', function (done) {+ request(nconf.get('url') + '/api/user/foo/ignored', { jar: jar }, function (err, res, body) {+ assert.ifError(err);+ assert.equal(res.statusCode, 200);+ assert(body);+ done();+ });+ });+it('should load /user/foo/topics', function (done) {request(nconf.get('url') + '/api/user/foo/topics', function (err, res, body) {assert.ifError(err);