|
|
@@ -64,25 +64,29 @@ module.exports = (crowi) => {
|
|
|
const permissionsForBroadcastUseCommands = slackAppIntegrationMock.permissionsForBroadcastUseCommands;
|
|
|
const permissionsForSingleUseCommands = slackAppIntegrationMock.permissionsForSingleUseCommands;
|
|
|
// MOCK DATA DELETE THIS GW-6972 ---------------
|
|
|
+
|
|
|
const { supportedCommandsForBroadcastUse, supportedCommandsForSingleUse } = relation;
|
|
|
|
|
|
// get command name from req.body
|
|
|
let command = '';
|
|
|
let actionId = '';
|
|
|
let callbackId = '';
|
|
|
+ let fromChannel = '';
|
|
|
|
|
|
if (!payload) { // when request is to /commands
|
|
|
command = req.body.text.split(' ')[0];
|
|
|
+ fromChannel = req.body.channel_name;
|
|
|
}
|
|
|
else if (payload.actions) { // when request is to /interactions && block_actions
|
|
|
actionId = payload.actions[0].action_id;
|
|
|
+ fromChannel = payload.channel.name;
|
|
|
}
|
|
|
else { // when request is to /interactions && view_submission
|
|
|
callbackId = payload.view.callback_id;
|
|
|
+ fromChannel = JSON.parse(payload.view.private_metadata).channelName;
|
|
|
}
|
|
|
|
|
|
// code below checks permission at channel level
|
|
|
- const fromChannel = req.body.channel_name || payload.channel.name;
|
|
|
let isPermitted = false;
|
|
|
[...permissionsForBroadcastUseCommands.keys(), ...permissionsForSingleUseCommands.keys()].forEach((commandName) => {
|
|
|
// boolean or string[]
|