summaryrefslogtreecommitdiffstats
path: root/routers/admin/users.go
diff options
context:
space:
mode:
authorevolvedlight <steve@evolvedlight.co.uk>2014-10-13 20:30:31 +0100
committerevolvedlight <steve@evolvedlight.co.uk>2014-10-13 20:30:31 +0100
commit8d2a6fc484b540819e211d52b8d54e97269f0918 (patch)
treee5bfe7d3937bb2d18ba2fb50ea72514bd5bb4e13 /routers/admin/users.go
parent29ac3980ffdb5faa525d77fddc109c9023ebe257 (diff)
parent89bd994c836ecc9b6ceb80849f470521e1b15917 (diff)
downloadgitea-8d2a6fc484b540819e211d52b8d54e97269f0918.tar.gz
gitea-8d2a6fc484b540819e211d52b8d54e97269f0918.zip
Merge remote-tracking branch 'upstream/dev'
Conflicts: models/repo.go
Diffstat (limited to 'routers/admin/users.go')
-rw-r--r--routers/admin/users.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/admin/users.go b/routers/admin/users.go
index fc3b0cbce0..c9adf2d856 100644
--- a/routers/admin/users.go
+++ b/routers/admin/users.go
@@ -24,14 +24,14 @@ const (
)
func pagination(ctx *middleware.Context, count int64, pageNum int) int {
- p := com.StrTo(ctx.Query("p")).MustInt()
+ p := ctx.QueryInt("p")
if p < 1 {
p = 1
}
curCount := int64((p-1)*pageNum + pageNum)
- if curCount > count {
+ if curCount >= count {
p = int(count) / pageNum
- } else if count > curCount {
+ } else {
ctx.Data["NextPageNum"] = p + 1
}
if p > 1 {
@@ -48,12 +48,12 @@ func Users(ctx *middleware.Context) {
pageNum := 50
p := pagination(ctx, models.CountUsers(), pageNum)
- var err error
- ctx.Data["Users"], err = models.GetUsers(pageNum, (p-1)*pageNum)
+ users, err := models.GetUsers(pageNum, (p-1)*pageNum)
if err != nil {
ctx.Handle(500, "GetUsers", err)
return
}
+ ctx.Data["Users"] = users
ctx.HTML(200, USERS)
}