Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for customizing the content (and subject) of notification emails #4

Merged
merged 2 commits into from
Dec 6, 2020

Conversation

hispanic
Copy link
Owner

@hispanic hispanic commented Dec 6, 2020

This addresses issue eduardoboucas#173 - "Override text sent in email subscription".

I modified the code to source the notification email subject from email-notification-subject.njk and notification email content from email-notification-content.njk. Both are located at the root of the codebase and populated with the existing subject/content. If an error is raised when reading either, a stripped-down default is used.

Nunjucks is used as the templating language, as it includes a large amount of built-in functionality.

An extendedFields element is now included in the staticman_notification HTML comment that is embedded in the merge request review body (when moderation is enabled). This is in addition to fields, options, and parameters. This is necessary in order to make the Staticman-generated comment ID available when generating notification emails (so that they may contain a link directly to the triggering comment on the page).

A notification email is now sent only if the commenter is not the only subscriber found in the mailing list. This avoids the clumsy scenario where someone makes the first comment on a post (while choosing to subscribe to future comments) and then is sent a notification email for their own comment.

Michael Harry Scepaniak added 2 commits December 5, 2020 18:57
…iption"

- Source the notification email subject from email-notification-subject.njk, located at the root of the codebase. Populate it with the existing subject. If unable to read, use a stripped-down default subject.
- Source the notification email content from email-notification-content.njk, located at the root of the codebase. Populate it with the existing content. If unable to read, use stripped-down default content.
- Pull in Nunjucks as a dependency, to be available for use in the subject and content templates.
- In addition to fields, options, and parameters, include "extendedFields" in the "staticman_notification" HTML comment that is embedded in the review body (when moderation is enabled). We do this in order to make the Staticman-generated comment ID available when generating notification emails so that they may contain a link directly to the triggering comment on the page.
- Only send a notification email if the commenter is NOT the only subscriber found in the mailing list. This avoids the clumsy scenario where someone makes the first comment on a post (while choosing to subscribe to future comments) and then is sent a notification email for their own comment.
- Update and add-to unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant