mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-04 13:50:39 +00:00
Decouple HookTask from Repository (#17940)
At the moment a repository reference is needed for webhooks. With the upcoming package PR we need to send webhooks without a repository reference. For example a package is uploaded to an organization. In theory this enables the usage of webhooks for future user actions. This PR removes the repository id from `HookTask` and changes how the hooks are processed (see `services/webhook/deliver.go`). In a follow up PR I want to remove the usage of the `UniqueQueue´ and replace it with a normal queue because there is no reason to be unique. Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
e828564445
commit
1887c95254
12 changed files with 219 additions and 282 deletions
|
@ -19,13 +19,6 @@ import (
|
|||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
// __ __ ___. .__ __
|
||||
// / \ / \ ____\_ |__ | |__ ____ ____ | | __
|
||||
// \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
|
||||
// \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
|
||||
// \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
|
||||
// \/ \/ \/ \/ \/
|
||||
|
||||
// ErrWebhookNotExist represents a "WebhookNotExist" kind of error.
|
||||
type ErrWebhookNotExist struct {
|
||||
ID int64
|
||||
|
@ -47,6 +40,7 @@ func (err ErrWebhookNotExist) Unwrap() error {
|
|||
|
||||
// ErrHookTaskNotExist represents a "HookTaskNotExist" kind of error.
|
||||
type ErrHookTaskNotExist struct {
|
||||
TaskID int64
|
||||
HookID int64
|
||||
UUID string
|
||||
}
|
||||
|
@ -58,7 +52,7 @@ func IsErrHookTaskNotExist(err error) bool {
|
|||
}
|
||||
|
||||
func (err ErrHookTaskNotExist) Error() string {
|
||||
return fmt.Sprintf("hook task does not exist [hook: %d, uuid: %s]", err.HookID, err.UUID)
|
||||
return fmt.Sprintf("hook task does not exist [task: %d, hook: %d, uuid: %s]", err.TaskID, err.HookID, err.UUID)
|
||||
}
|
||||
|
||||
func (err ErrHookTaskNotExist) Unwrap() error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue