diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a26d415c49..11911cd409 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -15,7 +15,7 @@ If you are writing contributions as part of employment from another company / in # Having problems installing NodeBB? -Chances are somebody has run into this problem before. After consulting our [documentation](https://docs.nodebb.org/en/latest/installing/os.html), please head over to our [community support forum](https://community.nodebb.org) for advice. +Chances are somebody has run into this problem before. After consulting our [documentation](https://docs.nodebb.org/installing/os/), please head over to our [community support forum](https://community.nodebb.org) for advice. # Found a Security Vulnerability? diff --git a/nodebb b/nodebb index b40409cddb..c0edb6e39c 100755 --- a/nodebb +++ b/nodebb @@ -40,7 +40,7 @@ try { process.stdout.write( '\x1b[31mNodeBB could not be initialised because there was an error while loading dependencies.\n' + 'Please run "\x1b[33mnpm install --production\x1b[31m" and try again.\x1b[0m\n\n' + - 'For more information, please see: https://docs.nodebb.org/en/latest/installing/os.html\n\n' + 'For more information, please see: https://docs.nodebb.org/installing/os/\n\n' ); throw e; diff --git a/src/controllers/posts.js b/src/controllers/posts.js index 8afb3f5729..4f906fb0ba 100644 --- a/src/controllers/posts.js +++ b/src/controllers/posts.js @@ -3,6 +3,7 @@ var async = require('async'); var posts = require('../posts'); +var privileges = require('../privileges'); var helpers = require('./helpers'); var postsController = module.exports; @@ -15,13 +16,23 @@ postsController.redirectToPost = function (req, res, next) { async.waterfall([ function (next) { - posts.generatePostPath(pid, req.uid, next); + async.parallel({ + canRead: function (next) { + privileges.posts.can('read', pid, req.uid, next); + }, + path: function (next) { + posts.generatePostPath(pid, req.uid, next); + }, + }, next); }, - function (path, next) { - if (!path) { + function (results, next) { + if (!results.canRead) { + return helpers.notAllowed(req, res); + } + if (!results.path) { return next(); } - helpers.redirect(res, path); + helpers.redirect(res, results.path); }, ], next); }; diff --git a/src/groups/membership.js b/src/groups/membership.js index 8ffd845443..4d4a1f2887 100644 --- a/src/groups/membership.js +++ b/src/groups/membership.js @@ -251,6 +251,9 @@ module.exports = function (Groups) { next(); } }, + function (next) { + clearGroupTitleIfSet(groupName, uid, next); + }, function (next) { plugins.fireHook('action:group.leave', { groupName: groupName, @@ -261,6 +264,24 @@ module.exports = function (Groups) { ], callback); }; + function clearGroupTitleIfSet(groupName, uid, callback) { + if (groupName === 'registered-users' || Groups.isPrivilegeGroup(groupName)) { + return callback(); + } + async.waterfall([ + function (next) { + db.getObjectField('user:' + uid, 'groupTitle', next); + }, + function (groupTitle, next) { + if (groupTitle === groupName) { + db.deleteObjectField('user:' + uid, 'groupTitle', next); + } else { + next(); + } + }, + ], callback); + } + Groups.leaveAllGroups = function (uid, callback) { async.waterfall([ function (next) { diff --git a/src/views/admin/partials/groups/memberlist.tpl b/src/views/admin/partials/groups/memberlist.tpl index 23ce3e1dae..0b20231739 100644 --- a/src/views/admin/partials/groups/memberlist.tpl +++ b/src/views/admin/partials/groups/memberlist.tpl @@ -5,7 +5,7 @@
@@ -32,6 +32,6 @@ |