itizawa 4 سال پیش
والد
کامیت
f400e34b37
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 4 0
      packages/slackbot-proxy/src/controllers/slack.ts
  2. 1 4
      packages/slackbot-proxy/src/services/UnregisterService.ts

+ 4 - 0
packages/slackbot-proxy/src/controllers/slack.ts

@@ -89,6 +89,10 @@ export class SlackCtrl {
 
 
     // unregister
     // unregister
     if (growiCommand.growiCommandType === 'unregister') {
     if (growiCommand.growiCommandType === 'unregister') {
+      if (growiCommand.growiCommandArgs.length === 0) {
+        return 'GROWI Urls is required.';
+      }
+
       // Send response immediately to avoid opelation_timeout error
       // Send response immediately to avoid opelation_timeout error
       // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
       // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
       res.send();
       res.send();

+ 1 - 4
packages/slackbot-proxy/src/services/UnregisterService.ts

@@ -1,11 +1,10 @@
 import { Service } from '@tsed/di';
 import { Service } from '@tsed/di';
 import { WebClient, LogLevel } from '@slack/web-api';
 import { WebClient, LogLevel } from '@slack/web-api';
-import { generateInputSectionBlock, GrowiCommand, generateMarkdownSectionBlock } from '@growi/slack';
+import { GrowiCommand, generateMarkdownSectionBlock } from '@growi/slack';
 import { AuthorizeResult } from '@slack/oauth';
 import { AuthorizeResult } from '@slack/oauth';
 import { GrowiCommandProcessor } from '~/interfaces/slack-to-growi/growi-command-processor';
 import { GrowiCommandProcessor } from '~/interfaces/slack-to-growi/growi-command-processor';
 import { RelationRepository } from '~/repositories/relation';
 import { RelationRepository } from '~/repositories/relation';
 import { Installation } from '~/entities/installation';
 import { Installation } from '~/entities/installation';
-import { Relation } from '~/entities/relation';
 
 
 const isProduction = process.env.NODE_ENV === 'production';
 const isProduction = process.env.NODE_ENV === 'production';
 
 
@@ -45,8 +44,6 @@ export class UnregisterService implements GrowiCommandProcessor {
   async unregister(relationRepository:RelationRepository, installation:Installation | undefined, authorizeResult, payload):Promise<void> {
   async unregister(relationRepository:RelationRepository, installation:Installation | undefined, authorizeResult, payload):Promise<void> {
     const { botToken } = authorizeResult;
     const { botToken } = authorizeResult;
     const { channel, growiUrls } = JSON.parse(payload.view.private_metadata);
     const { channel, growiUrls } = JSON.parse(payload.view.private_metadata);
-
-    console.log(installation?.id, growiUrls);
     const client = new WebClient(botToken, { logLevel: isProduction ? LogLevel.DEBUG : LogLevel.INFO });
     const client = new WebClient(botToken, { logLevel: isProduction ? LogLevel.DEBUG : LogLevel.INFO });
 
 
     const deleteResult = await relationRepository.createQueryBuilder('relation')
     const deleteResult = await relationRepository.createQueryBuilder('relation')