From 49d76639295a89bac8a656360782f0c3a1d2707c Mon Sep 17 00:00:00 2001 From: 6543 Date: Sun, 21 Jan 2024 14:42:35 +0100 Subject: [PATCH] Revert adding htmx until we finaly decide to add it (#28879) --- package-lock.json | 6 ------ package.json | 1 - routers/web/repo/issue_watch.go | 9 +-------- routers/web/user/profile.go | 11 ++--------- templates/repo/issue/view_content/sidebar.tmpl | 14 +++++++++++++- templates/repo/issue/view_content/watching.tmpl | 13 ------------- templates/shared/user/profile_big_avatar.tmpl | 8 ++++---- web_src/js/features/common-global.js | 1 - webpack.config.js | 1 - 9 files changed, 20 insertions(+), 44 deletions(-) delete mode 100644 templates/repo/issue/view_content/watching.tmpl diff --git a/package-lock.json b/package-lock.json index d73fc5df5a..b299967eba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "esbuild-loader": "4.0.2", "escape-goat": "4.0.0", "fast-glob": "3.3.2", - "htmx.org": "1.9.10", "jquery": "3.7.1", "katex": "0.16.9", "license-checker-webpack-plugin": "0.2.1", @@ -6159,11 +6158,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/htmx.org": { - "version": "1.9.10", - "resolved": "https://registry.npmjs.org/htmx.org/-/htmx.org-1.9.10.tgz", - "integrity": "sha512-UgchasltTCrTuU2DQLom3ohHrBvwr7OqpwyAVJ9VxtNBng4XKkVsqrv0Qr3srqvM9ZNI3f1MmvVQQqK7KW/bTA==" - }, "node_modules/http-proxy-agent": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", diff --git a/package.json b/package.json index 5c6de1dd62..801e85db83 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "esbuild-loader": "4.0.2", "escape-goat": "4.0.0", "fast-glob": "3.3.2", - "htmx.org": "1.9.10", "jquery": "3.7.1", "katex": "0.16.9", "license-checker-webpack-plugin": "0.2.1", diff --git a/routers/web/repo/issue_watch.go b/routers/web/repo/issue_watch.go index 1f51ceba5e..1cb5cc7162 100644 --- a/routers/web/repo/issue_watch.go +++ b/routers/web/repo/issue_watch.go @@ -8,15 +8,10 @@ import ( "strconv" issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" ) -const ( - tplWatching base.TplName = "repo/issue/view_content/watching" -) - // IssueWatch sets issue watching func IssueWatch(ctx *context.Context) { issue := GetActionIssue(ctx) @@ -57,7 +52,5 @@ func IssueWatch(ctx *context.Context) { return } - ctx.Data["Issue"] = issue - ctx.Data["IssueWatch"] = &issues_model.IssueWatch{IsWatching: watch} - ctx.HTML(http.StatusOK, tplWatching) + ctx.Redirect(issue.Link()) } diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 73ab93caed..c5305ebcd9 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/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 6c13eef023..4334e4bcbd 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -270,7 +270,19 @@
{{ctx.Locale.Tr "notification.notifications"}}
- {{template "repo/issue/view_content/watching" .}} +
+ + {{$.CsrfTokenHtml}} + +
{{end}} diff --git a/templates/repo/issue/view_content/watching.tmpl b/templates/repo/issue/view_content/watching.tmpl deleted file mode 100644 index 06b9d9af33..0000000000 --- a/templates/repo/issue/view_content/watching.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -
- - {{$.CsrfTokenHtml}} - -
diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl index 7afc852d1b..a637a9a5f9 100644 --- a/templates/shared/user/profile_big_avatar.tmpl +++ b/templates/shared/user/profile_big_avatar.tmpl @@ -1,4 +1,4 @@ -
+