Browse Source

api/repo: fix incorrect permission values (#4309)

pull/4312/head
Unknwon 8 years ago
parent
commit
55a5ad5cdc
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      gogs.go
  2. 2
      routers/api/v1/api.go
  3. 6
      routers/api/v1/repo/repo.go
  4. 5
      routers/user/auth.go
  5. 2
      templates/.VERSION

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.10.22.0317"
const APP_VER = "0.10.23.0318"
func init() {
setting.AppVer = APP_VER

2
routers/api/v1/api.go

@ -242,7 +242,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/repos", func() {
m.Post("/migrate", bind(form.MigrateRepo{}), repo.Migrate)
m.Combo("/:username/:reponame").Get(repo.Get).
m.Combo("/:username/:reponame", repoAssignment()).Get(repo.Get).
Delete(repo.Delete)
m.Group("/:username/:reponame", func() {

6
routers/api/v1/repo/repo.go

@ -309,7 +309,11 @@ func Get(ctx *context.APIContext) {
return
}
ctx.JSON(200, repo.APIFormat(&api.Permission{true, true, true}))
ctx.JSON(200, repo.APIFormat(&api.Permission{
Admin: ctx.Repo.IsAdmin(),
Push: ctx.Repo.IsWriter(),
Pull: true,
}))
}
// https://github.com/gogits/go-gogs-client/wiki/Repositories#delete

5
routers/user/auth.go

@ -274,8 +274,9 @@ func Activate(ctx *context.Context) {
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
mailer.SendActivateAccountMail(ctx.Context, models.NewMailerUser(ctx.User))
if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
keyName := "MailResendLimit_" + ctx.User.LowerName
if err := ctx.Cache.Put(keyName, ctx.User.LowerName, 180); err != nil {
log.Error(2, "Set cache '%s' fail: %v", keyName, err)
}
}
} else {

2
templates/.VERSION

@ -1 +1 @@
0.10.22.0317
0.10.23.0318
Loading…
Cancel
Save