Steven Fukase 4 лет назад
Родитель
Сommit
dd78ca2bc0

+ 1 - 1
src/client/js/components/Admin/SlackIntegration/CustomBotWithProxySettings.jsx

@@ -36,7 +36,7 @@ const CustomBotWithProxySettings = (props) => {
   const deleteSlackAppIntegrationHandler = async() => {
   const deleteSlackAppIntegrationHandler = async() => {
     try {
     try {
       // GW-6068 set new value after this
       // GW-6068 set new value after this
-      await appContainer.apiv3.delete('/slack-integration-settings/slack-app-integration', { _id: integrationIdToDelete });
+      await appContainer.apiv3.delete('/slack-integration-settings/slack-app-integration', { integrationIdToDelete });
       fetchSlackIntegrationData();
       fetchSlackIntegrationData();
       toastSuccess(t('toaster.update_successed', { target: 'Token' }));
       toastSuccess(t('toaster.update_successed', { target: 'Token' }));
     }
     }

+ 6 - 3
src/server/routes/apiv3/slack-integration-settings.js

@@ -70,6 +70,9 @@ module.exports = (crowi) => {
     RelationTest: [
     RelationTest: [
       body('slackappintegrationsId').isMongoId(),
       body('slackappintegrationsId').isMongoId(),
     ],
     ],
+    deleteIntegration: [
+      query('integrationIdToDelete').isMongoId(),
+    ],
     SlackChannel: [
     SlackChannel: [
       body('channel').trim().not().isEmpty()
       body('channel').trim().not().isEmpty()
         .isString(),
         .isString(),
@@ -406,11 +409,11 @@ module.exports = (crowi) => {
    *          200:
    *          200:
    *            description: Succeeded to delete access tokens for slack
    *            description: Succeeded to delete access tokens for slack
    */
    */
-  router.delete('/slack-app-integration', validator.AccessTokens, apiV3FormValidator, async(req, res) => {
+  router.delete('/slack-app-integration', validator.deleteIntegration, apiV3FormValidator, async(req, res) => {
     const SlackAppIntegration = mongoose.model('SlackAppIntegration');
     const SlackAppIntegration = mongoose.model('SlackAppIntegration');
-    const { tokenGtoP, tokenPtoG } = req.query;
+    const { integrationIdToDelete } = req.query;
     try {
     try {
-      const response = await SlackAppIntegration.findOneAndDelete({ tokenGtoP, tokenPtoG });
+      const response = await SlackAppIntegration.findOneAndDelete({ _id: integrationIdToDelete });
       return res.apiv3({ response });
       return res.apiv3({ response });
     }
     }
     catch (error) {
     catch (error) {