chore: Remove DEPLOYMENT and SUBDOMAINS_ENABLED (#5742)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import sharedEnv from "@shared/env";
|
||||
import env from "@server/env";
|
||||
import { buildUser, buildTeam } from "@server/test/factories";
|
||||
import { getTestServer } from "@server/test/support";
|
||||
import {
|
||||
getTestServer,
|
||||
setCloudHosted,
|
||||
setSelfHosted,
|
||||
} from "@server/test/support";
|
||||
|
||||
const mockTeamInSessionId = "1e023d05-951c-41c6-9012-c9fa0402e1c3";
|
||||
|
||||
@@ -14,6 +16,8 @@ jest.mock("@server/utils/authentication", () => ({
|
||||
const server = getTestServer();
|
||||
|
||||
describe("#auth.info", () => {
|
||||
beforeEach(setCloudHosted);
|
||||
|
||||
it("should return current authentication", async () => {
|
||||
const team = await buildTeam();
|
||||
const team2 = await buildTeam();
|
||||
@@ -93,8 +97,6 @@ describe("#auth.delete", () => {
|
||||
|
||||
describe("#auth.config", () => {
|
||||
it("should return available SSO providers", async () => {
|
||||
env.DEPLOYMENT = "hosted";
|
||||
|
||||
const res = await server.post("/api/auth.config");
|
||||
const body = await res.json();
|
||||
expect(res.status).toEqual(200);
|
||||
@@ -105,10 +107,6 @@ describe("#auth.config", () => {
|
||||
});
|
||||
|
||||
it("should return available providers for team subdomain", async () => {
|
||||
env.URL = sharedEnv.URL = "https://app.outline.dev";
|
||||
env.SUBDOMAINS_ENABLED = sharedEnv.SUBDOMAINS_ENABLED = true;
|
||||
env.DEPLOYMENT = "hosted";
|
||||
|
||||
await buildTeam({
|
||||
guestSignin: false,
|
||||
subdomain: "example",
|
||||
@@ -131,8 +129,6 @@ describe("#auth.config", () => {
|
||||
});
|
||||
|
||||
it("should return available providers for team custom domain", async () => {
|
||||
env.DEPLOYMENT = "hosted";
|
||||
|
||||
await buildTeam({
|
||||
guestSignin: false,
|
||||
domain: "docs.mycompany.com",
|
||||
@@ -155,9 +151,6 @@ describe("#auth.config", () => {
|
||||
});
|
||||
|
||||
it("should return email provider for team when guest signin enabled", async () => {
|
||||
env.URL = sharedEnv.URL = "https://app.outline.dev";
|
||||
env.DEPLOYMENT = "hosted";
|
||||
|
||||
await buildTeam({
|
||||
guestSignin: true,
|
||||
subdomain: "example",
|
||||
@@ -181,9 +174,6 @@ describe("#auth.config", () => {
|
||||
});
|
||||
|
||||
it("should not return provider when disabled", async () => {
|
||||
env.URL = sharedEnv.URL = "https://app.outline.dev";
|
||||
env.DEPLOYMENT = "hosted";
|
||||
|
||||
await buildTeam({
|
||||
guestSignin: false,
|
||||
subdomain: "example",
|
||||
@@ -206,8 +196,9 @@ describe("#auth.config", () => {
|
||||
});
|
||||
|
||||
describe("self hosted", () => {
|
||||
beforeEach(setSelfHosted);
|
||||
|
||||
it("should return all configured providers but respect email setting", async () => {
|
||||
env.DEPLOYMENT = "";
|
||||
await buildTeam({
|
||||
guestSignin: false,
|
||||
authenticationProviders: [
|
||||
@@ -227,7 +218,6 @@ describe("#auth.config", () => {
|
||||
});
|
||||
|
||||
it("should return email provider for team when guest signin enabled", async () => {
|
||||
env.DEPLOYMENT = "";
|
||||
await buildTeam({
|
||||
guestSignin: true,
|
||||
authenticationProviders: [
|
||||
|
||||
@@ -26,7 +26,7 @@ router.post("auth.config", async (ctx: APIContext<T.AuthConfigReq>) => {
|
||||
// If self hosted AND there is only one team then that team becomes the
|
||||
// brand for the knowledge base and it's guest signin option is used for the
|
||||
// root login page.
|
||||
if (!env.isCloudHosted()) {
|
||||
if (!env.isCloudHosted) {
|
||||
const team = await Team.scope("withAuthenticationProviders").findOne();
|
||||
|
||||
if (team) {
|
||||
@@ -75,7 +75,7 @@ router.post("auth.config", async (ctx: APIContext<T.AuthConfigReq>) => {
|
||||
|
||||
// If subdomain signin page then we return minimal team details to allow
|
||||
// for a custom screen showing only relevant signin options for that team.
|
||||
else if (env.SUBDOMAINS_ENABLED && domain.teamSubdomain) {
|
||||
else if (env.isCloudHosted && domain.teamSubdomain) {
|
||||
const team = await Team.scope("withAuthenticationProviders").findOne({
|
||||
where: {
|
||||
subdomain: domain.teamSubdomain,
|
||||
@@ -179,7 +179,7 @@ router.post(
|
||||
|
||||
ctx.cookies.set("accessToken", "", {
|
||||
expires: subMinutes(new Date(), 1),
|
||||
domain: getCookieDomain(ctx.hostname),
|
||||
domain: getCookieDomain(ctx.hostname, env.isCloudHosted),
|
||||
});
|
||||
|
||||
ctx.body = {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import env from "@server/env";
|
||||
import { buildEvent, buildUser } from "@server/test/factories";
|
||||
import { seed, getTestServer } from "@server/test/support";
|
||||
import { seed, getTestServer, setCloudHosted } from "@server/test/support";
|
||||
|
||||
const server = getTestServer();
|
||||
|
||||
describe("#events.list", () => {
|
||||
beforeEach(() => {
|
||||
env.DEPLOYMENT = "hosted";
|
||||
});
|
||||
beforeEach(setCloudHosted);
|
||||
|
||||
it("should only return activity events", async () => {
|
||||
const { user, admin, document, collection } = await seed();
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import env from "@server/env";
|
||||
import { TeamDomain } from "@server/models";
|
||||
import { buildAdmin, buildCollection, buildTeam } from "@server/test/factories";
|
||||
import { seed, getTestServer } from "@server/test/support";
|
||||
import {
|
||||
seed,
|
||||
getTestServer,
|
||||
setCloudHosted,
|
||||
setSelfHosted,
|
||||
} from "@server/test/support";
|
||||
|
||||
const server = getTestServer();
|
||||
|
||||
describe("teams.create", () => {
|
||||
it("creates a team", async () => {
|
||||
env.DEPLOYMENT = "hosted";
|
||||
setCloudHosted();
|
||||
|
||||
const team = await buildTeam();
|
||||
const user = await buildAdmin({ teamId: team.id });
|
||||
const res = await server.post("/api/teams.create", {
|
||||
@@ -23,7 +28,8 @@ describe("teams.create", () => {
|
||||
});
|
||||
|
||||
it("requires a cloud hosted deployment", async () => {
|
||||
env.DEPLOYMENT = "";
|
||||
setSelfHosted();
|
||||
|
||||
const team = await buildTeam();
|
||||
const user = await buildAdmin({ teamId: team.id });
|
||||
const res = await server.post("/api/teams.create", {
|
||||
|
||||
Reference in New Issue
Block a user