Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Translation Epic TS3 - Prevent Accidental Reassignment in Request Payloads #329

Open
6 tasks done
Karvel opened this issue Jun 23, 2021 · 0 comments
Open
6 tasks done
Labels
bug Something isn't working

Comments

@Karvel
Copy link
Contributor

Karvel commented Jun 23, 2021

Desired Use Case

Unpacking nested payloads should not be a side effect for buildRequestPayload(). It should be separated into its own method for clarity.

Actual/Current Behavior

The current method can accidentally overwrite objects with nested values:

{
    id: 1,
    name: 'Test Tester',
    ...
    role: {
        id: 1,
        roleName: 'Admin'
    },
    agency: {
        id: 1,
        agencyName: 'TestCo'
    }
}

becomes

{
    id: 1,
    name: 'Test Tester',
    ...
    role: 1,
    agency: 'TestCo'
}

Steps to Implement This Feature

  • Create new buildNestedRequestPayload().
  • Move nested property logic.
  • Add tests.
  • Use buildNestedRequestPayload() when unpacking dynamicContent.
  • Use buildNestedRequestPayload() when mapping from nested property to parent object (e.g. getting form values for role and agency from select fields).
  • Fix breaking test in LanguageStateService.

Pre-Testing TODOs

What needs to be done before testing.

  1. Serve from the translation epic branch on the API.

Testing Steps

If you are not a member of this project, skip this step

How do the users test this change?

  1. Login as an admin.
  2. Create a new user (this requires setting role and agency).
  3. Confirm that the values set correctly.
  4. Add a translation for an agent description value.
  5. Confirm that the values set correctly.
@Karvel Karvel added bug Something isn't working feature New feature or change that directly affects users labels Jun 23, 2021
@Karvel Karvel added this to the Translation - Sprint #6 milestone Jun 23, 2021
@Karvel Karvel self-assigned this Jun 23, 2021
@Karvel Karvel changed the title Prevent Accidental Reassignment in Request Payloads Translation Epic - Prevent Accidental Reassignment in Request Payloads Jun 23, 2021
@Karvel Karvel changed the title Translation Epic - Prevent Accidental Reassignment in Request Payloads Translation Epic TS3 - Prevent Accidental Reassignment in Request Payloads Jun 23, 2021
@Karvel Karvel removed the feature New feature or change that directly affects users label Jun 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant