Drop workarounds now that backend respects PUT semantics - #31
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes UI-side workarounds that existed because the backend previously did not treat PUT as a full replace (i.e., omitted optional fields were not cleared). The changes simplify template update payload construction and re-enable clearing/restoring fields like audience via omission.
Changes:
- Simplify
TemplateFormaudience option handling by always offering the full audience set (including blank “both”). - Update
buildUpdateTemplateBodyto omit blank optional fields (relying on backend PUT semantics to clear them). - Remove/adjust tests that asserted the old workaround behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ui-rs/src/settings/templates/TemplateForm.test.js | Removes prior audience workaround tests; needs replacement coverage for the new “clear to both” behavior. |
| ui-rs/src/settings/templates/TemplateForm.js | Always provides full AUDIENCES options to the audience select (no editing-mode filtering). |
| ui-rs/src/settings/templates/mapping.test.js | Updates update-body tests to expect omission of blank optional fields. |
| ui-rs/src/settings/templates/mapping.js | Changes update payload construction to omit blank optional fields (subject/audience). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+86
to
90
| it('omits blank optional fields', () => { | ||
| const body = buildUpdateTemplateBody({ ...values, subject: ' ', audience: '' }); | ||
| expect(body).not.toHaveProperty('subject'); | ||
| expect(body).not.toHaveProperty('audience'); | ||
| }); |
| }); | ||
| }); | ||
|
|
||
| describe('labels', () => { |
skomorokh
requested review from
adamdickmeiss,
ihardy,
jakub-id and
kurtnordstrom
as code owners
August 18, 2026 23:53
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.
No description provided.