123456789101112131415161718192021222324252627282930 |
- package context
- import (
- "gopkg.in/macaron.v1"
- "github.com/gogs/gogs/models"
- "github.com/gogs/gogs/models/errors"
- )
- type ParamsUser struct {
- *models.User
- }
- func InjectParamsUser() macaron.Handler {
- return func(c *Context) {
- user, err := models.GetUserByName(c.Params(":username"))
- if err != nil {
- c.NotFoundOrServerError("GetUserByName", errors.IsUserNotExist, err)
- return
- }
- c.Map(&ParamsUser{user})
- }
- }
|