Updating a Make clears all fields with no new data

RESOLVED FIXED

Status

Webmaker
MakeAPI
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: cade, Assigned: cade)

Tracking

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
If I try to update a make, and only pass in some of the fields, any omitted ones are deleted. This throws when they're required/fail validation, and some just get cleared entirely.
(Assignee)

Updated

5 years ago
Blocks: 871700
(Assignee)

Comment 1

5 years ago
Created attachment 754821 [details] [review]
https://github.com/mozilla/MakeAPI/pull/62

I modified updateFields in the make routes so that it doesn't overwrite existing fields with `null` and I also make it concatenate tag arrays. Also have it checking if the createdAt field already exists, so that the time is put in updatedAt if the make already existed.
Attachment #754821 - Flags: review?(david.humphrey)
(Assignee)

Updated

5 years ago
Summary: Updating a Make clears fields not trying to be updated → Updating a Make clears all fields with no new data
Comment on attachment 754821 [details] [review]
https://github.com/mozilla/MakeAPI/pull/62

r+ with nits in PR.
Attachment #754821 - Flags: review?(david.humphrey) → review+

Comment 3

5 years ago
Commit pushed to master at https://github.com/mozilla/MakeAPI

https://github.com/mozilla/MakeAPI/commit/b1362b16b0816eeaa73d4a4dafc1bc41427a05b8
Fix Bug 876527 - Don't overwrite existing make fields on an update, concatenate tag arrays, and determine which date field to timestamp.

Updated

5 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Attachment mime type: text/plain → text/x-github-pull-request
You need to log in before you can comment on or make changes to this bug.