summaryrefslogtreecommitdiffstats
path: root/services/webhook/matrix.go
diff options
context:
space:
mode:
authordelvh <leon@kske.dev>2023-01-01 16:23:15 +0100
committerGitHub <noreply@github.com>2023-01-01 23:23:15 +0800
commit0f4e1b9ac66b8ffa0083a5a2516e4710393bb0da (patch)
tree4514951316ebfb10dabf1ffbc856142839817a80 /services/webhook/matrix.go
parentf8e93ce4238253c01e3ca36c88eb59979be99d12 (diff)
downloadgitea-0f4e1b9ac66b8ffa0083a5a2516e4710393bb0da.tar.gz
gitea-0f4e1b9ac66b8ffa0083a5a2516e4710393bb0da.zip
Restructure `webhook` module (#22256)
Previously, there was an `import services/webhooks` inside `modules/notification/webhook`. This import was removed (after fighting against many import cycles). Additionally, `modules/notification/webhook` was moved to `modules/webhook`, and a few structs/constants were extracted from `models/webhooks` to `modules/webhook`. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'services/webhook/matrix.go')
-rw-r--r--services/webhook/matrix.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/webhook/matrix.go b/services/webhook/matrix.go
index bd3efd46b2..cf2b503cdc 100644
--- a/services/webhook/matrix.go
+++ b/services/webhook/matrix.go
@@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
+ webhook_module "code.gitea.io/gitea/modules/webhook"
)
const matrixPayloadSizeLimit = 1024 * 64
@@ -173,7 +174,7 @@ func (m *MatrixPayload) PullRequest(p *api.PullRequestPayload) (api.Payloader, e
}
// Review implements PayloadConvertor Review method
-func (m *MatrixPayload) Review(p *api.PullRequestPayload, event webhook_model.HookEventType) (api.Payloader, error) {
+func (m *MatrixPayload) Review(p *api.PullRequestPayload, event webhook_module.HookEventType) (api.Payloader, error) {
senderLink := MatrixLinkFormatter(setting.AppURL+url.PathEscape(p.Sender.UserName), p.Sender.UserName)
title := fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title)
titleLink := MatrixLinkFormatter(p.PullRequest.URL, title)
@@ -210,7 +211,7 @@ func (m *MatrixPayload) Repository(p *api.RepositoryPayload) (api.Payloader, err
}
// GetMatrixPayload converts a Matrix webhook into a MatrixPayload
-func GetMatrixPayload(p api.Payloader, event webhook_model.HookEventType, meta string) (api.Payloader, error) {
+func GetMatrixPayload(p api.Payloader, event webhook_module.HookEventType, meta string) (api.Payloader, error) {
s := new(MatrixPayload)
matrix := &MatrixMeta{}