Skip to content

Drop workarounds now that backend respects PUT semantics - #31

Merged
skomorokh merged 2 commits into
mainfrom
template-put
Aug 19, 2026
Merged

Drop workarounds now that backend respects PUT semantics#31
skomorokh merged 2 commits into
mainfrom
template-put

Conversation

@skomorokh

Copy link
Copy Markdown
Collaborator

No description provided.

@skomorokh
skomorokh marked this pull request as ready for review August 13, 2026 22:53
Copilot AI lite review requested due to automatic review settings August 13, 2026 22:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 TemplateForm audience option handling by always offering the full audience set (including blank “both”).
  • Update buildUpdateTemplateBody to 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 thread ui-rs/src/settings/templates/mapping.js
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
skomorokh merged commit c45468d into main Aug 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants