Explorar o código

Merge pull request #3872 from weseek/feat/6209-6210-implement-growi-status-command

Feat/6209 6210 implement growi status command
itizawa %!s(int64=4) %!d(string=hai) anos
pai
achega
1900c0ee70
Modificáronse 1 ficheiros con 13 adicións e 3 borrados
  1. 13 3
      packages/slackbot-proxy/src/controllers/slack.ts

+ 13 - 3
packages/slackbot-proxy/src/controllers/slack.ts

@@ -83,9 +83,6 @@ export class SlackCtrl {
       return this.registerService.process(growiCommand, authorizeResult, body as {[key:string]:string});
     }
 
-    /*
-     * forward to GROWI server
-     */
     const installationId = authorizeResult.enterpriseId || authorizeResult.teamId;
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const installation = await this.installationRepository.findByTeamIdOrEnterpriseId(installationId!);
@@ -100,10 +97,23 @@ export class SlackCtrl {
       });
     }
 
+    // status
+    if (growiCommand.growiCommandType === 'status') {
+      return res.json({
+        blocks: [
+          generateMarkdownSectionBlock('*Found Relations to GROWI.*'),
+          ...relations.map(relation => generateMarkdownSectionBlock(`GROWI url: ${relation.growiUri}.`)),
+        ],
+      });
+    }
+
     // 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();
 
+    /*
+     * forward to GROWI server
+     */
     const promises = relations.map((relation: Relation) => {
       // generate API URL
       const url = new URL('/_api/v3/slack-integration/proxied/commands', relation.growiUri);