diff options
author | Nick <nick.guenther@polymtl.ca> | 2023-05-10 22:10:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 10:10:57 +0800 |
commit | 3d9ed62f4aee91f5281c6ff47053d6ecafe3fd9b (patch) | |
tree | db14a05d51197bdb3000b02768a6192f86043e2e /modules/migration/uploader.go | |
parent | a54c8b4ce900caee7b41b813c7c728e57618fd95 (diff) | |
download | gitea-3d9ed62f4aee91f5281c6ff47053d6ecafe3fd9b.tar.gz gitea-3d9ed62f4aee91f5281c6ff47053d6ecafe3fd9b.zip |
Reenable creating default webhooks. (#24626)
Fixes #24624
This seems to have been broken in
https://github.com/go-gitea/gitea/pull/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`.
Diffstat (limited to 'modules/migration/uploader.go')
0 files changed, 0 insertions, 0 deletions