2
0
Эх сурвалжийг харах

put channel_id into private_metadata

Shun Miyazawa 4 жил өмнө
parent
commit
17129ed3cc

+ 2 - 2
src/server/service/slackbot.js

@@ -242,7 +242,6 @@ class SlackBotService extends S2sMessageHandlable {
   }
   }
 
 
   async createModal(client, body) {
   async createModal(client, body) {
-    this.channel_id = body.channel_id;
     try {
     try {
       await client.views.open({
       await client.views.open({
         trigger_id: body.trigger_id,
         trigger_id: body.trigger_id,
@@ -267,6 +266,7 @@ class SlackBotService extends S2sMessageHandlable {
             this.generateInputSectionBlock('path', 'Path', 'path_input', false, '/path'),
             this.generateInputSectionBlock('path', 'Path', 'path_input', false, '/path'),
             this.generateInputSectionBlock('contents', 'Contents', 'contents_input', true, 'Input with Markdown...'),
             this.generateInputSectionBlock('contents', 'Contents', 'contents_input', true, 'Input with Markdown...'),
           ],
           ],
+          private_metadata: body.channel_id,
         },
         },
       });
       });
     }
     }
@@ -304,7 +304,7 @@ class SlackBotService extends S2sMessageHandlable {
       // Send a message when page creation is complete
       // Send a message when page creation is complete
       const growiUri = this.crowi.appService.getSiteUrl();
       const growiUri = this.crowi.appService.getSiteUrl();
       await client.chat.postEphemeral({
       await client.chat.postEphemeral({
-        channel: this.channel_id,
+        channel: payload.view.private_metadata,
         user: payload.user.id,
         user: payload.user.id,
         text: `The page <${decodeURI(growiUri + path)} | ${decodeURI(`${growiUri}/${page._id}`)}> has been created.`,
         text: `The page <${decodeURI(growiUri + path)} | ${decodeURI(`${growiUri}/${page._id}`)}> has been created.`,
       });
       });