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

Address Telegram HTTP 500s when receiving message from Telegram in discussion group #3622

Merged
merged 9 commits into from
Jan 9, 2024

Conversation

joeyorlando
Copy link
Contributor

Which issue(s) this PR fixes

Closes #3621

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@joeyorlando joeyorlando added the pr:no public docs Added to a PR that does not require public documentation updates label Jan 5, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another possibility is to add an "update handler" for messages originating directly in a channel (not a discussion group). For these HTTP 500s that we are seeing, they occur when a message is sent from the official Telegram user directly in a channel, not the channel's discussion group.

Right now we're handling these updates w/ the apps.telegram.updates.update_handlers.channel_to_group_forward.ChannelToGroupForwardHandler handler (this handler is determined here).

For now, what I've done in this PR seems like a simpler approach to arrive at the same solution, but open to thoughts/comments.

@joeyorlando joeyorlando marked this pull request as ready for review January 8, 2024 15:25
@joeyorlando joeyorlando requested a review from a team January 8, 2024 15:25
Comment on lines -446 to -458
@pytest.fixture
def client_with_user():
def _client_with_user(user):
"""The client with logged in user"""

client = APIClient()
client.force_login(user)

return client

return _client_with_user


Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't appear to be used anywhere

Copy link
Contributor

@matiasb matiasb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

from rest_framework import status
from rest_framework.test import APIClient

url = reverse("telegram:incoming_webhook")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, I guess I would have this as a local var in each test initial setup

@joeyorlando joeyorlando merged commit 4cc4099 into dev Jan 9, 2024
16 of 21 checks passed
@joeyorlando joeyorlando deleted the jorlando/fix-telegram-500s branch January 9, 2024 13:31
iskhakov pushed a commit that referenced this pull request Feb 20, 2024
…scussion group (#3622)

# Which issue(s) this PR fixes

Closes #3621

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegram HTTP 500s when receiving message from Telegram in discussion group
2 participants