hakumizuki 4 лет назад
Родитель
Сommit
750549c3cd

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

@@ -61,7 +61,7 @@ module.exports = (crowi) => {
       payload = JSON.parse(req.body.payload);
     }
 
-    if (req.body.text == null) { // when /relation-test
+    if (req.body.text == null && !payload) { // when /relation-test
       return next();
     }
 
@@ -83,7 +83,10 @@ module.exports = (crowi) => {
     });
 
     // validate
-    if (!supportedCommands.includes(command) || isActionSupported) {
+    if (command && !supportedCommands.includes(command)) {
+      return res.status(403).send(`It is not allowed to run '${command}' command to this GROWI.`);
+    }
+    if ((actionId || callbackId) && !isActionSupported) {
       return res.status(403).send(`It is not allowed to run '${command}' command to this GROWI.`);
     }
 

+ 1 - 1
packages/app/src/server/service/slack-command-handler/search.js

@@ -343,7 +343,7 @@ module.exports = (crowi) => {
           markdownSectionBlock('*Input keywords.*\n Hint\n `/growi search [keyword]`'),
         ],
       });
-      return;
+      return { pages: [] };
     }
 
     const keywords = this.getKeywords(args);

+ 1 - 1
packages/slack/src/utils/get-supported-growi-actions-regexps.ts

@@ -1,3 +1,3 @@
 export const getSupportedGrowiActionsRegExps = (supportedGrowiCommands: string[]): RegExp[] => {
-  return supportedGrowiCommands.map(command => new RegExp(`^${command}:`));
+  return supportedGrowiCommands.map(command => new RegExp(`^${command}:\\w+`));
 };