-
Notifications
You must be signed in to change notification settings - Fork 432
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
Add "Group type" field to group creation form #8993
Conversation
@@ -195,10 +210,17 @@ export default function CreateEditGroupForm() { | |||
let response: CreateUpdateGroupAPIResponse; | |||
|
|||
try { | |||
const body: CreateUpdateGroupAPIRequest = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures that the request body is compatible with the schema specified in api.ts
(if not, TS will complain).
{config.features.group_type && ( | ||
<> | ||
<Label id={groupTypeLabel} text="Group type" /> | ||
<RadioGroup<GroupType> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RadioGroup
component is parametrized by the type of value the user can select. In some cases this can be inferred (eg. from the value passed to selected
), but here it needed to be specified.
const radioGroup = wrapper.find('[data-testid="group-type"]'); | ||
act(() => { | ||
radioGroup.prop('onChange')(newType); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using act
here ensures that the form is immediately re-rendered after we change the state by toggling the radio buttons.
This allows setting the group type to "private", "restricted" or "open" when creating or editing a group. See #8898.
5813192
to
0c368f6
Compare
One issue I noticed: if a confirmation tick is shown next to the Save changes button because a previous change has already been saved, then changing the selected radio box doesn't clear the tick like changing one of the text fields does. This means you end up clicking Save changes when the tick is already still present which is a little weird. |
Ah, the form's save state is not reset. I'll address this as part of #8994. |
This allows setting the group type to "private", "restricted" or "open" when creating or editing a group.
This PR does not implement the part of the design where a warning is shown when changing the type of an existing group.
See #8898.
Testing:
group_type
feature flag