zahmis 4 年 前
コミット
f15849d1fe

+ 2 - 5
packages/slack/src/utils/check-communicable.ts

@@ -39,6 +39,7 @@ const testSlackApiServer = async(client: WebClient): Promise<void> => {
   if (!result.ok) {
   if (!result.ok) {
     throw new Error(result.error);
     throw new Error(result.error);
   }
   }
+  console.log(result);
 };
 };
 
 
 /**
 /**
@@ -94,14 +95,10 @@ export const getConnectionStatuses = async(tokens: string[]): Promise<{[key: str
  * @param token bot OAuth token
  * @param token bot OAuth token
  * @returns
  * @returns
  */
  */
-export const testToSlack = async(token:string, channel:string): Promise<void> => {
+export const testToSlack = async(token:string): Promise<void> => {
   const client = generateWebClient(token);
   const client = generateWebClient(token);
   try {
   try {
     await testSlackApiServer(client);
     await testSlackApiServer(client);
-    await client.chat.postMessage({
-      channel,
-      text: 'Your test was successful!',
-    });
   }
   }
   catch (error) {
   catch (error) {
     console.log(error);
     console.log(error);

+ 3 - 3
packages/slackbot-proxy/src/controllers/growi-to-slack.ts

@@ -5,7 +5,7 @@ import axios from 'axios';
 
 
 import { WebAPICallResult } from '@slack/web-api';
 import { WebAPICallResult } from '@slack/web-api';
 
 
-import { verifyGrowiToSlackRequest, getConnectionStatuses, relationTestToSlack } from '@growi/slack';
+import { verifyGrowiToSlackRequest, getConnectionStatuses, testToSlack } from '@growi/slack';
 
 
 import { GrowiReq } from '~/interfaces/growi-to-slack/growi-req';
 import { GrowiReq } from '~/interfaces/growi-to-slack/growi-req';
 import { InstallationRepository } from '~/repositories/installation';
 import { InstallationRepository } from '~/repositories/installation';
@@ -84,7 +84,7 @@ export class GrowiToSlackCtrl {
         return res.status(400).send({ message: 'installation is invalid' });
         return res.status(400).send({ message: 'installation is invalid' });
       }
       }
 
 
-      await relationTestToSlack(token);
+      await testToSlack(token);
       return res.send({ relation });
       return res.send({ relation });
     }
     }
 
 
@@ -119,7 +119,7 @@ export class GrowiToSlackCtrl {
       return res.status(400).send({ message: 'installation is invalid' });
       return res.status(400).send({ message: 'installation is invalid' });
     }
     }
 
 
-    await relationTestToSlack(token);
+    await testToSlack(token);
 
 
     logger.debug('relation test is success', order);
     logger.debug('relation test is success', order);
 
 

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

@@ -508,7 +508,7 @@ module.exports = (crowi) => {
     const { channel } = req.body;
     const { channel } = req.body;
     const slackBotToken = crowi.configManager.getConfig('crowi', 'slackbot:token');
     const slackBotToken = crowi.configManager.getConfig('crowi', 'slackbot:token');
     try {
     try {
-      const res = await testToSlack(slackBotToken, channel);
+      const res = await testToSlack(slackBotToken);
       console.log(res);
       console.log(res);
     }
     }
     catch (error) {
     catch (error) {