From 0a201f4b5e42f32a53f0da38d0ebc6dd93b77fc5 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 21 Jan 2024 14:10:33 +0100 Subject: [PATCH 1/2] Revert "Don't do a full page load when clicking the follow button (#28872)" This reverts commit 1df06e3f399307c14b60a2b88e1b26cedc1ae2f9. --- routers/web/user/profile.go | 11 ++--------- templates/shared/user/profile_big_avatar.tmpl | 8 ++++---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 73ab93caed5a..c5305ebcd9f4 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -14,7 +14,6 @@ import ( "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" @@ -27,10 +26,6 @@ import ( shared_user "code.gitea.io/gitea/routers/web/shared/user" ) -const ( - tplProfileBigAvatar base.TplName = "shared/user/profile_big_avatar" -) - // OwnerProfile render profile page for a user or a organization (aka, repo owner) func OwnerProfile(ctx *context.Context) { if strings.Contains(ctx.Req.Header.Get("Accept"), "application/rss+xml") { @@ -314,10 +309,8 @@ func Action(ctx *context.Context) { if err != nil { log.Error("Failed to apply action %q: %v", ctx.FormString("action"), err) - ctx.Error(http.StatusBadRequest, fmt.Sprintf("Action %q failed", ctx.FormString("action"))) + ctx.JSONError(fmt.Sprintf("Action %q failed", ctx.FormString("action"))) return } - - shared_user.PrepareContextForProfileBigAvatar(ctx) - ctx.HTML(http.StatusOK, tplProfileBigAvatar) + ctx.JSONOK() } diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl index 7afc852d1b57..a637a9a5f915 100644 --- a/templates/shared/user/profile_big_avatar.tmpl +++ b/templates/shared/user/profile_big_avatar.tmpl @@ -1,4 +1,4 @@ -
+
{{if eq .SignedUserID .ContextUser.ID}} @@ -110,13 +110,13 @@ {{end}} {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}} -