-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
membership-requests [#855]: notify on membership-request changes
- Loading branch information
Showing
10 changed files
with
686 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...ies/templates/semantic-ui/invenio_notifications/community-membership-request.accept.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{% set request = notification.context.request %} | ||
{% 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 '' %} | ||
{% set community_title = community.metadata.title %} | ||
{# This email is sent to the requester only so omitted requester's name #} | ||
|
||
{# TODO: use request.links.self_html when this issue is resolved: https://github.com/inveniosoftware/invenio-rdm-records/issues/1327 #} | ||
{% set request_link = "{ui}/me/requests/{id}".format(ui=config.SITE_UI_URL, id=request_id) %} | ||
{# "/account/settings/notifications" is hardcoded in invenio-notifications | ||
and not publicly exposed so ok to refer to it directly for now #} | ||
{% set account_settings_link = "{ui}/account/settings/notifications".format(ui=config.SITE_UI_URL) %} | ||
|
||
{%- block subject -%} | ||
{{ _("✅ Request to join the community '{community_title}' was accepted").format(community_title=community_title) }} | ||
{%- endblock subject -%} | ||
|
||
{%- 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> | ||
</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> | ||
<tr> | ||
<td><strong>_</strong></td> | ||
</tr> | ||
<tr> | ||
<td style="font-size:smaller">{{ _("This is an auto-generated message. To manage notifications, visit your")}} <a href="{{account_settings_link}}">{{ _("account settings")}}</a>.</td> | ||
</tr> | ||
</table> | ||
{%- 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 %} | ||
|
||
{{ _("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 %} | ||
|
||
[{{ _("Check out the membership request") }}]({{ request_link }}) | ||
{%- endblock md_body %} |
56 changes: 56 additions & 0 deletions
56
...ies/templates/semantic-ui/invenio_notifications/community-membership-request.cancel.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{% set request = notification.context.request %} | ||
{% set community = request.receiver %} | ||
{% 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 '' %} | ||
{% 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 #} | ||
{# 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("/") %} | ||
{% set request_link_path = request_link_path.replace("<pid_value>", community.id).replace("<request_pid_value>", request_id) %} | ||
{% set request_link = "{ui}/{request_link_path}".format(ui=config.SITE_UI_URL, request_link_path=request_link_path) %} | ||
|
||
{%- block subject -%} | ||
{{ _("❌ Request for '@{requester_name}' to join the community '{community_title}' was cancelled").format(requester_name=requester_name, community_title=community_title) }} | ||
{%- endblock subject -%} | ||
|
||
{%- 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> | ||
</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> | ||
<tr> | ||
<td><strong>_</strong></td> | ||
</tr> | ||
<tr> | ||
<td style="font-size:smaller">{{ _("This is an auto-generated message. To manage notifications, visit your")}} <a href="{{account_settings_link}}">{{ _("account settings")}}</a>.</td> | ||
</tr> | ||
</table> | ||
{%- 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 %} | ||
|
||
{{ _("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 %} | ||
|
||
[{{ _("Check out the membership request") }}]({{ request_link }}) | ||
{%- endblock md_body %} |
57 changes: 57 additions & 0 deletions
57
...es/templates/semantic-ui/invenio_notifications/community-membership-request.decline.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{% set request = notification.context.request %} | ||
{% 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 '' %} | ||
{% set community_title = community.metadata.title %} | ||
{# This email is sent to the requester only so omitted requester's name #} | ||
|
||
{# TODO: use request.links.self_html when this issue is resolved: https://github.com/inveniosoftware/invenio-rdm-records/issues/1327 #} | ||
{% set request_link = "{ui}/me/requests/{id}".format(ui=config.SITE_UI_URL, id=request_id) %} | ||
{# "/account/settings/notifications" is hardcoded in invenio-notifications | ||
and not publicly exposed so ok to refer to it directly for now #} | ||
{% set account_settings_link = "{ui}/account/settings/notifications".format(ui=config.SITE_UI_URL) %} | ||
|
||
{%- block subject -%} | ||
{{ _("⛔️ Request to join the community '{community_title}' was declined").format(community_title=community_title) }} | ||
{%- endblock subject -%} | ||
|
||
{%- 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> | ||
</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> | ||
<tr> | ||
<td><strong>_</strong></td> | ||
</tr> | ||
<tr> | ||
<td style="font-size:smaller">{{ _("This is an auto-generated message. To manage notifications, visit your")}} <a href="{{account_settings_link}}">{{ _("account settings")}}</a>.</td> | ||
</tr> | ||
</table> | ||
{%- 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 %} | ||
|
||
{{ _("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 %} | ||
|
||
[{{ _("Check out the membership request") }}]({{ request_link }}) | ||
{%- endblock md_body %} |
Oops, something went wrong.