|
@@ -535,6 +535,7 @@ module.exports = (crowi) => {
|
|
|
const { id } = req.params;
|
|
const { id } = req.params;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
+ // NOT MOCK DATA BUT REFER THIS GW-7006
|
|
|
const slackAppIntegration = await SlackAppIntegration.findByIdAndUpdate(
|
|
const slackAppIntegration = await SlackAppIntegration.findByIdAndUpdate(
|
|
|
id,
|
|
id,
|
|
|
{ supportedCommandsForBroadcastUse, supportedCommandsForSingleUse },
|
|
{ supportedCommandsForBroadcastUse, supportedCommandsForSingleUse },
|
|
@@ -557,6 +558,7 @@ module.exports = (crowi) => {
|
|
|
togetter: ['random', 'admin'],
|
|
togetter: ['random', 'admin'],
|
|
|
};
|
|
};
|
|
|
const slackAppIntegrationMock = await SlackAppIntegrationMock.findOneAndUpdate(
|
|
const slackAppIntegrationMock = await SlackAppIntegrationMock.findOneAndUpdate(
|
|
|
|
|
+ // MOCK DATA USE id IN req.params LIKE ABOVE
|
|
|
{ tokenPtoG: slackAppIntegration.tokenPtoG },
|
|
{ tokenPtoG: slackAppIntegration.tokenPtoG },
|
|
|
{
|
|
{
|
|
|
permissionsForBroadcastUseCommands: permissionsForBroadcastUseCommandsFromClient,
|
|
permissionsForBroadcastUseCommands: permissionsForBroadcastUseCommandsFromClient,
|
|
@@ -615,24 +617,23 @@ module.exports = (crowi) => {
|
|
|
const { slackAppIntegrationId } = req.body;
|
|
const { slackAppIntegrationId } = req.body;
|
|
|
let slackBotToken;
|
|
let slackBotToken;
|
|
|
try {
|
|
try {
|
|
|
- const slackAppIntegration = await SlackAppIntegration.findOne({ _id: slackAppIntegrationId });
|
|
|
|
|
// MOCK DATA DELETE THIS GW-6972 ---------------
|
|
// MOCK DATA DELETE THIS GW-6972 ---------------
|
|
|
const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
|
|
const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
|
|
|
const slackAppIntegrationMock = await SlackAppIntegrationMock.findOne({ _id: slackAppIntegrationId });
|
|
const slackAppIntegrationMock = await SlackAppIntegrationMock.findOne({ _id: slackAppIntegrationId });
|
|
|
// MOCK DATA DELETE THIS GW-6972 ---------------
|
|
// MOCK DATA DELETE THIS GW-6972 ---------------
|
|
|
- if (slackAppIntegration == null) {
|
|
|
|
|
|
|
+ if (slackAppIntegrationMock == null) {
|
|
|
const msg = 'Could not find SlackAppIntegration by id';
|
|
const msg = 'Could not find SlackAppIntegration by id';
|
|
|
return res.apiv3Err(new ErrorV3(msg, 'find-slackAppIntegration-failed'), 400);
|
|
return res.apiv3Err(new ErrorV3(msg, 'find-slackAppIntegration-failed'), 400);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// USE MOCK DATA HERE FOR cache creation at /relation-test GW-7021
|
|
// USE MOCK DATA HERE FOR cache creation at /relation-test GW-7021
|
|
|
const result = await requestToProxyServer(
|
|
const result = await requestToProxyServer(
|
|
|
- slackAppIntegration.tokenGtoP,
|
|
|
|
|
|
|
+ slackAppIntegrationMock.tokenGtoP,
|
|
|
'post',
|
|
'post',
|
|
|
'/g2s/relation-test',
|
|
'/g2s/relation-test',
|
|
|
{
|
|
{
|
|
|
- permissionsForBroadcastUseCommands: slackAppIntegration.permissionsForBroadcastUseCommands,
|
|
|
|
|
- supportedCommandsForSingleUse: slackAppIntegration.supportedCommandsForSingleUse,
|
|
|
|
|
|
|
+ permissionsForBroadcastUseCommands: slackAppIntegrationMock.permissionsForBroadcastUseCommands,
|
|
|
|
|
+ permissionsForSingleUseCommands: slackAppIntegrationMock.permissionsForSingleUseCommands,
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
|
|
|