Răsfoiți Sursa

separate requestParams if a proxy exist or not

kaori 5 ani în urmă
părinte
comite
02f70f79e8
1 a modificat fișierele cu 9 adăugiri și 5 ștergeri
  1. 9 5
      src/server/routes/apiv3/slack-integration-settings.js

+ 9 - 5
src/server/routes/apiv3/slack-integration-settings.js

@@ -180,11 +180,15 @@ module.exports = (crowi) => {
   router.put('/bot-type',
     accessTokenParser, loginRequiredStrictly, adminRequired, csrf, validator.CustomBotWithoutProxy, apiV3FormValidator, async(req, res) => {
       const { slackSigningSecret, slackBotToken, currentBotType } = req.body;
-      const requestParams = {
-        'slackbot:signingSecret': slackSigningSecret,
-        'slackbot:token': slackBotToken,
-        'slackbot:currentBotType': currentBotType,
-      };
+
+      const requestParams = { 'slackbot:currentBotType': currentBotType };
+      if (currentBotType === 'customBotWithoutProxy') {
+        requestParams['slackbot:signingSecret'] = slackSigningSecret;
+        requestParams['slackbot:token'] = slackBotToken;
+      }
+
+      console.log('requestParams', requestParams);
+
       try {
         await updateSlackBotSettings(requestParams);
         crowi.slackBotService.publishUpdatedMessage();