-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
notifications: add comment notification for record and membership
- Loading branch information
1 parent
8192aa6
commit 22b90b2
Showing
4 changed files
with
173 additions
and
8 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
61 changes: 61 additions & 0 deletions
61
...ies/templates/semantic-ui/invenio_notifications/comment-community-invitation.create.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,61 @@ | ||
{% set invenio_request = notification.context.request %} | ||
{% set invenio_request_event = notification.context.request_event %} | ||
|
||
{# created_by is either a resolved user or an email (for guests) #} | ||
{% set event_creator_name = invenio_request_event.created_by.username or invenio_request_event.created_by %} | ||
{% set request_id = invenio_request.id %} | ||
{% set request_event_content = invenio_request_event.payload.content | safe %} | ||
{% set request_title = invenio_request.title | safe %} | ||
{% set parent_community = invenio_request.receiver.slug %} | ||
|
||
{# TODO: use request.links.self_html when issue issue is resolved: https://github.com/inveniosoftware/invenio-rdm-records/issues/1327 #} | ||
{% set request_link = "{ui}/communities/{parent_community}/requests/{request_id}".format( | ||
ui=config.SITE_UI_URL, parent_community=parent_community, request_id=request_id | ||
) | ||
%} | ||
{% set account_settings_link = "{ui}/account/settings/notifications".format( | ||
ui=config.SITE_UI_URL | ||
) | ||
%} | ||
|
||
{%- block subject -%} | ||
{{ _("💬 New comment on '{request_title}'").format(request_title=request_title) }} | ||
{%- endblock subject -%} | ||
|
||
{%- block html_body -%} | ||
<table style="font-family:'Lato',Helvetica,Arial,sans-serif;border-spacing:15px"> | ||
<tr> | ||
<td>{{ _("'@{user_name}' commented on '{request_title}':").format(user_name=event_creator_name, request_title=request_title) }}</td> | ||
</tr> | ||
<tr> | ||
<td><em>{{ request_event_content }}</em></td> | ||
</tr> | ||
<tr> | ||
<td><a href="{{ request_link }}" class="button">{{ _("Check out the 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 -%} | ||
{{ _("@{user_name} commented on '{request_title}'").format(user_name=event_creator_name, request_title=request_title) }}. | ||
|
||
{{ request_event_content }} | ||
|
||
{{ _("Check out the request: {request_link}").format(request_link=request_link) }} | ||
|
||
{%- endblock plain_body %} | ||
|
||
{# Markdown for Slack/Mattermost/chat #} | ||
{%- block md_body -%} | ||
{{ _("*@{user_name}* commented on *{request_title}*").format(user_name=event_creator_name, request_title=request_title) }}. | ||
|
||
{{ request_event_content }} | ||
|
||
[{{_("Check out the request")}}]({{request_link}}) | ||
{%- endblock md_body %} |
61 changes: 61 additions & 0 deletions
61
...nities/templates/semantic-ui/invenio_notifications/comment-community-request.create.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,61 @@ | ||
{% set invenio_request = notification.context.request %} | ||
{% set invenio_request_event = notification.context.request_event %} | ||
|
||
{# created_by is either a resolved user or an email (for guests) #} | ||
{% set event_creator_name = invenio_request_event.created_by.username or invenio_request_event.created_by %} | ||
{% set request_id = invenio_request.id %} | ||
{% set request_event_content = invenio_request_event.payload.content | safe %} | ||
{% set request_title = invenio_request.title | safe %} | ||
{% set parent_community = invenio_request.receiver.slug %} | ||
|
||
{# TODO: use request.links.self_html when issue issue is resolved: https://github.com/inveniosoftware/invenio-rdm-records/issues/1327 #} | ||
{% set request_link = "{ui}/communities/{parent_community}/requests/{request_id}".format( | ||
ui=config.SITE_UI_URL, parent_community=parent_community, request_id=request_id | ||
) | ||
%} | ||
{% set account_settings_link = "{ui}/account/settings/notifications".format( | ||
ui=config.SITE_UI_URL | ||
) | ||
%} | ||
|
||
{%- block subject -%} | ||
{{ _("💬 New comment on '{request_title}'").format(request_title=request_title) }} | ||
{%- endblock subject -%} | ||
|
||
{%- block html_body -%} | ||
<table style="font-family:'Lato',Helvetica,Arial,sans-serif;border-spacing:15px"> | ||
<tr> | ||
<td>{{ _("'@{user_name}' commented on '{request_title}':").format(user_name=event_creator_name, request_title=request_title) }}</td> | ||
</tr> | ||
<tr> | ||
<td><em>{{ request_event_content }}</em></td> | ||
</tr> | ||
<tr> | ||
<td><a href="{{ request_link }}" class="button">{{ _("Check out the 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 -%} | ||
{{ _("@{user_name} commented on '{request_title}'").format(user_name=event_creator_name, request_title=request_title) }}. | ||
|
||
{{ request_event_content }} | ||
|
||
{{ _("Check out the request: {request_link}").format(request_link=request_link) }} | ||
|
||
{%- endblock plain_body %} | ||
|
||
{# Markdown for Slack/Mattermost/chat #} | ||
{%- block md_body -%} | ||
{{ _("*@{user_name}* commented on *{request_title}*").format(user_name=event_creator_name, request_title=request_title) }}. | ||
|
||
{{ request_event_content }} | ||
|
||
[{{_("Check out the request")}}]({{request_link}}) | ||
{%- endblock md_body %} |