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()
|
||||
)
|
||||
queryset = queryset.first()
|
||||
|
||||
if data is None:
|
||||
return Response(
|
||||
{"error": "Cycle does not exist"},
|
||||
status=status.HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
|
||||
# Assignee Distribution
|
||||
assignee_distribution = (
|
||||
Issue.objects.filter(
|
||||
|
@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
@ -19,6 +20,12 @@ from plane.settings.redis import redis_instance
|
||||
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
|
||||
def acquire_lock(lock_id, expire_time=300):
|
||||
redis_client = redis_instance()
|
||||
@ -175,7 +182,16 @@ def send_email_notification(
|
||||
if acquire_lock(lock_id=lock_id):
|
||||
# get the 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)
|
||||
|
||||
# Get email configurations
|
||||
@ -255,9 +271,7 @@ def send_email_notification(
|
||||
summary = "Updates were made to the issue by"
|
||||
|
||||
# Send the mail
|
||||
subject = (
|
||||
f"{issue.project.identifier}-{issue.sequence_id} {issue.name}"
|
||||
)
|
||||
subject = f"{issue.project.identifier}-{issue.sequence_id} {remove_unwanted_characters(issue.name)}"
|
||||
context = {
|
||||
"data": template_data,
|
||||
"summary": summary,
|
||||
@ -321,8 +335,7 @@ def send_email_notification(
|
||||
"Duplicate email received skipping"
|
||||
)
|
||||
return
|
||||
except (Issue.DoesNotExist, User.DoesNotExist) as e:
|
||||
log_exception(e)
|
||||
except (Issue.DoesNotExist, User.DoesNotExist):
|
||||
release_lock(lock_id=lock_id)
|
||||
return
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user