Skip to content

Commit

Permalink
♻️ (organization): use let instead of duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Sep 2, 2024
1 parent bea48b2 commit d7a8dce
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/managers/organization/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,24 @@ export const joinOrganization = async ({
});
}

if (!CRISP_WEBSITE_ID) {
let ticket_id = null;
if (CRISP_WEBSITE_ID) {
ticket_id = await startCripsConversation({
content: unableToAutoJoinOrganizationMd({
libelle: cached_libelle || siret,
}),
email,
nickname: `${given_name} ${family_name}`,
subject: `[MonComptePro] Demande pour rejoindre ${cached_libelle || siret}`,
});
} else {
logger.info(
`unable_to_auto_join_organization_md mail not send to ${email}:`,
);
logger.info({
libelle: cached_libelle || siret,
});

const { id: moderation_id } = await createModeration({
user_id,
organization_id,
type: "organization_join_block",
ticket_id: null,
});
throw new UnableToAutoJoinOrganizationError(moderation_id);
}
const ticket_id = await startCripsConversation({
content: unableToAutoJoinOrganizationMd({
libelle: cached_libelle || siret,
}),
email,
nickname: `${given_name} ${family_name}`,
subject: `[MonComptePro] Demande pour rejoindre ${cached_libelle || siret}`,
});

const { id: moderation_id } = await createModeration({
user_id,
Expand Down

0 comments on commit d7a8dce

Please sign in to comment.