2
0
zahmis 4 жил өмнө
parent
commit
0a54b19689

+ 0 - 1
packages/app/src/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -53,7 +53,6 @@ const SlackIntegration = (props) => {
       setSlackBotTokenEnv(slackBotTokenEnvVars);
       setSlackAppIntegrations(slackAppIntegrations);
       setProxyServerUri(proxyServerUri);
-      console.log(commandPermission);
     }
     catch (err) {
       toastError(err);

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

@@ -179,7 +179,7 @@ module.exports = (crowi) => {
       settings.slackBotTokenEnvVars = configManager.getConfigFromEnvVars('crowi', 'slackbot:withoutProxy:botToken');
       settings.slackSigningSecret = configManager.getConfig('crowi', 'slackbot:withoutProxy:signingSecret');
       settings.slackBotToken = configManager.getConfig('crowi', 'slackbot:withoutProxy:botToken');
-      settings.commandPermission = configManager.getConfig('crowi', 'slackbot:withoutProxy:commandhPermission');
+      settings.commandPermission = configManager.getConfig('crowi', 'slackbot:withoutProxy:commandPermission');
     }
     else {
       settings.proxyServerUri = crowi.configManager.getConfig('crowi', 'slackbot:proxyUri');

+ 9 - 2
packages/app/src/server/service/config-loader.ts

@@ -6,6 +6,8 @@ import ConfigModel, {
   Config, defaultCrowiConfigs, defaultMarkdownConfigs, defaultNotificationConfigs,
 } from '../models/config';
 
+const { defaultSupportedCommandsNameForBroadcastUse, defaultSupportedCommandsNameForSingleUse } = require('@growi/slack');
+
 const logger = loggerFactory('growi:service:ConfigLoader');
 
 enum ValueType { NUMBER, STRING, BOOLEAN }
@@ -31,6 +33,11 @@ const parserDictionary: EnumDictionary<ValueType, ValueParser<number | string |
   [ValueType.BOOLEAN]: { parse: (v: string) => { return envUtils.toBoolean(v) } },
 };
 
+const commandPermission = {};
+[...defaultSupportedCommandsNameForBroadcastUse, ...defaultSupportedCommandsNameForSingleUse].forEach((commandName) => {
+  commandPermission[commandName] = true;
+});
+
 /**
  * The following env vars are excluded because these are currently used before the configuration setup.
  * - MONGO_URI
@@ -488,9 +495,9 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
   },
   SLACKBOT_WITHOUT_PROXY_COMMAND_PERMISSION: {
     ns:      'crowi',
-    key:     'slackbot:withoutProxy:commandsPermission',
+    key:     'slackbot:withoutProxy:commandPermission',
     type:    ValueType.STRING,
-    default: JSON.stringify({ commandPermission: { search: true, create: true, togetter: true } }),
+    default: JSON.stringify(commandPermission),
   },
   SLACKBOT_WITH_PROXY_SALT_FOR_GTOP: {
     ns:      'crowi',