Switch to _send_push utility method to send webpush..

..instead of making an HTTP request
This commit is contained in:
3wc 2021-06-30 16:21:10 +02:00
parent 2bffcb2059
commit 8161888af6

View File

@ -17,6 +17,7 @@ from djangoldp.activities.services import ActivityQueueService, ActivityPubServi
from djangoldp_notification.middlewares import MODEL_MODIFICATION_USER_FIELD
from djangoldp_notification.permissions import InboxPermissions, SubscriptionsPermissions
from djangoldp_notification.views import LDPNotificationsViewSet
from djangoldp_webpushnotification.views import _send_push
import logging
@ -297,12 +298,7 @@ def send_webpush_on_notification(sender, instance, created, **kwargs):
"id": instance.user.id
} # make the payload that we wanna send?
url = settings.SITE_URL + reverse("send_webpush") # get the url to post webpush to
response = requests.post(
url,
data=json.dumps(payload)
)
_send_push(payload)
@receiver(post_save, sender=settings.AUTH_USER_MODEL)