Skip to content

Commit

Permalink
fix : renderFormRefusedEmail.integration.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitguigal committed Oct 3, 2024
1 parent 9bdd53a commit 022ee5f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ describe("renderFormRefusedEmail", () => {
{ email: emitter.user.email, name: emitter.user.name }
]);
expect(email!.cc).toEqual([
{ email: destination.user.email, name: destination.user.name },
{ email: ttr.user.email, name: ttr.user.name }
{ email: ttr.user.email, name: ttr.user.name },
{ email: destination.user.email, name: destination.user.name }
]);
expect(email!.body).toContain(`<p>
Nous vous informons que la société ${destination.company.name}
Expand Down
7 changes: 4 additions & 3 deletions back/src/forms/mail/renderFormRefusedEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ export async function renderFormRefusedEmail(

const destinationCC = await getMailNotificationSubscribers(
UserNotification.BSD_REFUSAL,
[form.recipientCompanySiret, forwardedIn?.recipientCompanySiret].filter(
Boolean
)
[
form.recipientCompanySiret,
isFinalDestinationRefusal ? forwardedIn?.recipientCompanySiret : null
].filter(Boolean)
);

// include drealsRecipients if settings says so
Expand Down
2 changes: 1 addition & 1 deletion back/src/users/__tests__/database.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "../../__tests__/factories";
import { associateUserToCompany, createUserAccountHash } from "../database";
import { getUserRoles } from "../../permissions";
import { UserNotification, UserRole } from "@prisma/client";
import { UserRole } from "@prisma/client";
import { ALL_NOTIFICATIONS } from "../notifications";

describe("createUserAccountHash", () => {
Expand Down
3 changes: 1 addition & 2 deletions back/src/users/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import {
UserRole,
Prisma,
Company,
UserAccountHash,
UserNotification
UserAccountHash
} from "@prisma/client";
import { hash } from "bcrypt";
import { getUid, sanitizeEmail, hashToken } from "../utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { prisma } from "@td/prisma";
import { AuthType } from "../../../../auth";
import { Mutation } from "../../../../generated/graphql/types";
import { ErrorCode, NotCompanyAdminErrorMsg } from "../../../../common/errors";
import { UserNotification, UserRole } from "@prisma/client";
import { UserRole } from "@prisma/client";
import { templateIds } from "@td/mail";
import { ALL_NOTIFICATIONS } from "../../../notifications";

Expand Down
1 change: 0 additions & 1 deletion back/src/users/resolvers/mutations/changeUserRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
updateCompanyAssociation,
updateUserAccountHash
} from "../../database";
import { UserRole } from "@prisma/client";
import { ALL_NOTIFICATIONS } from "../../notifications";

const changeUserRoleResolver: MutationResolvers["changeUserRole"] = async (
Expand Down

0 comments on commit 022ee5f

Please sign in to comment.