mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Renamed ctx.User to ctx.Doer. (#19161)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -93,7 +93,7 @@ func Profile(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// check view permissions
|
||||
if !models.IsUserVisibleToViewer(ctxUser, ctx.User) {
|
||||
if !models.IsUserVisibleToViewer(ctxUser, ctx.Doer) {
|
||||
ctx.NotFound("user", fmt.Errorf(uname))
|
||||
return
|
||||
}
|
||||
@@ -127,8 +127,8 @@ func Profile(ctx *context.Context) {
|
||||
}
|
||||
|
||||
var isFollowing bool
|
||||
if ctx.User != nil && ctxUser != nil {
|
||||
isFollowing = user_model.IsFollowing(ctx.User.ID, ctxUser.ID)
|
||||
if ctx.Doer != nil && ctxUser != nil {
|
||||
isFollowing = user_model.IsFollowing(ctx.Doer.ID, ctxUser.ID)
|
||||
}
|
||||
|
||||
ctx.Data["Title"] = ctxUser.DisplayName()
|
||||
@@ -138,7 +138,7 @@ func Profile(ctx *context.Context) {
|
||||
ctx.Data["IsFollowing"] = isFollowing
|
||||
|
||||
if setting.Service.EnableUserHeatmap {
|
||||
data, err := models.GetUserHeatmapDataByUser(ctxUser, ctx.User)
|
||||
data, err := models.GetUserHeatmapDataByUser(ctxUser, ctx.Doer)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserHeatmapDataByUser", err)
|
||||
return
|
||||
@@ -160,7 +160,7 @@ func Profile(ctx *context.Context) {
|
||||
ctx.Data["RenderedDescription"] = content
|
||||
}
|
||||
|
||||
showPrivate := ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID)
|
||||
showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctxUser.ID)
|
||||
|
||||
orgs, err := models.FindOrgs(models.FindOrgOptions{
|
||||
UserID: ctxUser.ID,
|
||||
@@ -172,7 +172,7 @@ func Profile(ctx *context.Context) {
|
||||
}
|
||||
|
||||
ctx.Data["Orgs"] = orgs
|
||||
ctx.Data["HasOrgsVisible"] = models.HasOrgsVisible(orgs, ctx.User)
|
||||
ctx.Data["HasOrgsVisible"] = models.HasOrgsVisible(orgs, ctx.Doer)
|
||||
|
||||
tab := ctx.FormString("tab")
|
||||
ctx.Data["TabName"] = tab
|
||||
@@ -252,7 +252,7 @@ func Profile(ctx *context.Context) {
|
||||
case "activity":
|
||||
ctx.Data["Feeds"], err = models.GetFeeds(ctx, models.GetFeedsOptions{
|
||||
RequestedUser: ctxUser,
|
||||
Actor: ctx.User,
|
||||
Actor: ctx.Doer,
|
||||
IncludePrivate: showPrivate,
|
||||
OnlyPerformedBy: true,
|
||||
IncludeDeleted: false,
|
||||
@@ -269,7 +269,7 @@ func Profile(ctx *context.Context) {
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
},
|
||||
Actor: ctx.User,
|
||||
Actor: ctx.Doer,
|
||||
Keyword: keyword,
|
||||
OrderBy: orderBy,
|
||||
Private: ctx.IsSigned,
|
||||
@@ -301,7 +301,7 @@ func Profile(ctx *context.Context) {
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
},
|
||||
Actor: ctx.User,
|
||||
Actor: ctx.Doer,
|
||||
Keyword: keyword,
|
||||
OrderBy: orderBy,
|
||||
Private: ctx.IsSigned,
|
||||
@@ -323,7 +323,7 @@ func Profile(ctx *context.Context) {
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
},
|
||||
Actor: ctx.User,
|
||||
Actor: ctx.Doer,
|
||||
Keyword: keyword,
|
||||
OwnerID: ctxUser.ID,
|
||||
OrderBy: orderBy,
|
||||
@@ -350,7 +350,7 @@ func Profile(ctx *context.Context) {
|
||||
}
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["ShowUserEmail"] = len(ctxUser.Email) > 0 && ctx.IsSigned && (!ctxUser.KeepEmailPrivate || ctxUser.ID == ctx.User.ID)
|
||||
ctx.Data["ShowUserEmail"] = len(ctxUser.Email) > 0 && ctx.IsSigned && (!ctxUser.KeepEmailPrivate || ctxUser.ID == ctx.Doer.ID)
|
||||
|
||||
ctx.HTML(http.StatusOK, tplProfile)
|
||||
}
|
||||
@@ -365,9 +365,9 @@ func Action(ctx *context.Context) {
|
||||
var err error
|
||||
switch ctx.FormString("action") {
|
||||
case "follow":
|
||||
err = user_model.FollowUser(ctx.User.ID, u.ID)
|
||||
err = user_model.FollowUser(ctx.Doer.ID, u.ID)
|
||||
case "unfollow":
|
||||
err = user_model.UnfollowUser(ctx.User.ID, u.ID)
|
||||
err = user_model.UnfollowUser(ctx.Doer.ID, u.ID)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user