From d2d537ca0c28ad0af8ee6d3642f2aff20c069452 Mon Sep 17 00:00:00 2001 From: Norbert Kwizera Date: Wed, 4 May 2022 16:32:17 +0200 Subject: [PATCH] Fix to not stop contact for other errors --- handlers/telegram/telegram.go | 2 +- handlers/telegram/telegram_test.go | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/handlers/telegram/telegram.go b/handlers/telegram/telegram.go index 71ed80349..08bfa78e7 100644 --- a/handlers/telegram/telegram.go +++ b/handlers/telegram/telegram.go @@ -176,7 +176,7 @@ func (h *handler) sendMsgPart(msg courier.Msg, token string, path string, form u if response.Result.MessageID > 0 { return strconv.FormatInt(response.Result.MessageID, 10), log, false, nil } - return "", log, true, errors.Errorf("no 'result.message_id' in response") + return "", log, false, errors.Errorf("no 'result.message_id' in response") } // SendMsg sends the passed in message, returning any error diff --git a/handlers/telegram/telegram_test.go b/handlers/telegram/telegram_test.go index d8c1c343d..c2e11f53f 100644 --- a/handlers/telegram/telegram_test.go +++ b/handlers/telegram/telegram_test.go @@ -615,7 +615,17 @@ var defaultSendTestCases = []ChannelSendTestCase{ PostParams: map[string]string{"text": `Stopped Contact`, "chat_id": "12345"}, SendPrep: setSendURL, Stopped: true}, - + {Label: "Should not stop other error", + Text: "Simple Message", URN: "telegram:12345", + Status: "E", + ResponseBody: `{ "ok": true }`, ResponseStatus: 200, + PostParams: map[string]string{ + "text": "Simple Message", + "chat_id": "12345", + "reply_markup": `{"remove_keyboard":true}`, + }, + SendPrep: setSendURL, + Stopped: false}, {Label: "Send Photo", Text: "My pic!", URN: "telegram:12345", Attachments: []string{"image/jpeg:https://foo.bar/image.jpg"}, Status: "W",