Fix crash when Administrator has custom field that is internal
but not readonly
#3159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This fixes #3158.
Previously, the
addActiveAdministratorCustomFields
function, which adds the custom fields for the Administrator entity into the input type for theupdateActiveAdministrator
mutation, would assume that theUpdateAdministratorCustomFieldsInput
type exists if there are any non-readonly
custom fields, even if those custom fields areinternal
. This was incorrect, sinceinternal
custom fields will not appear in mutation input types, any more than ones that arereadonly
. So, the schema produced would reference that input type, causing a crash if it did not exist, which happened every time there wereinternal
, non-readonly
custom fields.I also added a test to confirm that the
UpdateAdministratorCustomFieldsInput
type is not referenced when the Administrator entity has only aninternal
custom field.Also, an irrelevant typo is fixed.
Breaking changes
Does this PR include any breaking changes we should be aware of?
Nope.
Checklist
📌 Always:
👍 Most of the time: