Fix #285
This commit is contained in:
parent
63cc14062a
commit
0f907301b7
9 changed files with 48 additions and 15 deletions
|
@ -163,7 +163,7 @@ func Users(ctx *middleware.Context) {
|
|||
if p < 1 {
|
||||
p = 1
|
||||
}
|
||||
pageNum := 100
|
||||
pageNum := 50
|
||||
count := models.CountUsers()
|
||||
curCount := int64((p-1)*pageNum + pageNum)
|
||||
if curCount > count {
|
||||
|
@ -192,7 +192,7 @@ func Repositories(ctx *middleware.Context) {
|
|||
if p < 1 {
|
||||
p = 1
|
||||
}
|
||||
pageNum := 2
|
||||
pageNum := 50
|
||||
count := models.CountRepositories()
|
||||
curCount := int64((p-1)*pageNum + pageNum)
|
||||
if curCount > count {
|
||||
|
|
13
routers/api/v1/repositories.go
Normal file
13
routers/api/v1/repositories.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
)
|
||||
|
||||
func SearchOrgRepositoreis(ctx *middleware.Context) {
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ type user struct {
|
|||
AvatarLink string `json:"avatar"`
|
||||
}
|
||||
|
||||
func SearchUser(ctx *middleware.Context) {
|
||||
func SearchUsers(ctx *middleware.Context) {
|
||||
q := ctx.Query("q")
|
||||
limit, err := base.StrTo(ctx.Query("limit")).Int()
|
||||
if err != nil {
|
||||
|
|
|
@ -47,13 +47,13 @@ func SettingPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
|
|||
if ctx.User.Name != form.UserName {
|
||||
isExist, err := models.IsUserExist(form.UserName)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "user.Setting(update: check existence)", err)
|
||||
ctx.Handle(500, "user.SettingPost(update: check existence)", err)
|
||||
return
|
||||
} else if isExist {
|
||||
ctx.RenderWithErr("User name has been taken.", "user/setting", &form)
|
||||
ctx.RenderWithErr("User name has been taken.", SETTING, &form)
|
||||
return
|
||||
} else if err = models.ChangeUserName(ctx.User, form.UserName); err != nil {
|
||||
ctx.Handle(500, "user.Setting(change user name)", err)
|
||||
ctx.Handle(500, "user.SettingPost(change user name)", err)
|
||||
return
|
||||
}
|
||||
log.Trace("%s User name changed: %s -> %s", ctx.Req.RequestURI, ctx.User.Name, form.UserName)
|
||||
|
@ -68,7 +68,7 @@ func SettingPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
|
|||
ctx.User.Avatar = base.EncodeMd5(form.Avatar)
|
||||
ctx.User.AvatarEmail = form.Avatar
|
||||
if err := models.UpdateUser(ctx.User); err != nil {
|
||||
ctx.Handle(500, "setting.Setting(UpdateUser)", err)
|
||||
ctx.Handle(500, "setting.SettingPost(UpdateUser)", err)
|
||||
return
|
||||
}
|
||||
log.Trace("%s User setting updated: %s", ctx.Req.RequestURI, ctx.User.LowerName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue