From 8161888af6a02b7afc054ad42c428088aeeda907 Mon Sep 17 00:00:00 2001 From: 3wc <3wc.startinblox@doesthisthing.work> Date: Wed, 30 Jun 2021 16:21:10 +0200 Subject: [PATCH] Switch to _send_push utility method to send webpush.. ..instead of making an HTTP request --- djangoldp_notification/models.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/djangoldp_notification/models.py b/djangoldp_notification/models.py index 0c20bad..b58a7c5 100644 --- a/djangoldp_notification/models.py +++ b/djangoldp_notification/models.py @@ -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)