Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sorting admin user list by last login #22081

Merged
merged 6 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions routers/web/explore/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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":
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
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