Order users by Redmine's display name format - #46
Merged
mboremski merged 2 commits intoAug 27, 2026
Conversation
Fixes #2 The user list was always sorted by last name, regardless of the 'Users display format' setting. On an installation showing 'Firstname Lastname' the list therefore looked unsorted to the people reading it. Sort by the name as Redmine renders it instead. The key lives in RedmineWorkload::WlUserSorting because two call sites need it: * WlUserSelection#allowed_to_display -- the filter's user list * GroupWorkload#sorted_user_workload -- the rows of the workload table. The class name stays the first element of the key, so GroupUserDummy still comes before the real users. GroupUserDummy aliases name to lastname and delegates id to its group, so it works with the same key. The test asserts the order flips between 'lastname_comma_firstname' and 'firstname_lastname'. It builds a fresh selection inside each with_settings block, because User#name memoizes and would otherwise serve the name from before the setting changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2
The user list was always sorted by last name, regardless of the 'Users display format' setting. On an installation showing 'Firstname Lastname' the list therefore looked unsorted to the people reading it.
Sort by the name as Redmine renders it instead. The key lives in RedmineWorkload::WlUserSorting because two call sites need it:
GroupUserDummy aliases name to lastname and delegates id to its group, so it works with the same key.
The test asserts the order flips between 'lastname_comma_firstname' and 'firstname_lastname'. It builds a fresh selection inside each with_settings block, because User#name memoizes and would otherwise serve the name from before the setting changed.
Thank you very much for your contribution! We highly appreciate that.
Please compare your branch with the develop branch of this repository.