[WEB - 1122] fix: webhook for issues, issue comments, projects, cycles and modules. (#4330)

* dev: update webhook logic for issues

* dev: update issue webhooks for cycle and module

* dev: webhook for comment

* dev: issue attachment webhooks

* dev: add logging

* dev: add inbox issue webhooks

* dev: update the webhook send task

* dev: project webhooks for api

* dev: webhooks update for projects, cycles and modules

* dev: fix webhook on cycle and module create from external apis
This commit is contained in:
Nikhil 2024-05-06 14:13:49 +05:30 committed by GitHub
parent fb74875cde
commit f1fda4ae4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 545 additions and 191 deletions

View file

@ -19,7 +19,6 @@ from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
# Module imports
from plane.bgtasks.webhook_task import send_webhook
from plane.utils.exception_logger import log_exception
from plane.utils.paginator import BasePaginator
@ -38,35 +37,6 @@ class TimezoneMixin:
timezone.deactivate()
class WebhookMixin:
webhook_event = None
bulk = False
def finalize_response(self, request, response, *args, **kwargs):
response = super().finalize_response(
request, response, *args, **kwargs
)
# Check for the case should webhook be sent
if (
self.webhook_event
and self.request.method in ["POST", "PATCH", "DELETE"]
and response.status_code in [200, 201, 204]
):
# Push the object to delay
send_webhook.delay(
event=self.webhook_event,
payload=response.data,
kw=self.kwargs,
action=self.request.method,
slug=self.workspace_slug,
bulk=self.bulk,
current_site=request.META.get("HTTP_ORIGIN"),
)
return response
class BaseViewSet(TimezoneMixin, ModelViewSet, BasePaginator):
model = None