Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/(authenticated)/calendar/new/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getCurrentUser } from "@/lib/auth/server";
import slackApiConnection, {
isSlackEnabled,
} from "@/lib/slack/slackApiConnection";
import { ConversationsInfoResponse } from "@slack/web-api/dist/response/ConversationsInfoResponse";
import { ConversationsInfoResponse } from "@slack/web-api/dist/types/response/ConversationsInfoResponse";
import * as Calendar from "@/features/calendar";
import { revalidatePath } from "next/cache";
import { env } from "process";
Expand Down
2 changes: 1 addition & 1 deletion app/(authenticated)/calendar/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import slackApiConnection, {
import { SlackChannelsProvider } from "@/components/slack/SlackChannelsProvider";
import { SlackEnabledProvider } from "@/components/slack/SlackEnabledProvider";
import { App } from "@slack/bolt";
import { Channel } from "@slack/web-api/dist/response/ConversationsListResponse";
import { Channel } from "@slack/web-api/dist/types/response/ConversationsListResponse";
import { env } from "@/lib/env";
import { createEvent } from "./actions";
import { PageInfo } from "@/components/PageInfo";
Expand Down
2 changes: 1 addition & 1 deletion components/slack/SlackChannelName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import slackApiConnection, {
isSlackEnabled,
} from "@/lib/slack/slackApiConnection";
import { Text } from "@mantine/core";
import { ConversationsInfoResponse } from "@slack/web-api/dist/response";
import { ConversationsInfoResponse } from "@slack/web-api/dist/types/response";

export default async function SlackChannelName({
slackChannelID,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/SlackChannelsProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import invariant from "@/lib/invariant";
import { Channel } from "@slack/web-api/dist/response/ConversationsListResponse";
import { Channel } from "@slack/web-api/dist/types/response/ConversationsListResponse";
import { createContext, useContext } from "react";

const SlackChannelContext = createContext<Promise<Channel[]> | null>(null);
Expand Down
6 changes: 3 additions & 3 deletions features/calendar/check_with_tech_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import {
ButtonAction,
SlackViewMiddlewareArgs,
ViewSubmitAction,
} from "@slack/bolt";
import {
ContextBlock,
Block,
SectionBlock,
RichTextBlock,
} from "@slack/bolt";
} from "@slack/types/dist/block-kit/blocks";
import dayjs from "dayjs";
import { env } from "@/lib/env";
import { z } from "zod";
Expand Down
2 changes: 1 addition & 1 deletion features/userFeedback/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import invariant from "@/lib/invariant";
import slackApiConnection, {
isSlackEnabled,
} from "@/lib/slack/slackApiConnection";
import { KnownBlock } from "@slack/bolt";
import { KnownBlock } from "@slack/types/dist/block-kit/blocks";

export async function submit(
type: "bug" | "feature",
Expand Down
9 changes: 4 additions & 5 deletions lib/slack/slackApiConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ declare global {

export const isSlackEnabled = env.SLACK_ENABLED === "true";

async function slackApiConnection() {
async function slackApiConnection(create?: boolean): Promise<App> {
if (!isSlackEnabled) {
throw new Error("Slack is not enabled");
}
if (!global.slack) {
global.slack = new App({
if (create) {
return new App({
token: env.SLACK_BOT_TOKEN,
signingSecret: env.SLACK_SIGNING_SECRET,
socketMode: env.SLACK_DISABLE_SOCKET_MODE !== "true",
Expand All @@ -24,8 +24,7 @@ async function slackApiConnection() {
},
});
}

return global.slack;
return (globalThis as unknown as { slackApp: App }).slackApp;
}

export default slackApiConnection;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@mux/mux-video-react": "^0.11.4",
"@prisma/client": "^5.8.1",
"@sentry/nextjs": "^8.28.0",
"@slack/bolt": "^3.21.4",
"@slack/bolt": "^4.0.0",
"@tanstack/react-query": "^5.51.23",
"@trpc/server": "^10.33.1",
"@types/async": "^3.2.20",
Expand Down
3 changes: 2 additions & 1 deletion server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ app.prepare().then(async () => {
let slackApp: App | undefined;

if (isSlackEnabled) {
slackApp = await slackApiConnection();
slackApp = await slackApiConnection(true);
(globalThis as unknown as { slackApp: App }).slackApp = slackApp;

await setupActionHandlers(slackApp);
}
Expand Down
Loading
Loading