Skip to content

Node.js based forum software built for the modern web

refactor: single return

Barış Soner Uşaklı80d6a1650cf7
diff --git a/src/controllers/posts.js b/src/controllers/posts.js
index d29b17fdec..b452222ec5 100644
--- a/src/controllers/posts.js
+++ b/src/controllers/posts.js
@@ -35,10 +35,7 @@ postsController.redirectToPost = async function (req, res, next) {
privileges.posts.can('topics:read', pid, req.uid),
posts.generatePostPath(pid, req.uid),
]);
- if (!path) {
- return next();
- }
- if (!canRead) {
+ if (!path || !canRead) {
return next();
}