mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-05 23:34:11 +02:00
Improve layout of user page for admins
This commit is contained in:
2 files changed
+19
-5
No files matched your search
@@ -305,6 +305,20 @@ func ViewUser(ctx *context.Context) {
|
||||
ctx.Data["Users"] = orgs // needed to be able to use explore/user_list template
|
||||
ctx.Data["OrgsTotal"] = len(orgs)
|
||||
|
||||
userSessions, err := auth.GetUserSessionsByUserID(ctx, u.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserSessionsByUserID", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["SessionsTotal"] = len(userSessions)
|
||||
activeCount := 0
|
||||
for _, s := range userSessions {
|
||||
if s.LogoutUnix == 0 {
|
||||
activeCount++
|
||||
}
|
||||
}
|
||||
ctx.Data["SessionsActive"] = activeCount
|
||||
|
||||
ctx.HTML(http.StatusOK, tplUserView)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user