FIX: ensure required_tag_group_name is null if no value present (#14796)

* FIX: ensure required_tag_group_name is null if no value present

If the array was present but empty `required_tag_group_name` would be set to undefined, which would then be removed from the payload of the remote request.

Addming the length check ensures the value is set to null, which is sent as an empty value (which the backend sees, and can remove it and persist the change on the Category object).
This commit is contained in:
jbrw 2021-11-04 17:26:21 -04:00 committed by GitHub
parent 9b30103628
commit 6360d3d4e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,9 +221,10 @@ const Category = RestModel.extend({
? this.allowed_tag_groups
: null,
allow_global_tags: this.allow_global_tags,
required_tag_group_name: this.required_tag_groups
? this.required_tag_groups[0]
: null,
required_tag_group_name:
this.required_tag_groups && this.required_tag_groups.length > 0
? this.required_tag_groups[0]
: null,
min_tags_from_required_group: this.min_tags_from_required_group,
sort_order: this.sort_order,
sort_ascending: this.sort_ascending,