Steven Fukase 5 лет назад
Родитель
Сommit
2619c120f7

+ 1 - 0
resource/locales/en_US/admin/admin.json

@@ -275,6 +275,7 @@
     },
     "bot_reset_successful": "Bot settings have been reset.",
     "copied_to_clipboard": "Copied to clipboard",
+    "set_scope": "Please set up Bot Token Scopes from Slack settings",
     "modal": {
       "warning": "Warning",
       "sure_change_bot_type": "Are you sure you want to change the bot type?",

+ 1 - 0
resource/locales/ja_JP/admin/admin.json

@@ -273,6 +273,7 @@
     },
     "bot_reset_successful": "Botの設定を消去しました。",
     "copied_to_clipboard": "クリップボードにコピーされました。",
+    "set_scope": "Slackの設定画面からBot Token Scopeを設定してください",
     "modal": {
       "warning": "注意",
       "sure_change_bot_type": "Botの種類を変更しますか?",

+ 1 - 0
resource/locales/zh_CN/admin/admin.json

@@ -283,6 +283,7 @@
     },
     "bot_reset_successful": "删除了BOT设置。",
     "copied_to_clipboard": "它已复制到剪贴板。",
+    "set_scope": "在Slack设置页面中配置Bot Token Scope。",
     "modal": {
       "warning": "警告",
       "sure_change_bot_type": "您确定要更改设置吗?",

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

@@ -37,7 +37,12 @@ const SlackIntegration = (props) => {
       setSlackWSNameInWithoutProxy(res.data.slackWorkSpaceName);
     }
     catch (err) {
-      toastError(err);
+      if (err === 'missing_scope') {
+        toastError(t('admin: slack_integration.set_scope'));
+      }
+      else {
+        toastError(err);
+      }
     }
   }, [appContainer.apiv3, isConnectedToSlack]);
 

+ 1 - 1
src/server/routes/apiv3/slack-integration.js

@@ -234,7 +234,7 @@ module.exports = (crowi) => {
     catch (error) {
       let msg = 'Error occured in slack_bot_token';
       if (error.data.ok === false && error.data.error === 'missing_scope') {
-        msg = 'Please set Scope for Slack';
+        msg = 'missing_scope';
       }
       logger.error('Error', error);
       return res.apiv3Err(new ErrorV3(msg, 'get-SlackWorkSpaceName-failed'), 500);