feat: implement send email on release notes publish - #102
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds opt-in email notifications when publishing release notes, and introduces a token-based unsubscribe flow for those emails. This extends the existing release-notes Redux/data layer and UI to support a “send email” flag and a new unsubscribe route/page.
Changes:
- Add a “Send email notification…” checkbox to the release note publish/edit form (behind a permission flag) and include
sendEmailin the submit payload. - Plumb a new
canSendReleaseNoteEmailscapability from the release-notes API response through Redux selectors/hooks into the UI. - Add
/release-notes/unsubscriberoute, page UI/state machine, API helper, and tests for token-based unsubscribe.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/release-notes/update-form/ReleaseNoteForm.test.jsx | Adds checkbox rendering/toggling and submit-payload tests for sendEmail. |
| src/release-notes/update-form/ReleaseNoteForm.jsx | Adds canSendReleaseNoteEmails prop, Formik sendEmail field, checkbox UI, and submit payload field. |
| src/release-notes/unsubscribe/ReleaseNoteUnsubscribe.test.jsx | New tests covering token presence, success, failure + retry flows. |
| src/release-notes/unsubscribe/ReleaseNoteUnsubscribe.jsx | New unsubscribe page component with idle/loading/success/error states. |
| src/release-notes/unsubscribe/messages.js | New i18n strings for the unsubscribe page. |
| src/release-notes/ReleaseNotes.test.jsx | Updates hook mock shape to include canSendReleaseNoteEmails. |
| src/release-notes/ReleaseNotes.jsx | Passes canSendReleaseNoteEmails into ReleaseNoteForm. |
| src/release-notes/messages.js | Adds i18n strings for the send-email checkbox label/help text. |
| src/release-notes/hooks.jsx | Exposes canSendReleaseNoteEmails from Redux via selector. |
| src/release-notes/data/thunk.test.js | Adds coverage for canSendReleaseNoteEmails and send_email_on_publish mapping behavior. |
| src/release-notes/data/thunk.js | Reads canSendReleaseNoteEmails from fetch response; maps sendEmail to send_email_on_publish for create/edit. |
| src/release-notes/data/slice.js | Adds canSendReleaseNoteEmails to state and stores it on fetch success. |
| src/release-notes/data/selectors.js | Adds selector for canSendReleaseNoteEmails. |
| src/release-notes/data/api.test.js | Adds API test for unsubscribeWithToken. |
| src/release-notes/data/api.js | Adds unsubscribe endpoint URL + unsubscribeWithToken API helper. |
| src/index.jsx | Adds route for /release-notes/unsubscribe. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
207
to
210
| publishDate: initialValues.published_at ? moment(convertToDateFromString(initialValues.published_at)).format('YYYY-MM-DD') : '', | ||
| publishTime: initialValues.published_at ? moment(initialValues.published_at).format(TIME_FORMAT) : '', | ||
| sendEmail: false, | ||
| }} |
Comment on lines
+30
to
+33
| export async function unsubscribeWithToken(token) { | ||
| const url = `${getUnsubscribeApiUrl()}?token=${encodeURIComponent(token)}`; | ||
| const { data } = await getAuthenticatedHttpClient().get(url); | ||
| return camelCaseObject(data); |
Comment on lines
+84
to
+88
| actions={[ | ||
| <Button variant="outline-primary" onClick={handleUnsubscribe}> | ||
| {intl.formatMessage(messages.unsubscribeRetry)} | ||
| </Button>, | ||
| ]} |
abhalsod-sonata
approved these changes
Jun 10, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds opt-in email notification support to the Release Notes publish flow. When a user with the appropriate permission publishes or edits a release note, they can now opt in to send an email notification to all course authors on the platform. This PR also introduces a token-based unsubscribe flow, allowing recipients to unsubscribe from future release note emails via a dedicated page.
Changes
Feature: Send Email on Publish
sendEmailFormik field (default:false) toReleaseNoteFormwith a permission-gated checkbox (canSendReleaseNoteEmails).sendEmailis extracted from form data, stripped from the note payload, and remapped tosend_email_on_publishbefore being sent to the API. Defaults tofalsewhen absent.Data Layer:
canSendReleaseNoteEmailsCapabilityfetchReleaseNotesQuerythunk now readscanSendReleaseNoteEmailsfrom the API response and includes it in thefetchReleaseNotesSuccessdispatch payload.slice.js) initializescanSendReleaseNoteEmails: falseand stores it on fetch success.getCanSendReleaseNoteEmailsadded toselectors.js.useReleaseNoteshook updated to exposecanSendReleaseNoteEmailsviauseSelector, and it is passed down throughReleaseNotes.jsxintoReleaseNoteForm.Feature: Unsubscribe Page
ReleaseNoteUnsubscribecomponent atsrc/release-notes/unsubscribe/implementing a 4-state UI:idle→loading→success/error.?token=query param. If absent, an error alert is shown immediately without rendering the confirmation card.unsubscribeFromReleaseNoteEmails(token)(new API helper) which issues an authenticated GET to/api/release_notes/v1/email/unsubscribe/?token=<encoded>.outline-primary)./release-notes/unsubscriberegistered insrc/index.jsx— intentionally outside theENABLE_RELEASE_NOTESfeature flag gate so unsubscribe links remain functional for all users regardless of flag state.unsubscribe/messages.js: title, confirmation prompt, button label, disclaimer, processing text, success heading/body, error heading/body, retry label.API
getUnsubscribeApiUrl()pointing to/api/release_notes/v1/email/unsubscribe/.unsubscribeFromReleaseNoteEmails(token)— makes an authenticated GET with the token URL-encoded, returns a camelCased response object.Notes
ENABLE_RELEASE_NOTESconfig gate, by design — email recipients need to be able to reach the unsubscribe page even if the release notes feature is toggled off for their instance.sendEmaildefaults tofalseon form initialization; it is a one-time flag per publish action and is not persisted back to the form on re-open.JIRA: TNL2-584