Skip to content

Commit

Permalink
Fix to not stop contact for other errors
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed May 4, 2022
1 parent 470cd9d commit d2d537c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion handlers/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion handlers/telegram/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d2d537c

Please sign in to comment.