User tests: Successful: Unsuccessful:
Pull Request resolves #47412 .
When creating a new user in the admin the selected User Group filter is now used as the default User Group for the new user.
Previously, clicking New always used the globally configured default user group (new_usertype), even when the Users list had been filtered to a specific user group.
This change is consistent with the behaviour that we have throughout the ui
Go to the admin list of users
Filter by group eg manager
Click New to create a New User
The new user will always be in the registered group by default (or whatever group is defined in the component options as the default group)
The new user will be in the filtered group eg manager by default
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration com_users JavaScript Unit Tests |
| Labels |
Added:
Feature
Unit/System Tests
PR-6.3-dev
|
||
updating branch to re-trigger tests
grrh same test still failing but definitely nothing to do with this pr
grrh same test still failing but definitely nothing to do with this pr
I found the problem with the test (I wasnt resetting the filter afterwards) and fixed it
Tested ok.
I have tested this item ✅ successfully on 37d756e
I have tested this item ✅ successfully on 37d756e
I have tested this item ✅ successfully on 37d756e
Filter the Users list by a group, click New: that group is pre-selected. Without a filter the default group (Registered) is used as before.
6.3-dev + PR, fresh install, PHP in DDEV.
| Case | Result |
|---|---|
| Super User, filter Manager → New | Manager checked ✅ |
| Save with that group | user saved in Manager ✅ |
| No filter → New | Registered (default) ✅ |
| Filter Manager → New → Cancel → New without filter | Registered, nothing leaks ✅ |
| Filter Manager → New → Save & New | Registered (filter not applied) |
| Filter Manager → menu Users → Add New User | Registered (filter not applied) |
| Administrator (not Super User), filter Super Users → New | no group checked (Super Users box is hidden for them); save → "You can't save a user account without selecting at least one user group." Before the PR: Registered |
Other form defaults are identical with and without the filter. The new Cypress test passes locally (User.cy.js 4/4), CI is green.
Elsewhere in core the list filter is applied in the model for new items (ArticleModel, BannerModel, FieldModel, ItemModel::loadFormData() read <list>.filter from the user state). Doing the same here would also cover Save & New and the Add New User menu link, and would fall back to the default group when the filtered group can't be assigned by the current user. Tested locally with the controller override removed: New, Save & New and the menu link pre-select Manager; no filter → Registered; Administrator + Super Users filter → Registered; User.cy.js 4/4.
Note the context: UsersModel appends the layout, so the key is com_users.users.default.filter.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48557.
I have tested this item ✅ successfully on 37d756e
I was able to successfully test this PR fix. Thanks @brianteeman.
I have tested this item ✅ successfully on 37d756e
I was able to successfully test this PR fix. Thanks @brianteeman.
| Status | Pending | ⇒ | Ready to Commit |
RTC
RTC
@brianteeman could you respond to the suggestion made by @tecpromotion? If i read it correctly his suggestion would be an improvement to the current PR?
He marked it as a successful test so I didn't read the rest
Sorry @tecpromotion I didnt see the suggestion. You're right, this would be a better approach.
Putting this in the model's loadFormData() means we handle all the different ways of opening a new user form, including Save & New and the Add New User menu link, rather than just the toolbar New button.
It also gives us the opportunity to fall back to the configured default group when the selected filter group cannot be assigned by the current user.
I'll revisit the implementation and move this out of the controller and into the model. Thanks for testing the additional scenarios and identifying the improvements.
Please remove RTC until I can rework this
| Status | Ready to Commit | ⇒ | Pending |
Back to pending as the PR will receive changes.
I have tested this item ✅ successfully on 37d756e
Re-tested this updated PR, @brianteeman, thank you! :)
The failing test appears to be unrelated to any changes in this PR