Skip to content

Commit 1409b34

Browse files
authored
Fix sorting admin user list by last login (go-gitea#22081) (go-gitea#22107)
1 parent c36a1bc commit 1409b34

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
@@ -69,6 +69,10 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions,
6969
orderBy = "`user`.updated_unix ASC"
7070
case "reversealphabetically":
7171
orderBy = "`user`.name DESC"
72+
case "lastlogin":
73+
orderBy = "`user`.last_login_unix ASC"
74+
case "reverselastlogin":
75+
orderBy = "`user`.last_login_unix DESC"
7276
case UserSearchDefaultSortType: // "alphabetically"
7377
default:
7478
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>{{.locale.Tr "admin.users.2fa"}}</th>
7777
<th>{{.locale.Tr "admin.users.repos"}}</th>
7878
<th>{{.locale.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
{{.locale.Tr "admin.users.last_login"}}
81-
{{SortArrow "leastupdate" "recentupdate" $.SortType false}}
81+
{{SortArrow "lastlogin" "reverselastlogin" $.SortType false}}
8282
</th>
8383
<th>{{.locale.Tr "admin.users.edit"}}</th>
8484
</tr>

0 commit comments

Comments
 (0)