events: add send_once flag to send webhooks only once

This commit is contained in:
Jens Langhammer
2021-02-02 19:34:55 +01:00
parent 3ac148d01c
commit cfed41439e
7 changed files with 143 additions and 7 deletions

View File

@ -184,6 +184,12 @@ class NotificationTransport(models.Model):
mode = models.TextField(choices=TransportMode.choices)
webhook_url = models.TextField(blank=True)
send_once = models.BooleanField(
default=False,
help_text=_(
"Only send notification once, for example when sending a webhook into a chat channel."
),
)
def send(self, notification: "Notification") -> list[str]:
"""Send notification to user, called from async task"""