Allow for giving notification mailing lists a name #2
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.
Addresses issue eduardoboucas#127 - "Mailgun mailing lists - give each one a name"
I added support for passing in a new "parentName" option to the "entry" endpoint. You can set it to whatever value you prefer. For example:
I chose "parentName" intentionally, as I believe @eduardoboucas originally added the "parent" option as "a unique identifier to the entry the user is subscribing to." More info: eduardoboucas#42 (comment)
When supplied, this value will be used to populate the "name" property of the created mailing list in Mailgun. In addition, supplying this option will also trigger the population of the "description" property for the mailing list. The description will be of the following form:
I have chosen to deliberately expose the relevant repository in the description, as that is factored into the creation of the mailing list ID.
If a "parentName" option is not passed, the mailing list will be created without a name or description, just as currently implemented.
As part of this change, I have modified the mailing list creation logic to set two other properties exposed by the Mailgun API:
By setting the "reply_preference" property on the Mailgun mailing list to "sender", the "reply-to" of every email sent via the mailing list will be postmaster@[mailgun domain] instead of the "from" address (e.g., noreply@staticman.net). I defeat this by explicitly setting the "h:Reply-To" header (to be the same as the "from" address).