Skip to content

Primerize the administration user form. wp/72005#23691

Merged
klaustopher merged 15 commits into
devfrom
implementation/op-19485-primerization-of-the-user-form
Jun 23, 2026
Merged

Primerize the administration user form. wp/72005#23691
klaustopher merged 15 commits into
devfrom
implementation/op-19485-primerization-of-the-user-form

Conversation

@dfriquet

@dfriquet dfriquet commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/OP-19485

What are you trying to accomplish?

Convert the admin user create/edit form from the legacy form helpers to GitHub Primer.

Follow-up of approved PR #23454.

Screenshots

What approach did you choose and why?

Like for the advanced filters, this PR relies on form objects composed via Primer::Forms::FormList.

  • Users::FormComponent coordinates the form (modeled on Filters::FilterFormComponent): it receives the settings_primer_form_with builder, assembles a FormList from the inner forms it needs, and renders the read-only bits, the plugin hooks and the submit buttons around it;
  • Special note to Users::Form::PreferencesForm (time zone, color mode, keyboard shortcuts) renders under the top-level :pref scope, not as an inner form;
  • Add the view_users_primer_form plugin hook for Primer builder and keep view_users_form working via a TabularFormBuilder rendered in the form (deprecated, only when a listener exists);
  • Reuse the existing controllers (Rails and Stimulus) unchanged (no frontend changes);
    • Just a (bug ?) fix to prevent non-editable custom fields to be edited on my/account page by tampering the form.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@dfriquet dfriquet force-pushed the implementation/op-19485-primerization-of-the-user-form branch 2 times, most recently from dccd794 to b1a1568 Compare June 12, 2026 13:27
@dfriquet dfriquet force-pushed the feature/72005-new-administration-for-user-custom-fields-and-custom-field-sections branch from 11aa8ee to 55474a1 Compare June 12, 2026 13:44
@dfriquet dfriquet force-pushed the implementation/op-19485-primerization-of-the-user-form branch from b1a1568 to 9731068 Compare June 12, 2026 14:02
@dfriquet dfriquet force-pushed the feature/72005-new-administration-for-user-custom-fields-and-custom-field-sections branch from 55474a1 to 211e72c Compare June 15, 2026 07:22
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dfriquet dfriquet force-pushed the implementation/op-19485-primerization-of-the-user-form branch from 9731068 to 43e1795 Compare June 15, 2026 08:21
@dfriquet dfriquet marked this pull request as ready for review June 15, 2026 13:29
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/overviews/spec/features/project_description_widget_spec.rb[1:1:1:1:1]

@dfriquet dfriquet force-pushed the implementation/op-19485-primerization-of-the-user-form branch from 32774c9 to 892a3db Compare June 16, 2026 09:25

@HDinger HDinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit, that it took my some time to get through this. At first, I thought the code is overly complex but then I realized the complex requirements these pages have and the code actually helped to understand all of that. Kudos @dfriquet for fighting through all of this 🙇 👏 The result looks so much better than before and is a really nice improvement 🌟 👍
I left some comments, feel free to reach out if you don't know how to solve things, especially with spacings and Primer stuff. I'd happy to help. ☺️

Comment thread app/forms/users/form/attributes_form.rb Outdated
Comment thread app/forms/users/form/attributes_form.rb
Comment on lines +71 to +77
form.group(hidden: true, data: { "admin--users-target": "authSourceFields" }) do |group|
group.text_field(name: :login,
label: User.human_attribute_name(:login),
required: true,
input_width: :medium)
end
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have to be a group? The Primer form DSL also offers f.hidden for hidden fields..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it has to be a group because it is revealed/hidden by a Stimulus controller. I added a comment to explicit it.

Comment thread app/components/users/form_component.html.erb Outdated
Comment thread app/forms/users/form/authentication_source_form.rb Outdated
Comment thread modules/avatars/app/views/avatars/users/_avatar_fields.html.erb Outdated
.avatars--current-gravatar,
.avatars--current-local-avatar
.avatars--layout
display: flex

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In figma, the image was below the description text. Don't know how much of an issue that really is I admit 🤷 I like the text to the image as well 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With that few text lines, I like the condensed version side-by-side instead of the really long line of text above the narrow image. I can send a screenshot to a designer, maybe?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could bring it to the UX/UI open door. But it is definitely not a blocker for me

