zahmis 4 лет назад
Родитель
Сommit
64df7dcc41

+ 3 - 3
src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySettings.jsx

@@ -10,7 +10,7 @@ import CustomBotWithoutProxyIntegrationCard from './CustomBotWithoutProxyIntegra
 import DeleteSlackCredentialsModal from './DeleteSlackCredentialsModal';
 import DeleteSlackCredentialsModal from './DeleteSlackCredentialsModal';
 
 
 const CustomBotWithoutProxySettings = (props) => {
 const CustomBotWithoutProxySettings = (props) => {
-  const { appContainer, /* isSlackScopeSet, */ isSetupSlackBot } = props;
+  const { appContainer, isSlackScopeSet, isSetupSlackBot } = props;
   const { t } = useTranslation();
   const { t } = useTranslation();
 
 
   const [siteName, setSiteName] = useState('');
   const [siteName, setSiteName] = useState('');
@@ -23,7 +23,7 @@ const CustomBotWithoutProxySettings = (props) => {
         slackBotToken: '',
         slackBotToken: '',
         currentBotType: 'customBotWithoutProxy',
         currentBotType: 'customBotWithoutProxy',
       });
       });
-      props.onSetIsSetupSlackBot(false);
+      // props.onSetIsSetupSlackBot(false);
       props.fetchSlackIntegrationData();
       props.fetchSlackIntegrationData();
       toastSuccess('success');
       toastSuccess('success');
     }
     }
@@ -49,7 +49,7 @@ const CustomBotWithoutProxySettings = (props) => {
 
 
       <h2 className="admin-setting-header">{t('admin:slack_integration.custom_bot_without_proxy_settings')}</h2>
       <h2 className="admin-setting-header">{t('admin:slack_integration.custom_bot_without_proxy_settings')}</h2>
 
 
-      {isSetupSlackBot && (
+      {isSlackScopeSet && (
       <button
       <button
         className="pull-right btn text-danger border-danger"
         className="pull-right btn text-danger border-danger"
         type="button"
         type="button"

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

@@ -19,7 +19,7 @@ const CustomBotWithoutProxySettingsAccordion = ({
   appContainer, activeStep, fetchSlackIntegrationData,
   appContainer, activeStep, fetchSlackIntegrationData,
   slackSigningSecret, slackSigningSecretEnv, slackBotToken, slackBotTokenEnv,
   slackSigningSecret, slackSigningSecretEnv, slackBotToken, slackBotTokenEnv,
   isRegisterSlackCredentials, isSendTestMessage,
   isRegisterSlackCredentials, isSendTestMessage,
-  onSetSlackSigningSecret, onSetSlackBotToken, onSetIsSendTestMessage,
+  onSetSlackSigningSecret, onSetSlackBotToken, onSetIsSendTestMessage, /*  onSetIsSlackScopeSet, */
 }) => {
 }) => {
   const { t } = useTranslation();
   const { t } = useTranslation();
   // TODO: GW-5644 Store default open accordion
   // TODO: GW-5644 Store default open accordion
@@ -43,6 +43,7 @@ const CustomBotWithoutProxySettingsAccordion = ({
       if (fetchSlackIntegrationData == null) {
       if (fetchSlackIntegrationData == null) {
         return null;
         return null;
       }
       }
+      // onSetIsSlackScopeSet(true);
       fetchSlackIntegrationData();
       fetchSlackIntegrationData();
       toastSuccess(t('toaster.update_successed', { target: t('admin:slack_integration.custom_bot_without_proxy_settings') }));
       toastSuccess(t('toaster.update_successed', { target: t('admin:slack_integration.custom_bot_without_proxy_settings') }));
     }
     }

+ 5 - 2
src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -33,10 +33,11 @@ const SlackIntegration = (props) => {
     if (!isConnectedToSlack) {
     if (!isConnectedToSlack) {
       return setSlackWSNameInWithoutProxy(null);
       return setSlackWSNameInWithoutProxy(null);
     }
     }
+
     try {
     try {
       const res = await appContainer.apiv3.get('/slack-integration/custom-bot-without-proxy/slack-workspace-name');
       const res = await appContainer.apiv3.get('/slack-integration/custom-bot-without-proxy/slack-workspace-name');
       setSlackWSNameInWithoutProxy(res.data.slackWorkSpaceName);
       setSlackWSNameInWithoutProxy(res.data.slackWorkSpaceName);
-      setIsSlackScopeSet(true);
+      // setIsSlackScopeSet(true);
     }
     }
     catch (err) {
     catch (err) {
       if (err[0].message === 'missing_scope') {
       if (err[0].message === 'missing_scope') {
@@ -66,6 +67,7 @@ const SlackIntegration = (props) => {
       setSlackBotTokenEnv(slackBotTokenEnvVars);
       setSlackBotTokenEnv(slackBotTokenEnvVars);
       setIsConnectedToSlack(isConnectedToSlack);
       setIsConnectedToSlack(isConnectedToSlack);
       setIsSetupSlackBot(isSetupSlackBot);
       setIsSetupSlackBot(isSetupSlackBot);
+      setIsSlackScopeSet(isSlackScopeSet);
 
 
       fetchSlackWorkSpaceNameInWithoutProxy();
       fetchSlackWorkSpaceNameInWithoutProxy();
 
 
@@ -81,7 +83,7 @@ const SlackIntegration = (props) => {
     catch (err) {
     catch (err) {
       toastError(err);
       toastError(err);
     }
     }
-  }, [appContainer.apiv3, fetchSlackWorkSpaceNameInWithoutProxy]);
+  }, [appContainer.apiv3, fetchSlackWorkSpaceNameInWithoutProxy, isSlackScopeSet]);
 
 
 
 
   useEffect(() => {
   useEffect(() => {
@@ -147,6 +149,7 @@ const SlackIntegration = (props) => {
           slackSigningSecret={slackSigningSecret}
           slackSigningSecret={slackSigningSecret}
           slackWSNameInWithoutProxy={slackWSNameInWithoutProxy}
           slackWSNameInWithoutProxy={slackWSNameInWithoutProxy}
           onSetIsSetupSlackBot={setIsSetupSlackBot}
           onSetIsSetupSlackBot={setIsSetupSlackBot}
+          // onSetIsSlackScopeSet={setIsSlackScopeSet}
           onSetSlackSigningSecret={setSlackSigningSecret}
           onSetSlackSigningSecret={setSlackSigningSecret}
           onSetSlackBotToken={setSlackBotToken}
           onSetSlackBotToken={setSlackBotToken}
           onSetIsSendTestMessage={setIsSendTestMessage}
           onSetIsSendTestMessage={setIsSendTestMessage}