Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove cookies before marshalling to privacy notice form #3670

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ The types of changes are:
- Restrict Privacy Center debug logging to development-only [#3638](https://github.com/ethyca/fides/pull/3638)
- Fix bug where linking an integration would not update the tab when creating a new system [#3662](https://github.com/ethyca/fides/pull/3662)
- Fix dataset yaml not properly reflecting the dataset in the dropdown of system integrations tab [#3666](https://github.com/ethyca/fides/pull/3666)
- Fix privacy notices not being able to be edited via the UI after the addition of the `cookies` field [#3670](https://github.com/ethyca/fides/pull/3670)

### Changed

Expand Down
50 changes: 34 additions & 16 deletions clients/admin-ui/cypress/e2e/privacy-notices.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,23 +227,41 @@ describe("Privacy notices", () => {
});

it("can make an edit", () => {
cy.visit(`${PRIVACY_NOTICES_ROUTE}/${ESSENTIAL_NOTICE_ID}`);
cy.wait("@getNoticeDetail");
const newName = "new name";
cy.getByTestId("input-name").clear().type(newName);
// should not reflect the new name since this is the edit form
cy.getByTestId("input-notice_key").should("have.value", "essential");
// but we can still update it
const newKey = "custom_key";
cy.getByTestId("input-notice_key").clear().type(newKey);

cy.getByTestId("save-btn").click();
cy.wait("@patchNotices").then((interception) => {
const { body } = interception.request;
expect(body[0].name).to.eql(newName);
expect(body[0].notice_key).to.eql(newKey);
cy.fixture("privacy-notices/notice.json").then((notice) => {
cy.visit(`${PRIVACY_NOTICES_ROUTE}/${ESSENTIAL_NOTICE_ID}`);
cy.wait("@getNoticeDetail");
const newName = "new name";
cy.getByTestId("input-name").clear().type(newName);
// should not reflect the new name since this is the edit form
cy.getByTestId("input-notice_key").should("have.value", "essential");
// but we can still update it
const newKey = "custom_key";
cy.getByTestId("input-notice_key").clear().type(newKey);

cy.getByTestId("save-btn").click();
cy.wait("@patchNotices").then((interception) => {
const { body } = interception.request;
const expected = {
name: newName,
notice_key: newKey,
consent_mechanism: notice.consent_mechanism,
data_uses: notice.data_uses,
description: notice.description,
disabled: notice.disabled,
displayed_in_api: notice.displayed_in_api,
displayed_in_overlay: notice.displayed_in_overlay,
displayed_in_privacy_center: notice.displayed_in_privacy_center,
enforcement_level: notice.enforcement_level,
has_gpc_flag: notice.has_gpc_flag,
id: notice.id,
internal_description: notice.internal_description,
origin: notice.origin,
regions: notice.regions,
};
expect(body[0]).to.eql(expected);
});
cy.wait("@getNoticeDetail");
});
cy.wait("@getNoticeDetail");
});
});

Expand Down
1 change: 1 addition & 0 deletions clients/admin-ui/src/features/privacy-notices/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const transformPrivacyNoticeResponseToCreation = (
updated_at: updatedAt,
privacy_notice_history_id: historyId,
version,
cookies,
...rest
} = notice;
return {
Expand Down