zahmis 4 лет назад
Родитель
Сommit
d71b1c53c8
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      packages/app/src/server/routes/apiv3/slack-integration.js

+ 3 - 2
packages/app/src/server/routes/apiv3/slack-integration.js

@@ -54,7 +54,7 @@ module.exports = (crowi) => {
     return { permissionsForBroadcastUseCommands, permissionsForSingleUseCommands };
   }
 
-
+  // REFACTORIMG THIS MIDDLEWARE GW-7441
   async function checkCommandsPermission(req, res, next) {
     if (req.body.text == null) return next(); // when /relation-test
     const tokenPtoG = req.headers['x-growi-ptog-tokens'];
@@ -74,9 +74,10 @@ module.exports = (crowi) => {
     const isPermitted = checkPermission(commandPermission, growiCommand.growiCommandType, fromChannel);
     if (isPermitted) return next();
 
-    return res.send(`It is not allowed to run '${growiCommand.growiCommandType}' command to this GROWI.`).status(403);
+    return res.status(403).send(`It is not allowed to run '${growiCommand.growiCommandType}' command to this GROWI.`);
   }
 
+  // REFACTORIMG THIS MIDDLEWARE GW-7441
   async function checkInteractionsPermission(req, res, next) {
     const payload = JSON.parse(req.body.payload);
     if (payload == null) return next(); // when /relation-test