Skip to content

Commit c057590

Browse files
aceArt-GmbHKN4CK3R
andauthored
Fix sorting admin user list by last login (#22081) (#22106)
Backport of #22081 Co-authored-by: KN4CK3R <[email protected]>
1 parent a8534ac commit c057590

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

routers/web/explore/user.go

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions,
5858
orderBy = "`user`.updated_unix ASC"
5959
case "reversealphabetically":
6060
orderBy = "`user`.name DESC"
61+
case "lastlogin":
62+
orderBy = "`user`.last_login_unix ASC"
63+
case "reverselastlogin":
64+
orderBy = "`user`.last_login_unix DESC"
6165
case UserSearchDefaultSortType: // "alphabetically"
6266
default:
6367
orderBy = "`user`.name ASC"

templates/admin/user/list.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
<th>{{.i18n.Tr "admin.users.2fa"}}</th>
7777
<th>{{.i18n.Tr "admin.users.repos"}}</th>
7878
<th>{{.i18n.Tr "admin.users.created"}}</th>
79-
<th data-sortt-asc="leastupdate" data-sortt-desc="recentupdate">
79+
<th data-sortt-asc="lastlogin" data-sortt-desc="reverselastlogin">
8080
{{.i18n.Tr "admin.users.last_login"}}
81-
{{SortArrow "leastupdate" "recentupdate" $.SortType false}}
81+
{{SortArrow "lastlogin" "reverselastlogin" $.SortType false}}
8282
</th>
8383
<th>{{.i18n.Tr "admin.users.edit"}}</th>
8484
</tr>

0 commit comments

Comments
 (0)