Skip to content

Commit

Permalink
membership-requests [inveniosoftware#855]: remove unused message from…
Browse files Browse the repository at this point in the history
… email notification
  • Loading branch information
fenekku committed Jul 30, 2024
1 parent 08b8d4d commit 5bc4e7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
{% set community = request.receiver %}
{% set created_by = request.created_by %}
{% set request_id = request.id %}
{# TODO: Action-based notifications don't pass `message` so this will always be empty #}
{% set message = notification.context.message | safe if notification.context.message else '' %}
{# Attention: Action-based notifications don't pass `message`, but a separate comment notification is sent so this is fine. #}
{% set community_title = community.metadata.title %}
{# This email is sent to the requester only so omitted requester's name #}

Expand All @@ -20,15 +19,9 @@ and not publicly exposed so ok to refer to it directly for now #}
{%- block html_body -%}
<table style="font-family:'Lato',Helvetica,Arial,sans-serif;border-spacing:15px">
<tr>
<td>{{ _("The membership request to join the community '{community_title}' was accepted").format(community_title=community_title) }}
{% if message %}{{ _(" with the following message:")}}{% endif %}
<td>{{ _("The membership request to join the community '{community_title}' was accepted").format(community_title=community_title) }}.
</td>
</tr>
<tr>
{% if message %}
<td><em>"{{message}}"</em></td>
{% endif %}
</tr>
<tr>
<td><a href="{{ request_link }}" class="button">{{ _("Check out the membership request")}}</a></td>
</tr>
Expand All @@ -42,16 +35,14 @@ and not publicly exposed so ok to refer to it directly for now #}
{%- endblock html_body %}

{%- block plain_body -%}
{{ _("The membership request to join the community '{community_title}' was accepted").format(community_title=community_title) }}
{% if message %}{{ _("with the following message:")}} {{message}}{% endif %}
{{ _("The membership request to join the community '{community_title}' was accepted").format(community_title=community_title) }}.

{{ _("Check out the membership request:") }} {{ request_link }}
{%- endblock plain_body %}

{# Markdown for Slack/Mattermost/chat #}
{%- block md_body -%}
{{ _("The membership request to join the community *{community_title}* was accepted").format(community_title=community_title) }}
{% if message %}{{ _("with the following message:")}} {{ message }}{% endif %}
{{ _("The membership request to join the community *{community_title}* was accepted").format(community_title=community_title) }}.

[{{ _("Check out the membership request") }}]({{ request_link }})
{%- endblock md_body %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% set created_by = request.created_by %}
{% set requester_name = created_by.username or created_by.profile.full_name %}
{% set request_id = request.id %}
{% set message = notification.context.message | safe if notification.context.message else '' %}
{# Attention: Action-based notifications don't pass `message`, but a separate comment notification is sent so this is fine. #}
{% set community_title = community.metadata.title %}

{# WARNING: this uses a config set by invenio-app-rdm (not a dependency) to at least not hardcode the URL #}
Expand All @@ -19,15 +19,9 @@
{%- block html_body -%}
<table style="font-family:'Lato',Helvetica,Arial,sans-serif;border-spacing:15px">
<tr>
<td>{{ _("The membership request for '@{requester_name}' to join the community '{community_title}' was cancelled").format(requester_name=requester_name, community_title=community_title) }}
{% if message %}{{ _(" with the following message:")}}{% endif %}
<td>{{ _("The membership request for '@{requester_name}' to join the community '{community_title}' was cancelled").format(requester_name=requester_name, community_title=community_title) }}.
</td>
</tr>
<tr>
{% if message %}
<td><em>"{{message}}"</em></td>
{% endif %}
</tr>
<tr>
<td><a href="{{ request_link }}" class="button">{{ _("Check out the membership request")}}</a></td>
</tr>
Expand All @@ -41,16 +35,14 @@
{%- endblock html_body %}

{%- block plain_body -%}
{{ _("The membership request for '@{requester_name}' to join the community '{community_title}' was cancelled").format(requester_name=requester_name, community_title=community_title) }}
{% if message %}{{ _(" with the following message:")}} {{ message }}{% endif %}
{{ _("The membership request for '@{requester_name}' to join the community '{community_title}' was cancelled").format(requester_name=requester_name, community_title=community_title) }}.

{{ _("Check out the membership request:") }} {{ request_link }}
{%- endblock plain_body %}

{# Markdown for Slack/Mattermost/chat #}
{%- block md_body -%}
{{ _("The membership_request for *@{requester_name}* to join the community *{community_title}* was cancelled").format(requester_name=requester_name, community_title=community_title) }}
{% if message %}{{ _("with the following message:")}} {{message}}{% endif %}
{{ _("The membership_request for *@{requester_name}* to join the community *{community_title}* was cancelled").format(requester_name=requester_name, community_title=community_title) }}.

[{{ _("Check out the membership request") }}]({{ request_link }})
{%- endblock md_body %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
{% set community = request.receiver %}
{% set created_by = request.created_by %}
{% set request_id = request.id %}
{# TODO: Action-based notifications don't pass `message` so this will always be empty #}
{% set message = notification.context.message | safe if notification.context.message else '' %}
{# Attention: Action-based notifications don't pass `message`, but a separate notification is sent so this is fine. #}
{% set community_title = community.metadata.title %}
{# This email is sent to the requester only so omitted requester's name #}

Expand All @@ -20,15 +19,9 @@ and not publicly exposed so ok to refer to it directly for now #}
{%- block html_body -%}
<table style="font-family:'Lato',Helvetica,Arial,sans-serif;border-spacing:15px">
<tr>
<td>{{ _("The membership request to join the community '{community_title}' was declined").format(community_title=community_title) }}
{% if message %}{{ _(" with the following message:")}}{% endif %}
<td>{{ _("The membership request to join the community '{community_title}' was declined").format(community_title=community_title) }}.
</td>
</tr>
<tr>
{% if message %}
<td><em>"{{message}}"</em></td>
{% endif %}
</tr>
<tr>
<td><a href="{{ request_link }}" class="button">{{ _("Check out the membership request")}}</a></td>
</tr>
Expand All @@ -42,16 +35,14 @@ and not publicly exposed so ok to refer to it directly for now #}
{%- endblock html_body %}

{%- block plain_body -%}
{{ _("The membership request to join the community '{community_title}' was declined").format(community_title=community_title) }}
{% if message %}{{ _("with the following message:")}} {{message}}{% endif %}
{{ _("The membership request to join the community '{community_title}' was declined").format(community_title=community_title) }}.

{{ _("Check out the membership request:") }} {{ request_link }}
{%- endblock plain_body %}

{# Markdown for Slack/Mattermost/chat #}
{%- block md_body -%}
{{ _("The membership request to join the community *{community_title}* was declined").format(community_title=community_title) }}
{% if message %}{{ _("with the following message:")}} {{ message }}{% endif %}
{{ _("The membership request to join the community *{community_title}* was declined").format(community_title=community_title) }}.

[{{ _("Check out the membership request") }}]({{ request_link }})
{%- endblock md_body %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% set community_title = community.metadata.title %}
{% set requester_name = requester.username or requester.profile.full_name %}

{# TODO: Can we choose URL based on receiver? #}
{# TODO: Can we choose URL based on email receiver? #}
{# WARNING: this uses a config set by invenio-app-rdm (not a dependency) to at least not hardcode the URL #}
{# invenio-app-rdm should have been using REQUESTS_ROUTES a config of a dependency however. #}
{% set request_link_path = config.RDM_REQUESTS_ROUTES["community-dashboard-request-details"].lstrip("/") %}
Expand All @@ -20,7 +20,7 @@
{%- block html_body -%}
<table style="font-family:'Lato',Helvetica,Arial,sans-serif;border-spacing:15px">
<tr>
<td>{{ _("The membership request for '@{requester_name}' to join the community '{community_title}' expired.").format(requester_name=requester_name, community_title=community_title) }}</td>
<td>{{ _("The membership request for '@{requester_name}' to join the community '{community_title}' expired").format(requester_name=requester_name, community_title=community_title) }}.</td>
</tr>
<tr>
<td><a href="{{ request_link }}" class="button">{{ _("Check out the membership request")}}</a></td>
Expand All @@ -35,14 +35,14 @@
{%- endblock html_body %}

{%- block plain_body -%}
{{ _("The membership request for @{requester_name} to join community '{community_title}' expired.").format(requester_name=requester_name, community_title=community_title) }}
{{ _("The membership request for @{requester_name} to join community '{community_title}' expired").format(requester_name=requester_name, community_title=community_title) }}.

{{ _("Check out the membership request:") }} {{ request_link }}
{%- endblock plain_body %}

{# Markdown for Slack/Mattermost/chat #}
{%- block md_body -%}
{{ _("The membership request for *@{requester_name}* to join community *{community_title}* expired.").format(requester_name=requester_name, community_title=community_title) }}
{{ _("The membership request for *@{requester_name}* to join community *{community_title}* expired").format(requester_name=requester_name, community_title=community_title) }}.

[{{ _("Check out the membership request") }}]({{ request_link }})
{%- endblock md_body %}

0 comments on commit 5bc4e7d

Please sign in to comment.