zahmis пре 4 година
родитељ
комит
55b753195d
1 измењених фајлова са 1 додато и 22 уклоњено
  1. 1 22
      packages/slackbot-proxy/src/controllers/slack.ts

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

@@ -70,7 +70,7 @@ export class SlackCtrl {
    * @param body
    * @returns
    */
-  private async sendCommand(growiCommand: GrowiCommand | string, relations: RelationMock[], body: any) {
+  private async sendCommand(growiCommand: GrowiCommand, relations: RelationMock[], body: any) {
     if (relations.length === 0) {
       throw new Error('relations must be set');
     }
@@ -146,14 +146,6 @@ export class SlackCtrl {
       .leftJoinAndSelect('relation_mock.installation', 'installation')
       .getMany();
 
-    if (relations.length === 0) {
-      return res.json({
-        blocks: [
-          markdownSectionBlock('*No relation found.*'),
-          markdownSectionBlock('Run `/growi register` first.'),
-        ],
-      });
-    }
 
     // status
     if (growiCommand.growiCommandType === 'status') {
@@ -222,19 +214,6 @@ export class SlackCtrl {
     const installationId = authorizeResult.enterpriseId || authorizeResult.teamId;
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const installation = await this.installationRepository.findByTeamIdOrEnterpriseId(installationId!);
-    const relations = await this.relationMockRepository.createQueryBuilder('relation_mock')
-      .where('relation_mock.installationId = :id', { id: installation?.id })
-      .leftJoinAndSelect('relation_mock.installation', 'installation')
-      .getMany();
-
-    if (relations.length === 0) {
-      return res.json({
-        blocks: [
-          markdownSectionBlock('*No relation found.*'),
-          markdownSectionBlock('Run `/growi register` first.'),
-        ],
-      });
-    }
 
     const payload = JSON.parse(body.payload);