Comment thread frontend/src/global_styles/content/modules/_avatars.sass Outdated
Comment thread frontend/src/global_styles/content/modules/_avatars.sass Outdated
Comment thread modules/avatars/app/views/avatars/users/_avatar_fields.html.erb Outdated
@HDinger

HDinger commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Btw, this also fixes https://community.openproject.org/wp/DREAM-559 👏 ☺️

dfriquet and others added 4 commits June 16, 2026 18:53
Merge AuthenticationSourceForm and PasswordForm into a single
AuthenticationForm that renders every authentication scheme -- external
provider, LDAP source select, password settings and the cannot-login
notice -- inside one titled "Authentication" fieldset, replacing the
blocks previously rendered outside the form.
- Guard the external identity URL display against a nil value.
- Stop the avatar hint from mentioning Gravatar when it is disabled.
- Show the user's status as a read-only line in the Account section
  instead of folding it into the section title.
- Reword the untitled custom-field section label to "User attributes".
- Drop the redundant "Create and continue" button (and the now-dead
  continue redirect in the controller).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@dfriquet dfriquet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one open point remains, quite tricky…

Comment thread app/forms/users/form/attributes_form.rb
Comment thread app/forms/users/form/attributes_form.rb Outdated
Comment on lines +71 to +77
form.group(hidden: true, data: { "admin--users-target": "authSourceFields" }) do |group|
group.text_field(name: :login,
label: User.human_attribute_name(:login),
required: true,
input_width: :medium)
end
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it has to be a group because it is revealed/hidden by a Stimulus controller. I added a comment to explicit it.

Comment thread app/components/users/form_component.html.erb Outdated
Comment thread app/forms/users/form/authentication_source_form.rb Outdated
Comment thread app/components/users/form_component.html.erb Outdated
Comment thread app/forms/users/form/password_form.rb Outdated
Comment thread app/views/users/form/authentication/_external.html.erb Outdated
.avatars--current-gravatar,
.avatars--current-local-avatar
.avatars--layout
display: flex

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With that few text lines, I like the condensed version side-by-side instead of the really long line of text above the narrow image. I can send a screenshot to a designer, maybe?

Comment thread frontend/src/global_styles/content/modules/_avatars.sass Outdated
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/projects/lists/filters_spec.rb[1:16:1:1]

@dfriquet dfriquet requested a review from HDinger June 19, 2026 07:09

@HDinger HDinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good 👏 I only have one small thing left:
The spacing between the sections is not consistent. Some sections add additional spacing while others don't. I'd prefer a large gap between all sections

Image

@dfriquet

Copy link
Copy Markdown
Contributor Author

I only have one small thing left: The spacing between the sections is not consistent. Some sections add additional spacing while others don't. I'd prefer a large gap between all sections.

Does this work for you?

image

@dfriquet dfriquet force-pushed the implementation/op-19485-primerization-of-the-user-form branch from e75c7f2 to 34d635c Compare June 23, 2026 11:24
@dfriquet

Copy link
Copy Markdown
Contributor Author

@HDinger And finally a last one.

image

Comment thread app/views/my/account.html.erb Outdated
Base automatically changed from feature/72005-new-administration-for-user-custom-fields-and-custom-field-sections to dev June 23, 2026 14:48
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/projects/project_autocomplete_spec.rb[1:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #23691, linked for reference only):

- `rspec ./spec/features/projects/project_autocomplete_spec.rb[1:1]`

Treat this as a standalone task, unrelated to PR #23691. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #23691 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @dfriquet to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @dfriquet, and request a review from @dfriquet.
On every commit, set @dfriquet as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@klaustopher klaustopher merged commit 66a6479 into dev Jun 23, 2026
22 of 24 checks passed
@klaustopher klaustopher deleted the implementation/op-19485-primerization-of-the-user-form branch June 23, 2026 16:29
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants