Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ export const DeploymentsApp = {
organizationName: user.organizations.find(
(o) => o.id === user.selected_organization_id
).name,
userName: `${user.first_name} ${user.last_name}`,
userName:
user.first_name && user.last_name
? `${user.first_name} ${user.last_name}`
: `${user.email}`,
userEmail: user.email,
region: input.region,
activitySector: input.activity_sector,
Expand Down
46 changes: 46 additions & 0 deletions apps/portal-api/src/modules/users/users.organization.app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,52 @@ describe('UsersOrganizationApp', () => {
userEmailList:
'<li>John Doe (user1@test.com)</li><li>Robert Smith (user2@test.com)</li>',
userCount: 2,
requestLabel: 'requests',
},
template: 'organization_pending_user_digest',
to: 'admin@filigran.io',
});
});

it('should send email to each organization administrators with the correct grammary', async () => {
portalConfig.enabled_emails = {
...originalEnabledEmails,
pending_user_digest: true,
};

vi.spyOn(
UserOrganizationPendingDomain,
'loadOrganizationsWithPendingUsers'
).mockResolvedValue([
{
id: PLATFORM_ORGANIZATION_UUID,
name: 'organization name',
users: [
{
id: uuidv4() as UserId,
email: 'user1@test.com',
first_name: 'John',
last_name: 'Doe',
} as User,
],
},
] as Awaited<
ReturnType<
(typeof UserOrganizationPendingDomain)['loadOrganizationsWithPendingUsers']
>
>);

const sendMailSpy = vi.spyOn(MailService, 'sendMail');
await UsersOrganizationApp.sendPendingUsersDigest();

expect(sendMailSpy).toHaveBeenCalledTimes(1);
expect(sendMailSpy).toHaveBeenCalledWith({
params: {
adminName: 'Firstname',
organizationName: 'organization name',
userEmailList: '<li>John Doe (user1@test.com)</li>',
userCount: 1,
requestLabel: 'request',
},
template: 'organization_pending_user_digest',
to: 'admin@filigran.io',
Expand Down
2 changes: 2 additions & 0 deletions apps/portal-api/src/modules/users/users.organization.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export const UsersOrganizationApp = {
)
.join(''),
userCount: organization.users.length,
requestLabel:
organization.users.length === 1 ? 'request' : 'requests',
},
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -108,10 +116,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
1 change: 1 addition & 0 deletions apps/portal-api/src/server/mail-template/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface OrganizationPendingUserDigestModel {
organizationName: string;
userEmailList: string;
userCount: number;
requestLabel: string;
}

export interface PlatformUnregisteredModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -105,10 +113,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -108,10 +116,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -108,10 +116,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
21 changes: 20 additions & 1 deletion apps/portal-api/src/server/mail-template/openaev_scenarios.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -105,10 +113,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -105,10 +113,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -105,10 +113,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
line-height: 32px !important;
}
}
@media (prefers-color-scheme: dark) {
.logo-light {
display: none !important;
}
.logo-dark {
display: block !important;
}
}
</style>
</head>
<body
Expand Down Expand Up @@ -105,10 +113,21 @@
">
<a href="{{ base_url_front }}">
<img
src="{{ base_url_front }}/logo.png"
src="{{ base_url_front }}/logo_xtm_hub_light.svg"
class="logo-light"
width="320"
alt="XTM Hub logo"
style="max-width: 100%; vertical-align: middle" />
<img
src="{{ base_url_front }}/logo_xtm_hub_dark.svg"
class="logo-dark"
width="320"
alt="XTM Hub logo"
style="
display: none;
max-width: 100%;
vertical-align: middle;
" />
</a>
</div>
<table
Expand Down
Loading
Loading