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

+ 4 - 5
packages/slackbot-proxy/src/middlewares/slack-to-growi/checkCommandPermission.ts

@@ -64,13 +64,13 @@ export class checkCommandPermissionMiddleware implements IMiddleware {
     }
     // Send response immediately to avoid opelation_timeout error
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
-    res.send();
+    // res.send();
 
     const baseDate = new Date();
-
+    let isSupported;
     // const relationsForSingleUse:RelationMock[] = [];
     await Promise.all(relations.map(async(relation) => {
-      const isSupported = await this.relationsService.isSupportedGrowiCommandForSingleUse(relation, growiCommand.growiCommandType, baseDate);
+      isSupported = await this.relationsService.isSupportedGrowiCommandForSingleUse(relation, growiCommand.growiCommandType, baseDate);
       if (isSupported) {
         console.log(75);
         return next();
@@ -79,9 +79,8 @@ export class checkCommandPermissionMiddleware implements IMiddleware {
 
     // const relationsForBroadcastUse:RelationMock[] = [];
     await Promise.all(relations.map(async(relation) => {
-      const isSupported = await this.relationsService.isSupportedGrowiCommandForBroadcastUse(relation, growiCommand.growiCommandType, baseDate);
+      isSupported = await this.relationsService.isSupportedGrowiCommandForBroadcastUse(relation, growiCommand.growiCommandType, baseDate);
       if (isSupported) {
-        console.log(85);
         return next();
       }
     }));

+ 2 - 1
packages/slackbot-proxy/src/services/SelectGrowiService.ts

@@ -26,7 +26,8 @@ export class SelectGrowiService implements GrowiCommandProcessor {
   @Inject()
   relationMockRepository: RelationMockRepository;
 
-  async process(growiCommand: GrowiCommand, authorizeResult: AuthorizeResult, body: {[key:string]:string } & {growiUrisForSingleUse:string[]}): Promise<void> {
+  // eslint-disable-next-line max-len
+  async process(growiCommand: GrowiCommand | string, authorizeResult: AuthorizeResult, body: {[key:string]:string } & {growiUrisForSingleUse:string[]}): Promise<void> {
     const { botToken } = authorizeResult;
 
     if (botToken == null) {