diff --git a/.env.test b/.env.test index efa12a8..523b562 100644 --- a/.env.test +++ b/.env.test @@ -9,3 +9,5 @@ SLACK_BOT_USER_O_AUTH_ACCESS_TOKEN=SLACK_BOT_USER_O_AUTH_ACCESS_TOKEN SLACK_SIGNING_SECRET=SLACK_SIGNING_SECRET EMAIL_DOMAINS=my-domain.com,ext.my-domain.com GITLAB_URL=https://my-git.domain.com +SLACK_SUPPORT_CHANNEL_ID=C0XXXXXXXXX +SLACK_SUPPORT_CHANNEL_NAME=support-homer diff --git a/README.md b/README.md index f153725..23ac95d 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,14 @@ Create a `.env` file containing the following variables: The gitlab URL of your organization +- `SLACK_SUPPORT_CHANNEL_ID` + + This slack channel id is displayed when a user enters the help command. People having trouble with homer can be helped on this support channel. + +- `SLACK_SUPPORT_CHANNEL_NAME` + + This slack channel name is displayed when a user enters the help command. People having trouble with homer can be helped on this support channel. + If you want Homer to connect to an **external PostgreSQL database**, you can set the following variables: diff --git a/src/constants.ts b/src/constants.ts index 5aff732..2000519 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -20,7 +20,12 @@ export const MERGE_REQUEST_OPEN_STATES: GitlabMergeRequestState[] = [ 'opened', 'reopened', ]; -export const MOES_TAVERN_CHANNEL_ID = 'C01FCCQGP3M'; +export const SLACK_SUPPORT_CHANNEL_ID = getEnvVariable( + 'SLACK_SUPPORT_CHANNEL_ID' +); +export const SLACK_SUPPORT_CHANNEL_NAME = getEnvVariable( + 'SLACK_SUPPORT_CHANNEL_NAME' +); export const PRIVATE_CHANNEL_ERROR_MESSAGE = 'D’oh! It looks like you tried to use me on a private channel I’m not in. Please invite me using `/invite @homer` so I can publish messages :homer-donut:'; export const REQUEST_BODY_SIZE_LIMIT = '500kb'; diff --git a/src/core/viewBuilders/buildHelpMessage.ts b/src/core/viewBuilders/buildHelpMessage.ts index 885694c..70a7bce 100644 --- a/src/core/viewBuilders/buildHelpMessage.ts +++ b/src/core/viewBuilders/buildHelpMessage.ts @@ -1,5 +1,8 @@ import type { ChatPostMessageArguments } from '@slack/web-api'; -import { MOES_TAVERN_CHANNEL_ID } from '@/constants'; +import { + SLACK_SUPPORT_CHANNEL_ID, + SLACK_SUPPORT_CHANNEL_NAME, +} from '@/constants'; export function buildHelpMessage(channelId: string): ChatPostMessageArguments { return { @@ -13,7 +16,7 @@ Here are the available commands: - /homer review <search> - Share a merge request on a channel. Searches in title and description by default. Accepts merge request URLs and merge request IDs prefixed with "!". - /homer review list - List ongoing reviews shared in a channel. -Don't hesitate to join me on #moes-tavern-homer to take a beer!`, +Don't hesitate to join me on ${SLACK_SUPPORT_CHANNEL_NAME} to take a beer!`, blocks: [ { type: 'section', @@ -28,7 +31,7 @@ Here are the available commands: • \`/homer review <search>\` Share a merge request on a channel. Searches in title and description by default. Accepts merge request URLs and merge request IDs prefixed with "!". • \`/homer review list\` List ongoing reviews shared in a channel. -Don't hesitate to join me on <#${MOES_TAVERN_CHANNEL_ID}> to take a :beer:!`, +Don't hesitate to join me on <#${SLACK_SUPPORT_CHANNEL_ID}> to take a :beer:!`, }, }, ], diff --git a/src/home/buildAppHomeView.ts b/src/home/buildAppHomeView.ts index 0bcb357..c442039 100644 --- a/src/home/buildAppHomeView.ts +++ b/src/home/buildAppHomeView.ts @@ -1,5 +1,5 @@ import type { View } from '@slack/web-api'; -import { HOMER_GITLAB_URL, MOES_TAVERN_CHANNEL_ID } from '@/constants'; +import { HOMER_GITLAB_URL, SLACK_SUPPORT_CHANNEL_ID } from '@/constants'; import type { SlackUser } from '@/core/typings/SlackUser'; export async function buildAppHomeView(user: SlackUser): Promise { @@ -15,7 +15,7 @@ export async function buildAppHomeView(user: SlackUser): Promise { text: `\ Hello *${firstName}*, I'm *Homer*, the :logo-manomano: ManoMano's :gitlab: Gitlab master! -If you want to take a :beer: with me, don't hesitate to join <#${MOES_TAVERN_CHANNEL_ID}>. +If you want to take a :beer: with me, don't hesitate to join <#${SLACK_SUPPORT_CHANNEL_ID}>. If you want to better know me, here are some useful links: