Skip to content

Commit 14311de

Browse files
committed
membership-requests [inveniosoftware#855]: remove unused message from email notification
1 parent 44e2745 commit 14311de

File tree

4 files changed

+16
-42
lines changed

4 files changed

+16
-42
lines changed

Diff for: invenio_communities/templates/semantic-ui/invenio_notifications/community-membership-request.accept.jinja

+4-13
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
{% set community = request.receiver %}
33
{% set created_by = request.created_by %}
44
{% set request_id = request.id %}
5-
{# TODO: Action-based notifications don't pass `message` so this will always be empty #}
6-
{% set message = notification.context.message | safe if notification.context.message else '' %}
5+
{# Attention: Action-based notifications don't pass `message`, but a separate comment notification is sent so this is fine. #}
76
{% set community_title = community.metadata.title %}
87
{# This email is sent to the requester only so omitted requester's name #}
98

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

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

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

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

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

Diff for: invenio_communities/templates/semantic-ui/invenio_notifications/community-membership-request.cancel.jinja

+4-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% set created_by = request.created_by %}
44
{% set requester_name = created_by.username or created_by.profile.full_name %}
55
{% set request_id = request.id %}
6-
{% set message = notification.context.message | safe if notification.context.message else '' %}
6+
{# Attention: Action-based notifications don't pass `message`, but a separate comment notification is sent so this is fine. #}
77
{% set community_title = community.metadata.title %}
88

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

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

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

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

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

Diff for: invenio_communities/templates/semantic-ui/invenio_notifications/community-membership-request.decline.jinja

+4-13
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
{% set community = request.receiver %}
33
{% set created_by = request.created_by %}
44
{% set request_id = request.id %}
5-
{# TODO: Action-based notifications don't pass `message` so this will always be empty #}
6-
{% set message = notification.context.message | safe if notification.context.message else '' %}
5+
{# Attention: Action-based notifications don't pass `message`, but a separate notification is sent so this is fine. #}
76
{% set community_title = community.metadata.title %}
87
{# This email is sent to the requester only so omitted requester's name #}
98

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

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

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

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

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

Diff for: invenio_communities/templates/semantic-ui/invenio_notifications/community-membership-request.expire.jinja

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% set community_title = community.metadata.title %}
66
{% set requester_name = requester.username or requester.profile.full_name %}
77

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

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

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

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

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

0 commit comments

Comments
 (0)