|
|
@@ -202,22 +202,11 @@ export class SlackCtrl {
|
|
|
}
|
|
|
|
|
|
if (!isCommandPermitted) {
|
|
|
- const botToken = relations[0].installation?.data.bot?.token;
|
|
|
-
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
- const client = generateWebClient(botToken!);
|
|
|
-
|
|
|
- const relationMock = await this.relationMockRepository.findOne({
|
|
|
- where: { installation },
|
|
|
- });
|
|
|
-
|
|
|
+ // check permission at channel level
|
|
|
+ const relationMock = await this.relationMockRepository.findOne({ where: { installation } });
|
|
|
const channelsObject = relationMock?.permittedChannelsForEachCommand.channelsObject;
|
|
|
+ if (channelsObject == null) return;
|
|
|
|
|
|
- if (channelsObject == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // check permission at channel level
|
|
|
Object.keys(channelsObject).forEach((commandName) => {
|
|
|
const permittedChannels = channelsObject[commandName];
|
|
|
const fromChannel = body.channel_name;
|
|
|
@@ -230,6 +219,10 @@ export class SlackCtrl {
|
|
|
return this.sendCommand(growiCommand, relationsForSingleUse, body);
|
|
|
}
|
|
|
|
|
|
+ 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,
|