fix: Infinite loop connecting Slack in self-hosted

closes https://github.com/outline/outline/discussions/4993
This commit is contained in:
Tom Moor
2023-04-21 18:09:28 -04:00
parent 7740ee2046
commit 3e5cd9eb3c

View File

@@ -16,7 +16,7 @@ import {
Team,
User,
} from "@server/models";
import { AuthenticationResult } from "@server/types";
import { APIContext, AuthenticationResult } from "@server/types";
import {
getClientFromContext,
getTeamFromContext,
@@ -132,9 +132,9 @@ if (env.SLACK_CLIENT_ID && env.SLACK_CLIENT_SECRET) {
auth({
optional: true,
}),
async (ctx) => {
async (ctx: APIContext) => {
const { code, state, error } = ctx.request.query;
const { user } = ctx.state;
const { user } = ctx.state.auth;
assertPresent(code || error, "code is required");
if (error) {
@@ -195,9 +195,9 @@ if (env.SLACK_CLIENT_ID && env.SLACK_CLIENT_SECRET) {
auth({
optional: true,
}),
async (ctx) => {
async (ctx: APIContext) => {
const { code, error, state } = ctx.request.query;
const { user } = ctx.state;
const { user } = ctx.state.auth;
assertPresent(code || error, "code is required");
const collectionId = state;