Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: use canonical Slack install login route

Richie McIlroyef213c3b64ef
diff --git a/apps/web/__tests__/unit/slack-install-route.test.ts b/apps/web/__tests__/unit/slack-install-route.test.ts
new file mode 100644
index 000000000..704091597
--- /dev/null
+++ b/apps/web/__tests__/unit/slack-install-route.test.ts
@@ -0,0 +1,15 @@
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { describe, expect, it } from "vitest";
+
+describe("Slack install route contract", () => {
+ it("redirects unauthenticated users through the canonical login page", () => {
+ const route = readFileSync(
+ join(process.cwd(), "app/api/integrations/slack/install/route.ts"),
+ "utf8",
+ );
+
+ expect(route).toContain('new URL("/login", serverEnv().WEB_URL)');
+ expect(route).not.toContain('new URL("/auth/signin"');
+ });
+});
diff --git a/apps/web/app/api/integrations/slack/install/route.ts b/apps/web/app/api/integrations/slack/install/route.ts
index 13e986ada..25f57bf56 100644
--- a/apps/web/app/api/integrations/slack/install/route.ts
+++ b/apps/web/app/api/integrations/slack/install/route.ts
@@ -32,7 +32,7 @@ const ApiLive = HttpApiBuilder.api(Api).pipe(
Effect.gen(function* () {
const user = yield* Effect.tryPromise(getCurrentUser);
if (!user) {
- const signInUrl = new URL("/auth/signin", serverEnv().WEB_URL);
+ const signInUrl = new URL("/login", serverEnv().WEB_URL);
signInUrl.searchParams.set("next", settingsPath);
return HttpServerResponse.redirect(signInUrl, { status: 302 });
}