diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go
index a83d7f7333..24b0db2f1d 100644
--- a/routers/web/user/profile.go
+++ b/routers/web/user/profile.go
@@ -341,7 +341,6 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
// Action response for follow/unfollow user request
func Action(ctx *context.Context) {
var err error
- var redirectViaJSON bool
action := ctx.FormString("action")
if ctx.ContextUser.IsOrganization() && (action == "block" || action == "unblock") {
@@ -357,10 +356,8 @@ func Action(ctx *context.Context) {
err = user_model.UnfollowUser(ctx, ctx.Doer.ID, ctx.ContextUser.ID)
case "block":
err = user_service.BlockUser(ctx, ctx.Doer.ID, ctx.ContextUser.ID)
- redirectViaJSON = true
case "unblock":
err = user_model.UnblockUser(ctx, ctx.Doer.ID, ctx.ContextUser.ID)
- redirectViaJSON = true
}
if err != nil {
@@ -371,21 +368,15 @@ func Action(ctx *context.Context) {
}
if ctx.ContextUser.IsOrganization() {
- ctx.Flash.Error(ctx.Tr("org.follow_blocked_user"))
+ ctx.Flash.Error(ctx.Tr("org.follow_blocked_user"), true)
} else {
- ctx.Flash.Error(ctx.Tr("user.follow_blocked_user"))
+ ctx.Flash.Error(ctx.Tr("user.follow_blocked_user"), true)
}
}
- if redirectViaJSON {
- ctx.JSON(http.StatusOK, map[string]any{
- "redirect": ctx.ContextUser.HomeLink(),
- })
- return
- }
-
if ctx.ContextUser.IsIndividual() {
shared_user.PrepareContextForProfileBigAvatar(ctx)
+ ctx.Data["IsHTMX"] = true
ctx.HTML(http.StatusOK, tplProfileBigAvatar)
return
} else if ctx.ContextUser.IsOrganization() {
diff --git a/templates/base/alert.tmpl b/templates/base/alert.tmpl
index 760d3bfa2c..b2deab5c2d 100644
--- a/templates/base/alert.tmpl
+++ b/templates/base/alert.tmpl
@@ -1,20 +1,23 @@
{{if .Flash.ErrorMsg}}
-
+
{{.Flash.ErrorMsg | SanitizeHTML}}
{{end}}
{{if .Flash.SuccessMsg}}
-
+
{{.Flash.SuccessMsg | SanitizeHTML}}
{{end}}
{{if .Flash.InfoMsg}}
-
+
{{.Flash.InfoMsg | SanitizeHTML}}
{{end}}
{{if .Flash.WarningMsg}}
-
+
{{.Flash.WarningMsg | SanitizeHTML}}
{{end}}
+{{if and (not .Flash.ErrorMsg) (not .Flash.SuccessMsg) (not .Flash.InfoMsg) (not .Flash.WarningMsg) (not .IsHTMX)}}
+
+{{end}}
diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl
index 3063aeacf7..6795eaed2c 100644
--- a/templates/shared/user/profile_big_avatar.tmpl
+++ b/templates/shared/user/profile_big_avatar.tmpl
@@ -1,4 +1,7 @@
-
+{{if .IsHTMX}}
+ {{template "base/alert" .}}
+{{end}}
+
{{if eq .SignedUserID .ContextUser.ID}}
@@ -98,7 +101,7 @@
{{end}}
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
-
+
{{if $.IsFollowing}}
{{end}}
-
+
{{if $.IsBlocked}}
-