Przeglądaj źródła

delete default command permission

zahmis 4 lat temu
rodzic
commit
72ca8b8050

+ 3 - 18
packages/app/src/server/routes/apiv3/slack-integration-settings.js

@@ -379,7 +379,6 @@ module.exports = (crowi) => {
    *            description: Succeeded to create slack app integration
    *            description: Succeeded to create slack app integration
    */
    */
   router.post('/slack-app-integrations', loginRequiredStrictly, adminRequired, csrf, async(req, res) => {
   router.post('/slack-app-integrations', loginRequiredStrictly, adminRequired, csrf, async(req, res) => {
-    const SlackAppIntegration = mongoose.model('SlackAppIntegration');
     const SlackAppIntegrationRecordsNum = await SlackAppIntegration.countDocuments();
     const SlackAppIntegrationRecordsNum = await SlackAppIntegration.countDocuments();
     if (SlackAppIntegrationRecordsNum >= 10) {
     if (SlackAppIntegrationRecordsNum >= 10) {
       const msg = 'Not be able to create more than 10 slack workspace integration settings';
       const msg = 'Not be able to create more than 10 slack workspace integration settings';
@@ -389,24 +388,16 @@ module.exports = (crowi) => {
 
 
     const { tokenGtoP, tokenPtoG } = await SlackAppIntegration.generateUniqueAccessTokens();
     const { tokenGtoP, tokenPtoG } = await SlackAppIntegration.generateUniqueAccessTokens();
     try {
     try {
-      // MOCK DATA DELETE THIS GW-6972 ---------------
-      /* This code represents the creation of the new SlackAppIntegration model instance. */
       const initialSupportedCommandsForBroadcastUse = new Map();
       const initialSupportedCommandsForBroadcastUse = new Map();
       const initialSupportedCommandsForSingleUse = new Map();
       const initialSupportedCommandsForSingleUse = new Map();
-      defaultSupportedCommandsNameForBroadcastUse.forEach((commandName) => {
-        initialSupportedCommandsForBroadcastUse.set(commandName, true);
-      });
-      defaultSupportedCommandsNameForSingleUse.forEach((commandName) => {
-        initialSupportedCommandsForSingleUse.set(commandName, true);
-      });
-      const slackAppTokensMOCK = await SlackAppIntegration.create({
+
+      const slackAppTokens = await SlackAppIntegration.create({
         tokenGtoP,
         tokenGtoP,
         tokenPtoG,
         tokenPtoG,
         permissionsForBroadcastUseCommands: initialSupportedCommandsForBroadcastUse,
         permissionsForBroadcastUseCommands: initialSupportedCommandsForBroadcastUse,
         permissionsForSingleUseCommands: initialSupportedCommandsForSingleUse,
         permissionsForSingleUseCommands: initialSupportedCommandsForSingleUse,
       });
       });
-      // MOCK DATA DELETE THIS GW-6972 ---------------
-      return res.apiv3(slackAppTokensMOCK, 200);
+      return res.apiv3(slackAppTokens, 200);
     }
     }
     catch (error) {
     catch (error) {
       const msg = 'Error occurred during creating slack integration settings procedure';
       const msg = 'Error occurred during creating slack integration settings procedure';
@@ -591,7 +582,6 @@ module.exports = (crowi) => {
           permissionsForSingleUseCommands: slackAppIntegration.permissionsForSingleUseCommands,
           permissionsForSingleUseCommands: slackAppIntegration.permissionsForSingleUseCommands,
         },
         },
       );
       );
-      // MOCK DATA MODIFY THIS GW-6972 ---------------
 
 
       return res.apiv3({ slackAppIntegration });
       return res.apiv3({ slackAppIntegration });
     }
     }
@@ -631,17 +621,12 @@ module.exports = (crowi) => {
     const { id } = req.params;
     const { id } = req.params;
     let slackBotToken;
     let slackBotToken;
     try {
     try {
-      // MOCK DATA DELETE THIS GW-6972 ---------------
-      const SlackAppIntegration = mongoose.model('SlackAppIntegration');
       const slackAppIntegration = await SlackAppIntegration.findOne({ _id: id });
       const slackAppIntegration = await SlackAppIntegration.findOne({ _id: id });
-      // MOCK DATA DELETE THIS GW-6972 ---------------
       if (slackAppIntegration == null) {
       if (slackAppIntegration == 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
-
       const result = await requestToProxyServer(
       const result = await requestToProxyServer(
         slackAppIntegration.tokenGtoP,
         slackAppIntegration.tokenGtoP,
         'post',
         'post',