zahmis il y a 4 ans
Parent
commit
d71b1c53c8
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  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 };
     return { permissionsForBroadcastUseCommands, permissionsForSingleUseCommands };
   }
   }
 
 
-
+  // REFACTORIMG THIS MIDDLEWARE GW-7441
   async function checkCommandsPermission(req, res, next) {
   async function checkCommandsPermission(req, res, next) {
     if (req.body.text == null) return next(); // when /relation-test
     if (req.body.text == null) return next(); // when /relation-test
     const tokenPtoG = req.headers['x-growi-ptog-tokens'];
     const tokenPtoG = req.headers['x-growi-ptog-tokens'];
@@ -74,9 +74,10 @@ module.exports = (crowi) => {
     const isPermitted = checkPermission(commandPermission, growiCommand.growiCommandType, fromChannel);
     const isPermitted = checkPermission(commandPermission, growiCommand.growiCommandType, fromChannel);
     if (isPermitted) return next();
     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) {
   async function checkInteractionsPermission(req, res, next) {
     const payload = JSON.parse(req.body.payload);
     const payload = JSON.parse(req.body.payload);
     if (payload == null) return next(); // when /relation-test
     if (payload == null) return next(); // when /relation-test