-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create Default Webhooks #24624
Labels
Comments
This seems similar to #23139, in that it regards instability in the |
@kousu would you like to send a PR to fix it? |
I will if I figure out what's wrong! |
This doesn't appear on 8ceb78c = v1.19.3; with that, it works as expected:
|
Ah, http://localhost:3000/admin/default-hooks/gitea/new generates
So it's the rendering side of the GET request that's confused. PR in #24626 🎉 |
kousu
added a commit
to neuropoly/gitea
that referenced
this issue
May 10, 2023
Fixes go-gitea#24624 This seems to have been broken in go-gitea#21563 Previously, the code read ``` // Are we looking at default webhooks? if ctx.Params(":configType") == "default-hooks" { return &orgRepoCtx{ IsAdmin: true, Link: path.Join(setting.AppSubURL, "/admin/hooks"), LinkNew: path.Join(setting.AppSubURL, "/admin/default-hooks"), NewTemplate: tplAdminHookNew, }, nil } // Must be system webhooks instead return &orgRepoCtx{ IsAdmin: true, IsSystemWebhook: true, Link: path.Join(setting.AppSubURL, "/admin/hooks"), LinkNew: path.Join(setting.AppSubURL, "/admin/system-hooks"), NewTemplate: tplAdminHookNew, }, nil ``` but was simplified to ``` return &ownerRepoCtx{ IsAdmin: true, IsSystemWebhook: ctx.Params(":configType") == "system-hooks", Link: path.Join(setting.AppSubURL, "/admin/hooks"), LinkNew: path.Join(setting.AppSubURL, "/admin/system-hooks"), NewTemplate: tplAdminHookNew, }, nil ``` combining the IsSystemWebhook check into a one-liner, but forgtting the same for LinkNew.
lunny
pushed a commit
that referenced
this issue
May 11, 2023
Fixes #24624 This seems to have been broken in #21563 Previously, this code read ``` // Are we looking at default webhooks? if ctx.Params(":configType") == "default-hooks" { return &orgRepoCtx{ IsAdmin: true, Link: path.Join(setting.AppSubURL, "/admin/hooks"), LinkNew: path.Join(setting.AppSubURL, "/admin/default-hooks"), NewTemplate: tplAdminHookNew, }, nil } // Must be system webhooks instead return &orgRepoCtx{ IsAdmin: true, IsSystemWebhook: true, Link: path.Join(setting.AppSubURL, "/admin/hooks"), LinkNew: path.Join(setting.AppSubURL, "/admin/system-hooks"), NewTemplate: tplAdminHookNew, }, nil ``` but was simplified to ``` return &ownerRepoCtx{ IsAdmin: true, IsSystemWebhook: ctx.Params(":configType") == "system-hooks", Link: path.Join(setting.AppSubURL, "/admin/hooks"), LinkNew: path.Join(setting.AppSubURL, "/admin/system-hooks"), NewTemplate: tplAdminHookNew, }, nil ``` In other words, combining the `IsSystemWebhook` check into a one-liner and forgetting that `LinkNew` also depended on it. This meant the rendered `<form>` always POSTed to `/admin/system-hooks`, even when you had GETed `/admin/default-hooks/gitea/new`.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
As of 9a0652f, the current
main
, it is impossible to create Default Webhooks using/admin/default-hooks/gitea/new
. They are instead added as system webhooks, producing these database rows; notice thatis_system_webhook = 1
in both:Gitea Version
9a0652f
Can you reproduce the bug on the Gitea demo site?
No -- but only because I don't have admin rights there
Log Gist
https://gist.github.com/kousu/8cf00c3a7a6a032679a76d1bc2fda47b
Screenshots
"Add a new default webhook":
Adds it as a system webhook:
Git Version
2.34.1
Operating System
Ubuntu 22.04
How are you running Gitea?
Built from git, run with
./gitea
Database
SQLite
The text was updated successfully, but these errors were encountered: