Sfoglia il codice sorgente

add sendSuccessMessage

zahmis 4 anni fa
parent
commit
0d942d3019

+ 8 - 0
packages/slack/src/utils/check-communicable.ts

@@ -111,3 +111,11 @@ export const testToSlack = async(token:string): Promise<void> => {
   const res = await testSlackApiServer(client);
   const res = await testSlackApiServer(client);
   await checkSlackScopes(res);
   await checkSlackScopes(res);
 };
 };
+
+export const sendSuccessMessage = async(token:string, channel:string, appSiteUrl:string): Promise<void> => {
+  const client = generateWebClient(token);
+  await client.chat.postMessage({
+    channel,
+    text: `Successfully tested with ${appSiteUrl}.`,
+  });
+};

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

@@ -502,6 +502,8 @@ module.exports = (crowi) => {
    */
    */
   router.post('/without-proxy/test', loginRequiredStrictly, adminRequired, csrf, validator.SlackChannel, apiV3FormValidator, async(req, res) => {
   router.post('/without-proxy/test', loginRequiredStrictly, adminRequired, csrf, validator.SlackChannel, apiV3FormValidator, async(req, res) => {
     const currentBotType = crowi.configManager.getConfig('crowi', 'slackbot:currentBotType');
     const currentBotType = crowi.configManager.getConfig('crowi', 'slackbot:currentBotType');
+    // const appSiteURL = crowi.configManager.getConfig('crowi', 'app:siteUrl');
+
     if (currentBotType !== 'customBotWithoutProxy') {
     if (currentBotType !== 'customBotWithoutProxy') {
       const msg = 'Select Without Proxy Type';
       const msg = 'Select Without Proxy Type';
       return res.apiv3Err(new ErrorV3(msg, 'select-not-proxy-type'), 400);
       return res.apiv3Err(new ErrorV3(msg, 'select-not-proxy-type'), 400);