Don't list private announcents as an option when no channel configured
authorMagnus Hagander <magnus@hagander.net>
Sun, 24 Nov 2024 09:59:14 +0000 (10:59 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sun, 24 Nov 2024 09:59:14 +0000 (10:59 +0100)
We'd list that we would use telegram for private broadcast even if ther
ewas no channel configured to broadcast to, as long as the checkbox was
enabled. Update it so we need both before we tell the user it's going to
work.

postgresqleu/confreg/models.py

index b24f6d6b9b89734a62c0dde4ee017b0bac930eb1..61117832f22e626e06ac35d7aacea1b0d4ba2630 100644 (file)
@@ -1597,13 +1597,20 @@ class ConferenceMessaging(models.Model):
     def __str__(self):
         return self.provider.publicname
 
+    @property
+    def configured_privatebcast(self):
+        if self.privatebcast:
+            # Also verify there is a channel configured
+            return 'privatebcast' in self.config.get('channels', {})
+        return False
+
     @property
     def full_info(self):
-        if self.notification and self.privatebcast:
+        if self.notification and self.configured_privatebcast:
             return "{} - personal notifications and announcements".format(self)
         elif self.notification:
             return "{} - personal notifications only".format(self)
-        elif self.privatebcast:
+        elif self.configured_privatebcast:
             return "{} - announcements only".format(self)
         else:
             return str(self)