Skip to content

Commit

Permalink
Use range iterator for users list view
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDom2185 committed May 12, 2024
1 parent 3c33471 commit 089952e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions view/users/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ type ListView struct {

func ListFrom(users []model.User, roles []groupenums.Role) []ListView {
usersListView := make([]ListView, len(users))
for i := 0; i < len(users); i++ {
for i, user := range users {
usersListView[i] = ListView{
// Unlike other views, we do not fallback an empty name to
// the username for the users' list view.
ID: users[i].ID,
Name: users[i].FullName,
Username: users[i].Username,
LoginProvider: users[i].LoginProvider.ToString(),
ID: user.ID,
Name: user.FullName,
Username: user.Username,
LoginProvider: user.LoginProvider.ToString(),
Role: roles[i],
}
}
Expand Down

0 comments on commit 089952e

Please sign in to comment.