|
|
@@ -1,3 +1,7 @@
|
|
|
+import {
|
|
|
+ type NonBlankString,
|
|
|
+ toNonBlankStringOrUndefined,
|
|
|
+} from '@growi/core/dist/interfaces';
|
|
|
import {
|
|
|
type GrowiBotEvent,
|
|
|
type GrowiCommand,
|
|
|
@@ -25,7 +29,8 @@ import { LinkSharedEventHandler } from './slack-event-handler/link-shared';
|
|
|
|
|
|
const logger = loggerFactory('growi:service:SlackBotService');
|
|
|
|
|
|
-const OFFICIAL_SLACKBOT_PROXY_URI = 'https://slackbot-proxy.growi.org';
|
|
|
+const OFFICIAL_SLACKBOT_PROXY_URI =
|
|
|
+ 'https://slackbot-proxy.growi.org' as NonBlankString;
|
|
|
|
|
|
type S2sMessageForSlackIntegration = S2sMessage & { updatedAt: Date };
|
|
|
|
|
|
@@ -127,23 +132,19 @@ export class SlackIntegrationService implements S2sMessageHandlable {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- get proxyUriForCurrentType(): string | undefined {
|
|
|
+ get proxyUriForCurrentType(): NonBlankString | undefined {
|
|
|
const currentBotType = configManager.getConfig('slackbot:currentBotType');
|
|
|
|
|
|
// TODO assert currentBotType is not null and CUSTOM_WITHOUT_PROXY
|
|
|
|
|
|
- let proxyUri: string | undefined;
|
|
|
-
|
|
|
switch (currentBotType) {
|
|
|
case SlackbotType.OFFICIAL:
|
|
|
- proxyUri = OFFICIAL_SLACKBOT_PROXY_URI;
|
|
|
- break;
|
|
|
+ return OFFICIAL_SLACKBOT_PROXY_URI;
|
|
|
default:
|
|
|
- proxyUri = configManager.getConfig('slackbot:proxyUri');
|
|
|
- break;
|
|
|
+ return toNonBlankStringOrUndefined(
|
|
|
+ configManager.getConfig('slackbot:proxyUri'),
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
- return proxyUri;
|
|
|
}
|
|
|
|
|
|
/**
|