diff --git a/apiserver/plane/api/views/base.py b/apiserver/plane/api/views/base.py index 60bcd6fc6..27ebe5caf 100644 --- a/apiserver/plane/api/views/base.py +++ b/apiserver/plane/api/views/base.py @@ -42,24 +42,6 @@ class WebhookMixin: 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"] - and response.status_code in [200, 201, 204] - ): - # Get the id - object_id = ( - response.data.get("id") if isinstance(response.data, dict) else None - ) - # Push the object to delay - send_webhook.delay( - event=self.webhook_event, - event_id=object_id, - action=self.request.method, - slug=self.workspace_slug, - ) - # Check for the case should webhook be sent if ( self.webhook_event diff --git a/apiserver/plane/api/views/cycle.py b/apiserver/plane/api/views/cycle.py index 8345d7824..e20c845f2 100644 --- a/apiserver/plane/api/views/cycle.py +++ b/apiserver/plane/api/views/cycle.py @@ -310,7 +310,7 @@ class CycleIssueAPIEndpoint(WebhookMixin, BaseAPIView): serializer_class = CycleIssueSerializer model = CycleIssue - webhook_event = "cycle" + webhook_event = "cycle_issue" permission_classes = [ ProjectEntityPermission, ] diff --git a/apiserver/plane/api/views/issue.py b/apiserver/plane/api/views/issue.py index 18393b677..41745010f 100644 --- a/apiserver/plane/api/views/issue.py +++ b/apiserver/plane/api/views/issue.py @@ -450,7 +450,7 @@ class IssueCommentAPIEndpoint(WebhookMixin, BaseAPIView): serializer_class = IssueCommentSerializer model = IssueComment - webhook_event = "issue-comment" + webhook_event = "issue_comment" permission_classes = [ ProjectLitePermission, ] diff --git a/apiserver/plane/api/views/module.py b/apiserver/plane/api/views/module.py index 51be6be30..5ac74d702 100644 --- a/apiserver/plane/api/views/module.py +++ b/apiserver/plane/api/views/module.py @@ -194,7 +194,7 @@ class ModuleIssueAPIEndpoint(WebhookMixin, BaseAPIView): serializer_class = ModuleIssueSerializer model = ModuleIssue - webhook_event = "module" + webhook_event = "module_issue" permission_classes = [ ProjectEntityPermission, diff --git a/apiserver/plane/app/views/cycle.py b/apiserver/plane/app/views/cycle.py index 5a2cf6807..dd1f3b4bb 100644 --- a/apiserver/plane/app/views/cycle.py +++ b/apiserver/plane/app/views/cycle.py @@ -502,7 +502,7 @@ class CycleViewSet(WebhookMixin, BaseViewSet): class CycleIssueViewSet(WebhookMixin, BaseViewSet): serializer_class = CycleIssueSerializer model = CycleIssue - webhook_event = "cycle" + webhook_event = "cycle_issue" permission_classes = [ ProjectEntityPermission, ] diff --git a/apiserver/plane/app/views/issue.py b/apiserver/plane/app/views/issue.py index b03c0ea4f..e7605bf14 100644 --- a/apiserver/plane/app/views/issue.py +++ b/apiserver/plane/app/views/issue.py @@ -596,7 +596,7 @@ class IssueActivityEndpoint(BaseAPIView): class IssueCommentViewSet(WebhookMixin, BaseViewSet): serializer_class = IssueCommentSerializer model = IssueComment - webhook_event = "issue-comment" + webhook_event = "issue_comment" permission_classes = [ ProjectLitePermission, ] diff --git a/apiserver/plane/app/views/module.py b/apiserver/plane/app/views/module.py index 4e10a0629..d357f91a3 100644 --- a/apiserver/plane/app/views/module.py +++ b/apiserver/plane/app/views/module.py @@ -283,9 +283,10 @@ class ModuleViewSet(WebhookMixin, BaseViewSet): return Response(status=status.HTTP_204_NO_CONTENT) -class ModuleIssueViewSet(BaseViewSet): +class ModuleIssueViewSet(WebhookMixin, BaseViewSet): serializer_class = ModuleIssueSerializer model = ModuleIssue + webhook_event = "module_issue" filterset_fields = [ "issue__labels__id", diff --git a/apiserver/plane/bgtasks/analytic_plot_export.py b/apiserver/plane/bgtasks/analytic_plot_export.py index c67399adf..e32c2fd68 100644 --- a/apiserver/plane/bgtasks/analytic_plot_export.py +++ b/apiserver/plane/bgtasks/analytic_plot_export.py @@ -81,13 +81,6 @@ def send_export_email(email, slug, csv_buffer): os.environ.get("EMAIL_USE_TLS", "1"), ) ), - use_ssl=bool( - get_configuration_value( - instance_configuration, - "EMAIL_USE_SSL", - os.environ.get("EMAIL_USE_SSL", "0"), - ) - ), ) msg = EmailMultiAlternatives( diff --git a/apiserver/plane/bgtasks/email_verification_task.py b/apiserver/plane/bgtasks/email_verification_task.py index 650b73eac..3f8f19fe6 100644 --- a/apiserver/plane/bgtasks/email_verification_task.py +++ b/apiserver/plane/bgtasks/email_verification_task.py @@ -65,13 +65,6 @@ def email_verification(first_name, email, token, current_site): os.environ.get("EMAIL_USE_TLS", "1"), ) ), - use_ssl=bool( - get_configuration_value( - instance_configuration, - "EMAIL_USE_SSL", - os.environ.get("EMAIL_USE_SSL", "0"), - ) - ), ) # Initiate email alternatives diff --git a/apiserver/plane/bgtasks/forgot_password_task.py b/apiserver/plane/bgtasks/forgot_password_task.py index a2b09cd8d..ca0eeb91d 100644 --- a/apiserver/plane/bgtasks/forgot_password_task.py +++ b/apiserver/plane/bgtasks/forgot_password_task.py @@ -60,13 +60,6 @@ def forgot_password(first_name, email, uidb64, token, current_site): os.environ.get("EMAIL_USE_TLS", "1"), ) ), - use_ssl=bool( - get_configuration_value( - instance_configuration, - "EMAIL_USE_SSL", - os.environ.get("EMAIL_USE_SSL", "0"), - ) - ), ) msg = EmailMultiAlternatives( diff --git a/apiserver/plane/bgtasks/magic_link_code_task.py b/apiserver/plane/bgtasks/magic_link_code_task.py index da84769f6..0db8e5504 100644 --- a/apiserver/plane/bgtasks/magic_link_code_task.py +++ b/apiserver/plane/bgtasks/magic_link_code_task.py @@ -59,13 +59,6 @@ def magic_link(email, key, token, current_site): os.environ.get("EMAIL_USE_TLS", "1"), ) ), - use_ssl=bool( - get_configuration_value( - instance_configuration, - "EMAIL_USE_SSL", - os.environ.get("EMAIL_USE_SSL", "0"), - ) - ), ) msg = EmailMultiAlternatives( diff --git a/apiserver/plane/bgtasks/project_invitation_task.py b/apiserver/plane/bgtasks/project_invitation_task.py index ca414d46b..fc740afc5 100644 --- a/apiserver/plane/bgtasks/project_invitation_task.py +++ b/apiserver/plane/bgtasks/project_invitation_task.py @@ -74,13 +74,6 @@ def project_invitation(email, project_id, token, current_site, invitor): os.environ.get("EMAIL_USE_TLS", "1"), ) ), - use_ssl=bool( - get_configuration_value( - instance_configuration, - "EMAIL_USE_SSL", - os.environ.get("EMAIL_USE_SSL", "0"), - ) - ), ) msg = EmailMultiAlternatives( diff --git a/apiserver/plane/bgtasks/webhook_task.py b/apiserver/plane/bgtasks/webhook_task.py index 606b9646c..e4cece131 100644 --- a/apiserver/plane/bgtasks/webhook_task.py +++ b/apiserver/plane/bgtasks/webhook_task.py @@ -176,13 +176,13 @@ def send_webhook(event, event_id, action, slug): if event == "issue": webhooks = webhooks.filter(issue=True) - if event == "module": + if event == "module" or event == "module_issue": webhooks = webhooks.filter(module=True) - if event == "cycle": + if event == "cycle" or event == "cycle_issue": webhooks = webhooks.filter(cycle=True) - if event == "issue-comment": + if event == "issue_comment": webhooks = webhooks.filter(issue_comment=True) for webhook in webhooks: diff --git a/apiserver/plane/bgtasks/workspace_invitation_task.py b/apiserver/plane/bgtasks/workspace_invitation_task.py index aa527f241..27a1d1d38 100644 --- a/apiserver/plane/bgtasks/workspace_invitation_task.py +++ b/apiserver/plane/bgtasks/workspace_invitation_task.py @@ -83,13 +83,6 @@ def workspace_invitation(email, workspace_id, token, current_site, invitor): os.environ.get("EMAIL_USE_TLS", "1"), ) ), - use_ssl=bool( - get_configuration_value( - instance_configuration, - "EMAIL_USE_SSL", - os.environ.get("EMAIL_USE_SSL", "0"), - ) - ), ) msg = EmailMultiAlternatives(