Преглед изворни кода

If the portal page exists, redirect from the page

Sotaro KARASAWA пре 10 година
родитељ
комит
b58bb9b784
1 измењених фајлова са 9 додато и 2 уклоњено
  1. 9 2
      lib/routes/page.js

+ 9 - 2
lib/routes/page.js

@@ -200,8 +200,15 @@ module.exports = function(crowi, app) {
         return res.redirect('/');
       }
 
-      debug('Catch pageShow', err);
-      return renderPage(null, req, res);
+      Page.hasPortalPage(path + '/', req.user)
+      .then(function(page) {
+        if (page) {
+          return res.redirect(path + '/');
+        } else {
+          debug('Catch pageShow', err);
+          return renderPage(null, req, res);
+        }
+      });
     });
   };