summaryrefslogtreecommitdiff
path: root/postgresqleu
diff options
context:
space:
mode:
authorMagnus Hagander2023-03-22 16:50:51 +0000
committerMagnus Hagander2023-03-22 16:50:51 +0000
commitb3867fd6751e722eced869438f088b352db8bd5c (patch)
tree7cf97449c867726ed2ca8681b2bbde8965f5cdcc /postgresqleu
parenta0fee35a2cf1e79cc71bceff9f4a7577c9de7d38 (diff)
Don't crash if there are no channels at all on a telegram provider
When trying to notify about twitter moderation, we would correctly exit with no issues if there was a telegram provider configured but it had no channel for social media management configured. But if it had no channels *at all* configured, we'd crash. Fix that for an early exit in this case as well.
Diffstat (limited to 'postgresqleu')
-rw-r--r--postgresqleu/util/messaging/telegram.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/postgresqleu/util/messaging/telegram.py b/postgresqleu/util/messaging/telegram.py
index ec460170..25c8b558 100644
--- a/postgresqleu/util/messaging/telegram.py
+++ b/postgresqleu/util/messaging/telegram.py
@@ -413,6 +413,10 @@ class Telegram(object):
return True, ''
def notify_twitter_moderation(self, messaging, tweet, completed, approved=False):
+ if 'channels' not in messaging.config:
+ # If we don't have any channels configure d*at all*, then there is definitely
+ # nothing to do and we shouldn't crash.
+ return
if 'socialmediamanagement' not in messaging.config['channels']:
# If we don't have a social media channel, then there is nothing to do!
return