From c04166b0e7ff43fa04cc7fa2823e382bec10311b Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sun, 17 Mar 2024 14:07:27 +0100 Subject: [PATCH 1/3] fix telegram webhook --- services/webhook/telegram.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/webhook/telegram.go b/services/webhook/telegram.go index e4a5b5a4246fa..875f58dabc64f 100644 --- a/services/webhook/telegram.go +++ b/services/webhook/telegram.go @@ -181,7 +181,8 @@ func (t telegramConvertor) Package(p *api.PackagePayload) (TelegramPayload, erro func createTelegramPayload(message string) TelegramPayload { return TelegramPayload{ - Message: strings.TrimSpace(message), + Message: strings.TrimSpace(message), + ParseMode: "HTML", } } From 164474e4244a7169371650a7736fdb57c6520bd5 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sun, 17 Mar 2024 14:34:08 +0100 Subject: [PATCH 2/3] add disableWebPreview --- services/webhook/telegram.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/webhook/telegram.go b/services/webhook/telegram.go index 875f58dabc64f..c2b4820032411 100644 --- a/services/webhook/telegram.go +++ b/services/webhook/telegram.go @@ -181,8 +181,9 @@ func (t telegramConvertor) Package(p *api.PackagePayload) (TelegramPayload, erro func createTelegramPayload(message string) TelegramPayload { return TelegramPayload{ - Message: strings.TrimSpace(message), - ParseMode: "HTML", + Message: strings.TrimSpace(message), + ParseMode: "HTML", + DisableWebPreview: true, } } From 9bf0900fe707018fae7f8a5c9f8c83eee769683e Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sun, 17 Mar 2024 14:42:01 +0100 Subject: [PATCH 3/3] add test --- services/webhook/telegram_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/webhook/telegram_test.go b/services/webhook/telegram_test.go index 27ab96cd09ade..2fe5161b22879 100644 --- a/services/webhook/telegram_test.go +++ b/services/webhook/telegram_test.go @@ -18,6 +18,15 @@ import ( func TestTelegramPayload(t *testing.T) { tc := telegramConvertor{} + + t.Run("Correct webhook params", func(t *testing.T) { + p := createTelegramPayload("testMsg ") + + assert.Equal(t, "HTML", p.ParseMode) + assert.Equal(t, true, p.DisableWebPreview) + assert.Equal(t, "testMsg", p.Message) + }) + t.Run("Create", func(t *testing.T) { p := createTestPayload()