Implement messaging config validation for Mastodon
authorMagnus Hagander <magnus@hagander.net>
Sat, 18 May 2024 08:28:18 +0000 (10:28 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sat, 18 May 2024 09:59:43 +0000 (11:59 +0200)
This was clearly missed when Mastordon support was added, and is pretty
trivial to do - we just need to try to fetch our own account info (like
we already do on twitter)

postgresqleu/util/messaging/mastodon.py

index 935a89e658f56ea2dd91b66648688aa21ce83810..e21b5f865ca68203a28ba76935e88e04b65ffbf5 100644 (file)
@@ -315,6 +315,11 @@ class Mastodon(object):
             }
 
     def check_messaging_config(self, state):
+        # Check that we can get our own account info
+        try:
+            self.get_account_info()
+        except Exception as e:
+            return False, 'Could not get own account information: {}'.format(e)
         return True, ''
 
     def get_link(self, id):