refactor(email): add default body fallback for test notification template#2654
refactor(email): add default body fallback for test notification template#26548emk10 wants to merge 1 commit intoseerr-team:developfrom
Conversation
📝 WalkthroughWalkthroughThis change adds a fallback message to the test email template's body field. When the body parameter is not provided or is falsy, the template now displays the default message "Check check, 1, 2, 3. Are we coming in clear?" instead of rendering an empty output. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
0xSysR3ll
left a comment
There was a problem hiding this comment.
Can you update your PR to use our template please ? https://github.com/seerr-team/seerr/blob/develop/.github/PULL_REQUEST_TEMPLATE.md
|
Updated the PR description to follow the project template. Thanks! |
|
I'm not sure I understand in which scenario body would be In the current test notification flow the message is already hard-coded: const sendTestNotification = async (agent: NotificationAgent, user: User) =>
await agent.send(Notification.TEST_NOTIFICATION, {
notifySystem: true,
notifyAdmin: false,
notifyUser: user,
subject: 'Test Notification',
message: 'Check check, 1, 2, 3. Are we coming in clear?',
});So the template should always receive a value for the body. Could you clarify how body might end up being |
|
Good point — you're right that in the current implementation the test notification flow always provides a message: 'Check check, 1, 2, 3. Are we coming in clear?' So in the current code path the template should indeed always receive a The motivation for this change is mainly related to a longer-term goal around the email templates. Currently some email content is still partially defined in the notification sender. The idea is to gradually move email content fully into the templates so the templates become the single source of truth for rendering emails. This is especially useful for future improvements around localization / multi-language email templates, where different template folders (e.g. In that scenario templates should ideally be able to render independently without relying on the sender always providing a That said, if you prefer to keep the template strictly dependent on the sender always providing |
Description
This PR adds a small fallback for the test email notification template.
Currently the template renders
#{body}directly.If the
bodyvariable is not provided, the email content may appear blank.This change updates the template to:
#{body || 'Check check, 1, 2, 3. Are we coming in clear?'}
This ensures that a visible message is always rendered even if
bodyis missing.This change is intentionally minimal and only affects the test notification template.
It also helps prepare the template behavior for future improvements discussed around multi-language email templates, where template rendering may depend on localized content generation.
Modified file:
server/templates/email/test-email/html.pug
How Has This Been Tested?
pugbodyis undefinedScreenshots / Logs (if applicable)
Test email rendered locally showing the fallback message.
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit