diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-01-03 14:17:15 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-01-03 14:17:15 -0500 |
commit | 29093fb09a4d55589d03a83fc07d8300e6e8e4fe (patch) | |
tree | da9127143ff1ae7585d279477088b83e3ed794ce | |
parent | ebb4f5797aec4bf2c8cdc116aecdbd698468d62e (diff) | |
download | korg-helpers-29093fb09a4d55589d03a83fc07d8300e6e8e4fe.tar.gz |
groupsio-webhook: don't check for action
Valid messages may come in with other actions than just
"sent_message_accepted" (e.g. "sent_message_moderated" or
"sent_message_not_subscriber"), so accept everything that contains the
message payload.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | groupsio-webhook.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/groupsio-webhook.py b/groupsio-webhook.py index e11ef84..f1922ad 100644 --- a/groupsio-webhook.py +++ b/groupsio-webhook.py @@ -6,7 +6,7 @@ # __author__ = 'Konstantin Ryabitsev <konstantin@linuxfoundation.org>' -import falcon +import falcon # noqa import json import socket import email @@ -119,7 +119,7 @@ class GroupsioListener(object): def _write_pi(self, pirepo: str, msg: email.message.Message) -> bool: success = False try: - import ezpi + import ezpi # noqa ezpi.add_rfc822(pirepo, msg) ezpi.run_hook(pirepo) logger.info('Wrote to public-inbox at %s', pirepo) @@ -198,8 +198,10 @@ class GroupsioListener(object): return success = True - if doc.get('action', '') == 'sent_message_accepted' and 'message' in doc: + if 'message' in doc and len(doc.get('message')): success = self._inject_message(doc, req) + else: + logger.debug('No message in payload, skipping') if success: resp.status = falcon.HTTP_200 |