Skip to content

Commit f272e95

Browse files
authored
🎨 Feature: on share project email (#7455)
1 parent 11a7e7b commit f272e95

27 files changed

+115
-24
lines changed

packages/notifications-library/src/notifications_library/_email_render.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class EmailPartsTuple(NamedTuple):
14-
suject: str
14+
subject: str
1515
text_content: str
1616
html_content: str | None
1717

@@ -58,5 +58,5 @@ def render_email_parts(
5858
html_content = None
5959

6060
return EmailPartsTuple(
61-
suject=subject, text_content=text_content, html_content=html_content
61+
subject=subject, text_content=text_content, html_content=html_content
6262
)

packages/notifications-library/src/notifications_library/_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,23 @@ class JinjaTemplateDbGet:
1616

1717
@dataclass(frozen=True)
1818
class UserData:
19+
user_name: str
1920
first_name: str
2021
last_name: str
2122
email: str
2223

2324

25+
@dataclass(frozen=True)
26+
class SharerData:
27+
user_name: str
28+
message: str
29+
30+
2431
@dataclass(frozen=True)
2532
class ProductUIData:
2633
logo_url: str
2734
strong_color: str
35+
project_alias: str
2836

2937

3038
@dataclass(frozen=True)

packages/notifications-library/src/notifications_library/_repository.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class UsersRepo(_BaseRepo):
2525
async def get_user_data(self, user_id: UserID) -> UserData:
2626
query = sa.select(
2727
# NOTE: careful! privacy applies here!
28+
users.c.name,
2829
users.c.first_name,
2930
users.c.last_name,
3031
users.c.email,
@@ -38,7 +39,10 @@ async def get_user_data(self, user_id: UserID) -> UserData:
3839
raise ValueError(msg)
3940

4041
return UserData(
41-
first_name=row.first_name, last_name=row.last_name, email=row.email
42+
user_name=row.name,
43+
first_name=row.first_name,
44+
last_name=row.last_name,
45+
email=row.email,
4246
)
4347

4448

packages/notifications-library/src/notifications_library/templates/on_change_email.email.content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends 'base.html' %}
22
{% block title %} {% include 'on_change_email.email.subject.txt' %} {% endblock %}
33
{% block content %}
4-
<p>Dear {{ user.first_name }},</p>
4+
<p>Dear {{ user.first_name or user.user_name }},</p>
55
<p>
66
You have requested to change the email address linked to your {{ product.display_name }} account.
77
Please follow the on-screen information in the link below:

packages/notifications-library/src/notifications_library/templates/on_change_email.email.content.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Dear {{ user.first_name }},
1+
Dear {{ user.first_name or user.user_name }},
22

33
You have requested to change the email address linked to your {{ product.display_name }} account. Please follow the on-screen information in the link below:
44

packages/notifications-library/src/notifications_library/templates/on_new_code.email.content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends 'base.html' %}
22
{% block title %} {% include 'on_new_code.email.subject.txt' %} {% endblock %}
33
{% block content %}
4-
<p>Dear {{ user.first_name }},</p>
4+
<p>Dear {{ user.first_name or user.user_name }},</p>
55
<p>Please find below the Two-factor Authentication sign-in code for your {{ host }} account.</p>
66

77
<p>

packages/notifications-library/src/notifications_library/templates/on_new_code.email.content.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Dear {{ user.first_name }},
1+
Dear {{ user.first_name or user.user_name }},
22

33
Please find below the Two-factor Authentication sign-in code for your {{ host }} account.
44

packages/notifications-library/src/notifications_library/templates/on_new_invitation.email.content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends 'base.html' %}
22
{% block title %} {% include 'on_new_invitation.email.subject.txt' %} {% endblock %}
33
{% block content %}
4-
<p>Dear {{ user.first_name }},</p>
4+
<p>Dear {{ user.first_name or user.user_name }},</p>
55
<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>
66
<p>
77
<!-- Many email clients strip or ignore certain CSS properties, including them inline -->

packages/notifications-library/src/notifications_library/templates/on_new_invitation.email.content.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Dear {{ user.first_name }},
1+
Dear {{ user.first_name or user.user_name }},
22

33
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.
44

packages/notifications-library/src/notifications_library/templates/on_payed.email.content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{% block content %}
66

7-
<p>Dear {{ user.first_name }},</p>
7+
<p>Dear {{ user.first_name or user.user_name }},</p>
88
<p>We are delighted to confirm the successful processing of your payment of <strong>{{ payment.price_dollars }}</strong> <strong><em>USD</em></strong> for the purchase of <strong>{{ payment.osparc_credits }}</strong> <strong><em>credits</em></strong>.
99
The credits have been added to your {{ product.display_name }} account, and you are all set to utilize them.</p>
1010
<p>For more details you can view or download your <a href="{{ payment.invoice_url }}">receipt</a>.</p>

0 commit comments

Comments
 (0)