zahmis 4 лет назад
Родитель
Сommit
1700b970e8

+ 1 - 14
packages/slackbot-proxy/src/controllers/slack.ts

@@ -7,7 +7,7 @@ import axios from 'axios';
 import { WebAPICallResult } from '@slack/web-api';
 
 import {
-  markdownSectionBlock, GrowiCommand, parseSlashCommand, postEphemeralErrors, verifySlackRequest, generateWebClient,
+  markdownSectionBlock, GrowiCommand, parseSlashCommand, postEphemeralErrors, verifySlackRequest,
 } from '@growi/slack';
 
 // import { Relation } from '~/entities/relation';
@@ -106,8 +106,6 @@ export class SlackCtrl {
   @UseBefore(AddSigningSecretToReq, verifySlackRequest, AuthorizeCommandMiddleware, checkCommandPermissionMiddleware)
   async handleCommand(@Req() req: SlackOauthReq, @Res() res: Res): Promise<void|string|Res|WebAPICallResult> {
     const { body, authorizeResult } = req;
-    console.log(109);
-
 
     if (body.text == null) {
       return 'No text.';
@@ -188,23 +186,12 @@ export class SlackCtrl {
 
 
     if (relationsForSingleUse.length > 0) {
-      console.log(185);
-
       body.growiUrisForSingleUse = relationsForSingleUse.map(v => v.growiUri);
-      console.log(growiCommand);
-      console.log(authorizeResult);
-      console.log(body);
-
-
       return this.selectGrowiService.process(growiCommand, authorizeResult, body);
     }
 
-    console.log(189);
-
     const relationsForBroadcastUse:RelationMock[] = [];
     await Promise.all(relations.map(async(relation) => {
-      console.log(relations, 198);
-
       relationsForBroadcastUse.push(relation);
     }));
 

+ 0 - 15
packages/slackbot-proxy/src/middlewares/slack-to-growi/checkCommandPermission.ts

@@ -92,10 +92,8 @@ export class checkCommandPermissionMiddleware implements IMiddleware {
       return this.relationsService.isSupportedGrowiCommandForSingleUse(relation, command, baseDate);
 
     }));
-    console.log(isSupportedSingle);
 
     if (isSupportedSingle.includes(true)) {
-      console.log(99);
       return next();
     }
 
@@ -118,34 +116,21 @@ export class checkCommandPermissionMiddleware implements IMiddleware {
     const permittedChannels = channelsObject?.[targetCommand!];
 
     let fromChannel:string;
-    console.log(117);
-    console.log(payload);
-
     if (body.channel_name != null) { // commands, payload is undefined
-      console.log(118);
-
       fromChannel = body.channel_name;
     }
     else if (payload.actions != null) { // search
-      console.log(payload.actions);
-      console.log(payload, 131);
       fromChannel = payload.channel.name;
     }
     else {
       const privateMeta = JSON.parse(payload.view.private_metadata);
       if (privateMeta.body != null) { // create first interactions
-        console.log(136);
-
         fromChannel = privateMeta.body.channel_name;
       }
       else { // second interactions
         fromChannel = privateMeta.channelName;
       }
-      console.log(privateMeta, 136);
-      console.log(fromChannel);
 
-      // fromChannel = payload.channel.name;
-      // console.log(128);
     }
 
     const isPermittedChannel = permittedChannels?.includes(fromChannel);