|
8 | 8 | from typing import Self, assert_never |
9 | 9 |
|
10 | 10 | from markupsafe import Markup, escape |
| 11 | +from urllib.parse import urlencode |
11 | 12 |
|
12 | 13 | from couchers import urls |
13 | 14 | from couchers.config import config |
@@ -513,7 +514,7 @@ def get_body_blocks(self, loc_context: LocalizationContext) -> list[EmailBlock]: |
513 | 514 | builder.para(".invoice_receipt_info") |
514 | 515 | builder.action(self.receipt_url, ".download_invoice") |
515 | 516 | builder.para(".tax_acknowledgment") |
516 | | - builder.para(".questions_contact") |
| 517 | + builder.para(".questions_contact", { "email": _email_link_markup("donations@couchers.org")}) |
517 | 518 | builder.para(".generosity_helps") |
518 | 519 | builder.para(".thank_you") |
519 | 520 | builder.para("generic.founders_signature") |
@@ -1665,14 +1666,20 @@ def get_body_blocks(self, loc_context: LocalizationContext) -> list[EmailBlock]: |
1665 | 1666 | builder.para(".link", {"url": urls.app_link()}) |
1666 | 1667 | builder.para(".platform_under_development") |
1667 | 1668 | builder.para(".thanks_for_joining") |
1668 | | - builder.para(".signature") |
| 1669 | + builder.para(".signature", { |
| 1670 | + "email_link": _email_link_markup("aapeliv@couchers.org"), |
| 1671 | + "profile_link": _link_markup("https://couchers.org/user/aapeli") |
| 1672 | + }) |
1669 | 1673 | else: |
1670 | 1674 | builder.para(".intro") |
1671 | 1675 | builder.para(".fill_in_profile") |
1672 | 1676 | builder.action(edit_profile_url, ".edit_profile_action") |
1673 | 1677 | builder.para(".no_empty_accounts") |
1674 | 1678 | builder.para(".profile_importance") |
1675 | | - builder.para(".signature") |
| 1679 | + builder.para(".signature", { |
| 1680 | + "email_link": _email_link_markup("community@couchers.org"), |
| 1681 | + "profile_link": _link_markup("https://couchers.org/user/emily") |
| 1682 | + }) |
1676 | 1683 | return builder.build() |
1677 | 1684 |
|
1678 | 1685 | @classmethod |
@@ -2039,3 +2046,12 @@ def test_instances(cls) -> list[Self]: |
2039 | 2046 |
|
2040 | 2047 | def _localize_host_request_date(value: date, loc_context: LocalizationContext) -> str: |
2041 | 2048 | return loc_context.localize_date(value, with_year=False, with_day_of_week=True) |
| 2049 | + |
| 2050 | +def _email_link_markup(email: str, subject: str | None = None) -> Markup: |
| 2051 | + url = f"mailto:{email}" |
| 2052 | + if subject: |
| 2053 | + url += f"?subject={urlencode(subject)}" |
| 2054 | + return _link_markup(url, text=email) |
| 2055 | + |
| 2056 | +def _link_markup(url: str, *, text: str | None = None) -> Markup: |
| 2057 | + return Markup(f'<a href="{escape(url)}">{escape(text or url)}</a>') |
0 commit comments