Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle messages without text or caption #1694

Merged
merged 1 commit into from
Sep 6, 2023
Merged

fix: handle messages without text or caption #1694

merged 1 commit into from
Sep 6, 2023

Conversation

roschaefer
Copy link
Collaborator

@roschaefer roschaefer commented Sep 5, 2023

Motivation

If our webhook controller responds with 500 then Telegram API will try to send the message over and over.

We have a particular message that we did not expect: It's a message without text (which can happen) and we receive it before the user has onboarded herself. E.g you could simulate this by sending a sticker to MAZ_Potsdam_Bot.

How to test

  1. bin/rspec ./spec/adapters/telegram_adapter/inbound_spec.rb
  2. See:
  #consume
    |message| block argument
      ...
      given the payload does not have a caption nor text
        is expected to be nil
        when UNKNOWN_CONTRIBUTOR is registered
          is expected to yield control

image

Motivation
----------
If our webhook controller responds with 500 then Telegram API will try to send the message over and over.

We have a particular message that we did not expect: It's a message without text (which can happen) and we receive it before the user has onboarded herself. E.g you could simulate this by sending a sticker to `MAZ_Potsdam_Bot`.

How to test
-----------
1. `bin/rspec ./spec/adapters/telegram_adapter/inbound_spec.rb`
2. See:
```
  #consume
    |message| block argument
      ...
      given the payload does not have a caption nor text
        is expected to be nil
        when UNKNOWN_CONTRIBUTOR is registered
          is expected to yield control
```
@roschaefer roschaefer requested a review from mattwr18 September 5, 2023 17:49
@roschaefer
Copy link
Collaborator Author

I can actually see myself on Sentry ❤️ dced1fe97cda4e889da25b654a6b7aab

@mattwr18 mattwr18 merged commit 92f5039 into main Sep 6, 2023
1 check passed
@mattwr18 mattwr18 deleted the fix-1692 branch September 6, 2023 14:28
@mattwr18
Copy link
Contributor

mattwr18 commented Sep 6, 2023

Sorry, I forgot to give you an official review @roschaefer ... I had some question about whether we should send the same unknown contributor message, but after translating it, I think it works well. Thanks for quickly fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants