fix: A user joining from invite link of a team doesn't automatically become member of the org (#12774)
* fix: Add org membership when invite link for a team in an org is generated * Run tests sequentially till we fix emails fixture
This commit is contained in:
1 parent
7d2500a32f
commit
a28e8ff39b
16 files changed
+549
-240
No files matched your search
@@ -95,13 +95,22 @@ export const validateAndGetCorrectedUsernameInTeam = async (
|
||||
select: {
|
||||
metadata: true,
|
||||
parentId: true,
|
||||
parent: {
|
||||
select: {
|
||||
metadata: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log("validateAndGetCorrectedUsernameInTeam", {
|
||||
teamId,
|
||||
team,
|
||||
});
|
||||
const teamData = { ...team, metadata: teamMetadataSchema.parse(team?.metadata) };
|
||||
|
||||
if (teamData.metadata?.isOrganization || teamData.parentId) {
|
||||
const orgMetadata = teamData.metadata;
|
||||
const organization = teamData.metadata?.isOrganization ? teamData : teamData.parent;
|
||||
if (organization) {
|
||||
const orgMetadata = teamMetadataSchema.parse(organization.metadata);
|
||||
// Organization context -> org-context username check
|
||||
const orgId = teamData.parentId || teamId;
|
||||
return validateAndGetCorrectedUsernameAndEmail({
|
||||
|
||||
Reference in new issue
Block a user