Skip to content
Snippets Groups Projects
Commit 30e90012 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch 'fix/delay-notification' into 'master'

Delay sending of notification until it's saved in database

See merge request AlekSIS/official/AlekSIS!341
parents a7297271 64a5c1d7
No related branches found
No related tags found
1 merge request!341Delay sending of notification until it's saved in database
Pipeline #3237 failed
......@@ -9,7 +9,7 @@ from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.db import models
from django.db import models, transaction
from django.db.models import QuerySet
from django.forms.widgets import Media
from django.urls import reverse
......@@ -456,7 +456,7 @@ class Notification(ExtensibleModel):
def save(self, **kwargs):
super().save(**kwargs)
if not self.sent:
send_notification(self.pk, resend=True)
transaction.on_commit(lambda: send_notification(self.pk, resend=True))
self.sent = True
super().save(**kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment