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 @@ -30,9 +30,13 @@ class SharerData:

@dataclass(frozen=True)
class ProductUIData:
logo_url: str
strong_color: str
project_alias: str
logo_url: str | None = (
None # default_logo = "https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-white.svg" in base.html
)
strong_color: str | None = (
None # default_strong_color = "rgb(131, 0, 191)" in base.html
)


@dataclass(frozen=True)
Expand All @@ -41,5 +45,5 @@ class ProductData:
display_name: str
vendor_display_inline: str
support_email: str
homepage_url: str
homepage_url: str | None # default_homepage = "https://osparc.io/" in base.html
ui: ProductUIData
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends 'base.html' %}
{% block title %} {% include 'on_account_approved.email.subject.txt' %} {% endblock %}
{% block content %}
<p>Dear {{ user.first_name or user.user_name }},</p>

<p>
Thank you for your interest in {{ product.display_name }}. We are pleased to provide you with a one-time invitation link to register on the platform.
</p>

<p>
Click <a href="{{ link }}">here</a> to access the registration page.
</p>

<p>
Please follow the on-screen information and proceed with your registration. If any problem should occur, please feel free to contact us at <a href="mailto:{{ product.support_email }}">{{ product.support_email }}</a>.
</p>

<p>Enjoy {{ product.display_name }}!</p>

<p>Best regards,</p>

<p>The {{ product.display_name }} Team</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Dear {{ user.first_name or user.user_name }},

Thank you for your interest in {{ product.display_name }} . We are pleased to provide you with a one-time invitation link to register on the platform.

Click {{ link }} to access the registration page.

Please follow the on-screen information and proceed with your registration. If any problem should occur, please feel free to contact us at {{ product.support_email }}.

Enjoy {{ product.display_name }} !

Best regards,

The {{ product.display_name }} Team
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Your Registration Request for {{ product.display_name }} Has Been Accepted

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'base.html' %}
{% block title %} {% include 'on_account_rejected.email.subject.txt' %} {% endblock %}
{% block content %}
<p>Dear {{ user.first_name or user.user_name }},</p>

<p>
Thank you for your interest in {{ product.display_name }}. Unfortunately, your registration is not eligible for participation in this program.
</p>

<p>
In case of further interest in this or other solutions we might offer, please contact us at <a href="mailto:{{ product.support_email }}">{{ product.support_email }}</a>.
</p>

<p>Best regards,</p>

<p>The {{ product.display_name }} Team</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dear {{ user.first_name or user.user_name }},

Thank you for your interest in {{ product.display_name }}. Unfortunately, your registration is not eligible for participation in this program.

In case of further interest in this or other solutions we might offer, please check contact us at {{ product.support_email }}.

Best regards,
The {{ product.display_name }} Team
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Your Registration Request for {{ product.display_name }} Has Been Denied
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% block title %} {% include 'on_account_form.email.subject.txt' %} {% endblock %}
{% block title %} {% include 'on_account_requested.email.subject.txt' %} {% endblock %}
{% block content %}
<p>Dear Support team

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Request for an Account in {{ product.display_name }}.
13 changes: 6 additions & 7 deletions packages/notifications-library/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,20 @@ def product_data(
) -> ProductData:
vendor: Vendor = product["vendor"]

vendor_ui = vendor.get("ui", {})

product_ui = ProductUIData(
logo_url=vendor.get("ui", {}).get(
"logo_url",
"https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-white.svg",
),
strong_color=vendor.get("ui", {}).get("strong_color", "rgb(131, 0, 191)"),
project_alias=vendor.get("ui", {}).get("project_alias", "project"),
logo_url=vendor_ui.get("logo_url"),
strong_color=vendor_ui.get("strong_color"),
project_alias=vendor_ui["project_alias"],
)

return ProductData( # type: ignore
product_name=product_name,
display_name=product["display_name"],
vendor_display_inline=f"{vendor.get('name','')}, {vendor.get('address','')}",
support_email=product["support_email"],
homepage_url=vendor.get("url", "https://osparc.io/"),
homepage_url=vendor.get("url"),
ui=product_ui,
)

Expand Down
17 changes: 14 additions & 3 deletions packages/notifications-library/tests/email/test_email_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def event_extra_data( # noqa: PLR0911
host_url = f"https://{product_name}.io"

match event_name:
case "on_account_form":
case "on_account_requested":
return {
"host": host_url,
"name": "support-team",
Expand All @@ -106,6 +106,15 @@ def event_extra_data( # noqa: PLR0911
"ipinfo": ipinfo,
"dumps": functools.partial(_safe_json_dumps, indent=1),
}
case "on_account_rejected":
return {
"host": host_url,
}
case "on_account_approved":
return {
"host": host_url,
"link": f"{host_url}?invitation={code}",
}
case "on_change_email":
return {
"host": host_url,
Expand Down Expand Up @@ -173,7 +182,9 @@ def event_attachments(event_name: str, faker: Faker) -> list[tuple[bytes, str]]:
@pytest.mark.parametrize(
"event_name",
[
"on_account_form",
"on_account_approved",
"on_account_requested",
"on_account_rejected",
"on_change_email",
"on_new_code",
"on_new_invitation",
Expand Down Expand Up @@ -252,7 +263,7 @@ async def test_email_event(
@pytest.mark.parametrize(
"event_name",
[
"on_account_form",
"on_account_requested",
],
)
async def test_email_with_reply_to(
Expand Down
2 changes: 1 addition & 1 deletion packages/notifications-library/tests/test__templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@pytest.mark.parametrize(
"event_name",
[
"on_account_form",
"on_account_requested",
"on_change_email",
"on_new_code",
"on_new_invitation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def random_product(
invitation_form=fake.boolean(),
address=fake.address().replace("\n", ". "),
ui=VendorUI(
logo_url=fake.url(),
logo_url="https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-black.svg",
strong_color=fake.color(),
project_alias=fake.random_element(elements=["project", "study"]),
),
Expand Down
Loading