|
|
@@ -212,25 +212,26 @@ export class SlackCtrl {
|
|
|
const fromChannel = body.channel_name;
|
|
|
|
|
|
// permitted channel
|
|
|
- if (permittedChannels.includes(fromChannel)) {
|
|
|
- const relationsForSingleUse:RelationMock[] = [];
|
|
|
- body.permittedChannelsForEachCommand = relations[0].permittedChannelsForEachCommand;
|
|
|
- relationsForSingleUse.push(relations[0]);
|
|
|
- return this.sendCommand(growiCommand, relationsForSingleUse, body);
|
|
|
+ const isPermittedChannel = permittedChannels.includes(fromChannel);
|
|
|
+ if (!isPermittedChannel) {
|
|
|
+ const botToken = relations[0].installation?.data.bot?.token;
|
|
|
+
|
|
|
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
+ const client = generateWebClient(botToken!);
|
|
|
+ return client.chat.postEphemeral({
|
|
|
+ text: 'Error occured.',
|
|
|
+ channel: body.channel_id,
|
|
|
+ user: body.user_id,
|
|
|
+ blocks: [
|
|
|
+ markdownSectionBlock(`It is not allowed to run *'${growiCommand.growiCommandType}'* command to this GROWI.`),
|
|
|
+ ],
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- const botToken = relations[0].installation?.data.bot?.token;
|
|
|
-
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
- const client = generateWebClient(botToken!);
|
|
|
- return client.chat.postEphemeral({
|
|
|
- text: 'Error occured.',
|
|
|
- channel: body.channel_id,
|
|
|
- user: body.user_id,
|
|
|
- blocks: [
|
|
|
- markdownSectionBlock(`It is not allowed to run *'${growiCommand.growiCommandType}'* command to this GROWI.`),
|
|
|
- ],
|
|
|
- });
|
|
|
+ const relationsForSingleUse:RelationMock[] = [];
|
|
|
+ body.permittedChannelsForEachCommand = relations[0].permittedChannelsForEachCommand;
|
|
|
+ relationsForSingleUse.push(relations[0]);
|
|
|
+ return this.sendCommand(growiCommand, relationsForSingleUse, body);
|
|
|
});
|
|
|
}
|
|
|
}
|