Skip to content

Show configured email notification templates instead of defaults when editing form#24657

Merged
ryan-carroll-graylog merged 14 commits intomasterfrom
24515-when-editing-an-existing-e-mail-notification-the-global-templates-are-shown-not-the-changed-templates
Jan 8, 2026
Merged

Show configured email notification templates instead of defaults when editing form#24657
ryan-carroll-graylog merged 14 commits intomasterfrom
24515-when-editing-an-existing-e-mail-notification-the-global-templates-are-shown-not-the-changed-templates

Conversation

@ryan-carroll-graylog
Copy link
Copy Markdown
Contributor

@ryan-carroll-graylog ryan-carroll-graylog commented Jan 7, 2026

Description

Fixes issue where the email notification edit page always displayed the default email body templates instead of what was saved on the actual notification, even if the user had updated the template.

Looks like this was a bug in the initial implementation of the ability to configure the defaults for these, which was backported to 7.0, so we should backport this fix there too: #24008

Motivation and Context

Closes: #24515

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@ryan-carroll-graylog ryan-carroll-graylog marked this pull request as ready for review January 7, 2026 17:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the email notification edit page displayed default email body templates instead of user-configured templates when editing existing notifications. The fix ensures that persisted notifications retain their custom templates while new notifications still receive the defaults.

Key Changes:

  • Added isPersisted flag to prevent template override when editing existing notifications
  • Propagated notificationId through component hierarchy to identify persisted notifications
  • Added comprehensive test coverage for both new and existing notification scenarios

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
EmailNotificationForm.tsx Added notificationId prop and isPersisted flag to preserve existing templates
EmailNotificationForm.test.tsx New test file validating template behavior for new vs. existing notifications
EventNotificationFormContainer.tsx Added lifecycle method to handle notification prop updates
EventNotificationForm.tsx Passed notificationId to child component
changelog/unreleased/issue-24515.toml Added changelog entry documenting the bug fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread changelog/unreleased/issue-24515.toml Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ryan-carroll-graylog ryan-carroll-graylog marked this pull request as draft January 7, 2026 20:00
Copy link
Copy Markdown
Contributor

@danotorrey danotorrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on this fix. This is testing successfully for me locally. I just launched a server/open test instance, and I will run through it there too here in a few.

@ryan-carroll-graylog ryan-carroll-graylog marked this pull request as ready for review January 8, 2026 14:01
@danotorrey
Copy link
Copy Markdown
Contributor

danotorrey commented Jan 8, 2026

Oops, I launched an Enterprise instance instead. Firing up an open instance now... I'll open a small PR to enable the email transport as well to allow saving the notifications there.

@danotorrey
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@danotorrey danotorrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and tests successfully:

Open instance:
New email notifications correctly default to the static text and email templates. When a template is edited, the updated value is displayed during subsequent edits and is also used when sending the email.

Enterprise instance:
When no custom template is defined, new email notifications correctly default to the static text and email templates. Any edits are visible in subsequent edit attempts and on the details page. The same behavior works correctly when custom templates are defined.

@ryan-carroll-graylog
Copy link
Copy Markdown
Contributor Author

Sweet thanks for the testing @danotorrey !

@ryan-carroll-graylog ryan-carroll-graylog merged commit a492336 into master Jan 8, 2026
24 checks passed
@ryan-carroll-graylog ryan-carroll-graylog deleted the 24515-when-editing-an-existing-e-mail-notification-the-global-templates-are-shown-not-the-changed-templates branch January 8, 2026 16:08
garybot2 pushed a commit that referenced this pull request Jan 8, 2026
… editing form (#24657)

* Show configured email notification templates instead of defaults when editing

* add cl entry

* add tests

* Update changelog/unreleased/issue-24515.toml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix ts errors

* fix test

* fix test

* fix linter complaint

* fix test

* refactor

* cleanup

* cleanup

* update test

* Fix linter complaint

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit a492336)
ryan-carroll-graylog added a commit that referenced this pull request Jan 14, 2026
… editing form (#24657) (#24676)

* Show configured email notification templates instead of defaults when editing

* add cl entry

* add tests

* Update changelog/unreleased/issue-24515.toml



* fix ts errors

* fix test

* fix test

* fix linter complaint

* fix test

* refactor

* cleanup

* cleanup

* update test

* Fix linter complaint

---------


(cherry picked from commit a492336)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

When editing an existing E-Mail Notification, the global templates are shown, not the changed templates

4 participants