mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: errors that were catched in sentry (#4114)
This commit is contained in:
parent
0ab03c963c
commit
840bc51537
@ -540,6 +540,13 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
queryset = queryset.first()
|
queryset = queryset.first()
|
||||||
|
|
||||||
|
if data is None:
|
||||||
|
return Response(
|
||||||
|
{"error": "Cycle does not exist"},
|
||||||
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
|
)
|
||||||
|
|
||||||
# Assignee Distribution
|
# Assignee Distribution
|
||||||
assignee_distribution = (
|
assignee_distribution = (
|
||||||
Issue.objects.filter(
|
Issue.objects.filter(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
@ -19,6 +20,12 @@ from plane.settings.redis import redis_instance
|
|||||||
from plane.utils.exception_logger import log_exception
|
from plane.utils.exception_logger import log_exception
|
||||||
|
|
||||||
|
|
||||||
|
def remove_unwanted_characters(input_text):
|
||||||
|
# Keep only alphanumeric characters, spaces, and dashes.
|
||||||
|
processed_text = re.sub(r"[^a-zA-Z0-9 \-]", "", input_text)
|
||||||
|
return processed_text
|
||||||
|
|
||||||
|
|
||||||
# acquire and delete redis lock
|
# acquire and delete redis lock
|
||||||
def acquire_lock(lock_id, expire_time=300):
|
def acquire_lock(lock_id, expire_time=300):
|
||||||
redis_client = redis_instance()
|
redis_client = redis_instance()
|
||||||
@ -175,7 +182,16 @@ def send_email_notification(
|
|||||||
if acquire_lock(lock_id=lock_id):
|
if acquire_lock(lock_id=lock_id):
|
||||||
# get the redis instance
|
# get the redis instance
|
||||||
ri = redis_instance()
|
ri = redis_instance()
|
||||||
base_api = ri.get(str(issue_id)).decode()
|
base_api = (
|
||||||
|
ri.get(str(issue_id)).decode()
|
||||||
|
if ri.get(str(issue_id))
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
|
# Skip if base api is not present
|
||||||
|
if not base_api:
|
||||||
|
return
|
||||||
|
|
||||||
data = create_payload(notification_data=notification_data)
|
data = create_payload(notification_data=notification_data)
|
||||||
|
|
||||||
# Get email configurations
|
# Get email configurations
|
||||||
@ -255,9 +271,7 @@ def send_email_notification(
|
|||||||
summary = "Updates were made to the issue by"
|
summary = "Updates were made to the issue by"
|
||||||
|
|
||||||
# Send the mail
|
# Send the mail
|
||||||
subject = (
|
subject = f"{issue.project.identifier}-{issue.sequence_id} {remove_unwanted_characters(issue.name)}"
|
||||||
f"{issue.project.identifier}-{issue.sequence_id} {issue.name}"
|
|
||||||
)
|
|
||||||
context = {
|
context = {
|
||||||
"data": template_data,
|
"data": template_data,
|
||||||
"summary": summary,
|
"summary": summary,
|
||||||
@ -321,8 +335,7 @@ def send_email_notification(
|
|||||||
"Duplicate email received skipping"
|
"Duplicate email received skipping"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
except (Issue.DoesNotExist, User.DoesNotExist) as e:
|
except (Issue.DoesNotExist, User.DoesNotExist):
|
||||||
log_exception(e)
|
|
||||||
release_lock(lock_id=lock_id)
|
release_lock(lock_id=lock_id)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user