mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-22 19:41:53 +03:00
fix(domain-manager): prioritize non-seed workspaces in selection
Updated workspace selection logic to prioritize non-seed workspaces. Returns a seed workspace only if no non-seed workspaces are available to improve filtering consistency and avoid unintended behavior.
This commit is contained in:
parent
53576245aa
commit
6e87a86d67
@ -12,6 +12,10 @@ import {
|
||||
import { getDomainNameByEmail } from 'src/utils/get-domain-name-by-email';
|
||||
import { isDefined } from 'src/utils/is-defined';
|
||||
import { isWorkEmail } from 'src/utils/is-work-email';
|
||||
import {
|
||||
SEED_ACME_WORKSPACE_ID,
|
||||
SEED_APPLE_WORKSPACE_ID,
|
||||
} from 'src/database/typeorm-seeds/core/workspaces';
|
||||
|
||||
@Injectable()
|
||||
export class DomainManagerService {
|
||||
@ -153,7 +157,14 @@ export class DomainManagerService {
|
||||
);
|
||||
}
|
||||
|
||||
return workspaces[0];
|
||||
const nonSeedWorkspace = workspaces.find(
|
||||
(workspace) =>
|
||||
![SEED_APPLE_WORKSPACE_ID, SEED_ACME_WORKSPACE_ID].includes(
|
||||
workspace.id,
|
||||
),
|
||||
);
|
||||
|
||||
return nonSeedWorkspace ?? workspaces[workspaces.length - 1];
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
|
Loading…
Reference in New Issue
Block a user