mirror of
https://github.com/outline/outline.git
synced 2026-12-01 01:14:11 +03:00
refactor
This commit is contained in:
1 parent
9f55b46204
commit
b097ac4be6
2 files changed
+7
-3
No files matched your search
@@ -147,10 +147,12 @@ router.get("*", shareDomains(), async (ctx, next) => {
|
||||
}
|
||||
|
||||
// Redirect if subdomain is not the current team's subdomain
|
||||
if (team?.subdomain && !ctx.hostname.startsWith(team.subdomain)) {
|
||||
if (team?.subdomain) {
|
||||
const { teamSubdomain } = parseDomain(ctx.href);
|
||||
ctx.redirect(ctx.href.replace(teamSubdomain, team.subdomain));
|
||||
return;
|
||||
if (team?.subdomain !== teamSubdomain) {
|
||||
ctx.redirect(ctx.href.replace(teamSubdomain, team.subdomain));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const analytics = team
|
||||
|
||||
@@ -127,6 +127,8 @@ export async function getTeamFromContext(ctx: Context) {
|
||||
} else if (domain.custom) {
|
||||
team = await Team.findOne({ where: { domain: domain.host } });
|
||||
} else if (domain.teamSubdomain) {
|
||||
// Preference is always given to the team with the subdomain currently
|
||||
// otherwise we can try and find a team that previously used the subdomain.
|
||||
team =
|
||||
(await Team.findOne({
|
||||
where: { subdomain: domain.teamSubdomain },
|
||||
|
||||
Reference in new issue
Block a user