From 1dd8a7608f06c08fe059cbb1e8a6010b1eca270a Mon Sep 17 00:00:00 2001 From: jonatan Date: Sat, 28 May 2022 20:33:24 +0300 Subject: [PATCH 1/3] fix(telegram): fix link bot to release tag --- services/webhook/general.go | 2 +- services/webhook/telegram_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/webhook/general.go b/services/webhook/general.go index 5080cf98dc609..e8006fabaee20 100644 --- a/services/webhook/general.go +++ b/services/webhook/general.go @@ -141,7 +141,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm func getReleasePayloadInfo(p *api.ReleasePayload, linkFormatter linkFormatter, withSender bool) (text string, color int) { repoLink := linkFormatter(p.Repository.HTMLURL, p.Repository.FullName) - refLink := linkFormatter(p.Repository.HTMLURL+"/src/"+util.PathEscapeSegments(p.Release.TagName), p.Release.TagName) + refLink := linkFormatter(p.Repository.HTMLURL+"/releases/tag/"+util.PathEscapeSegments(p.Release.TagName), p.Release.TagName) switch p.Action { case api.HookReleasePublished: diff --git a/services/webhook/telegram_test.go b/services/webhook/telegram_test.go index 6a3682847cba9..2f83090166fa4 100644 --- a/services/webhook/telegram_test.go +++ b/services/webhook/telegram_test.go @@ -154,7 +154,7 @@ func TestTelegramPayload(t *testing.T) { require.NotNil(t, pl) require.IsType(t, &TelegramPayload{}, pl) - assert.Equal(t, `[test/repo] Release created: v1.0 by user1`, pl.(*TelegramPayload).Message) + assert.Equal(t, `[test/repo] Release created: v1.0 by user1`, pl.(*TelegramPayload).Message) }) } From c0639b29c89849bebb299240a24e47b80797d627 Mon Sep 17 00:00:00 2001 From: jonatan Date: Sat, 28 May 2022 21:07:04 +0300 Subject: [PATCH 2/3] test(webhook): fix matrixPayload Release --- services/webhook/matrix_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/webhook/matrix_test.go b/services/webhook/matrix_test.go index 3cc7c7518fc49..34196aedf04e5 100644 --- a/services/webhook/matrix_test.go +++ b/services/webhook/matrix_test.go @@ -165,8 +165,8 @@ func TestMatrixPayload(t *testing.T) { require.NotNil(t, pl) require.IsType(t, &MatrixPayloadUnsafe{}, pl) - assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Release created: [v1.0](http://localhost:3000/test/repo/src/v1.0) by [user1](https://try.gitea.io/user1)", pl.(*MatrixPayloadUnsafe).Body) - assert.Equal(t, `[test/repo] Release created: v1.0 by user1`, pl.(*MatrixPayloadUnsafe).FormattedBody) + assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Release created: [v1.0](http://localhost:3000/test/repo/releases/tag/v1.0) by [user1](https://try.gitea.io/user1)", pl.(*MatrixPayloadUnsafe).Body) + assert.Equal(t, `[test/repo] Release created: v1.0 by user1`, pl.(*MatrixPayloadUnsafe).FormattedBody) }) } From cc01c220e648f062eb11f899f85fae91e7e9d594 Mon Sep 17 00:00:00 2001 From: jonatan Date: Sat, 28 May 2022 22:56:10 +0300 Subject: [PATCH 3/3] test(webhook): fix TestTelegramPayload Release --- services/webhook/slack_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/webhook/slack_test.go b/services/webhook/slack_test.go index 1fa777732868a..8278afb69a8c6 100644 --- a/services/webhook/slack_test.go +++ b/services/webhook/slack_test.go @@ -154,7 +154,7 @@ func TestSlackPayload(t *testing.T) { require.NotNil(t, pl) require.IsType(t, &SlackPayload{}, pl) - assert.Equal(t, "[] Release created: by ", pl.(*SlackPayload).Text) + assert.Equal(t, "[] Release created: by ", pl.(*SlackPayload).Text) }) }