mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Rename module: middleware -> context
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
"github.com/gogits/gogs/routers/repo"
|
||||
)
|
||||
@@ -21,7 +21,7 @@ const (
|
||||
STARS base.TplName = "user/meta/stars"
|
||||
)
|
||||
|
||||
func GetUserByName(ctx *middleware.Context, name string) *models.User {
|
||||
func GetUserByName(ctx *context.Context, name string) *models.User {
|
||||
user, err := models.GetUserByName(name)
|
||||
if err != nil {
|
||||
if models.IsErrUserNotExist(err) {
|
||||
@@ -35,11 +35,11 @@ func GetUserByName(ctx *middleware.Context, name string) *models.User {
|
||||
}
|
||||
|
||||
// GetUserByParams returns user whose name is presented in URL paramenter.
|
||||
func GetUserByParams(ctx *middleware.Context) *models.User {
|
||||
func GetUserByParams(ctx *context.Context) *models.User {
|
||||
return GetUserByName(ctx, ctx.Params(":username"))
|
||||
}
|
||||
|
||||
func Profile(ctx *middleware.Context) {
|
||||
func Profile(ctx *context.Context) {
|
||||
uname := ctx.Params(":username")
|
||||
// Special handle for FireFox requests favicon.ico.
|
||||
if uname == "favicon.ico" {
|
||||
@@ -103,7 +103,7 @@ func Profile(ctx *middleware.Context) {
|
||||
ctx.HTML(200, PROFILE)
|
||||
}
|
||||
|
||||
func Followers(ctx *middleware.Context) {
|
||||
func Followers(ctx *context.Context) {
|
||||
u := GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -115,7 +115,7 @@ func Followers(ctx *middleware.Context) {
|
||||
repo.RenderUserCards(ctx, u.NumFollowers, u.GetFollowers, FOLLOWERS)
|
||||
}
|
||||
|
||||
func Following(ctx *middleware.Context) {
|
||||
func Following(ctx *context.Context) {
|
||||
u := GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -127,11 +127,11 @@ func Following(ctx *middleware.Context) {
|
||||
repo.RenderUserCards(ctx, u.NumFollowing, u.GetFollowing, FOLLOWERS)
|
||||
}
|
||||
|
||||
func Stars(ctx *middleware.Context) {
|
||||
func Stars(ctx *context.Context) {
|
||||
|
||||
}
|
||||
|
||||
func Action(ctx *middleware.Context) {
|
||||
func Action(ctx *context.Context) {
|
||||
u := GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
Reference in New Issue
Block a user