Allow for customizing the content (and subject) of notification emails #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 fromemail-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 thestaticman_notification
HTML comment that is embedded in the merge request review body (when moderation is enabled). This is in addition tofields
,options
, andparameters
. 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.