Skip to content

Commit

Permalink
Fix sorting admin user list by last login (#22081) (#22107)
Browse files Browse the repository at this point in the history
  • Loading branch information
aceArt-GmbH authored Dec 13, 2022
1 parent c36a1bc commit 1409b34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions routers/web/explore/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions,
orderBy = "`user`.updated_unix ASC"
case "reversealphabetically":
orderBy = "`user`.name DESC"
case "lastlogin":
orderBy = "`user`.last_login_unix ASC"
case "reverselastlogin":
orderBy = "`user`.last_login_unix DESC"
case UserSearchDefaultSortType: // "alphabetically"
default:
orderBy = "`user`.name ASC"
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/user/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
<th>{{.locale.Tr "admin.users.2fa"}}</th>
<th>{{.locale.Tr "admin.users.repos"}}</th>
<th>{{.locale.Tr "admin.users.created"}}</th>
<th data-sortt-asc="leastupdate" data-sortt-desc="recentupdate">
<th data-sortt-asc="lastlogin" data-sortt-desc="reverselastlogin">
{{.locale.Tr "admin.users.last_login"}}
{{SortArrow "leastupdate" "recentupdate" $.SortType false}}
{{SortArrow "lastlogin" "reverselastlogin" $.SortType false}}
</th>
<th>{{.locale.Tr "admin.users.edit"}}</th>
</tr>
Expand Down

0 comments on commit 1409b34

Please sign in to comment.