forked from github/plane
fix: created_by notifications (#1534)
* chore: add triggered by details for notifications * dev: update issue activity json to include extra fields * dev: remove unused imports and improve the filtering * dev: fix unread filter * dev: fix created_by none when updating the field
This commit is contained in:
parent
0a56a30ab2
commit
090870b03e
@ -4,7 +4,6 @@ from .user import UserLiteSerializer
|
||||
from plane.db.models import Notification
|
||||
|
||||
class NotificationSerializer(BaseSerializer):
|
||||
|
||||
triggered_by_details = UserLiteSerializer(read_only=True, source="triggered_by")
|
||||
|
||||
class Meta:
|
||||
|
@ -45,7 +45,6 @@ from plane.api.serializers import (
|
||||
IssueLiteSerializer,
|
||||
IssueAttachmentSerializer,
|
||||
IssueSubscriberSerializer,
|
||||
ProjectMemberSerializer,
|
||||
ProjectMemberLiteSerializer,
|
||||
)
|
||||
from plane.api.permissions import (
|
||||
|
@ -216,6 +216,7 @@ class UnreadNotificationEndpoint(BaseAPIView):
|
||||
watching_notification_count = Notification.objects.filter(
|
||||
workspace__slug=slug,
|
||||
receiver_id=request.user.id,
|
||||
read_at__isnull=True,
|
||||
entity_identifier__in=IssueSubscriber.objects.filter(
|
||||
workspace__slug=slug, subscriber_id=request.user.id
|
||||
).values_list("issue_id", flat=True),
|
||||
@ -225,6 +226,7 @@ class UnreadNotificationEndpoint(BaseAPIView):
|
||||
my_issues_count = Notification.objects.filter(
|
||||
workspace__slug=slug,
|
||||
receiver_id=request.user.id,
|
||||
read_at__isnull=True,
|
||||
entity_identifier__in=IssueAssignee.objects.filter(
|
||||
workspace__slug=slug, assignee_id=request.user.id
|
||||
).values_list("issue_id", flat=True),
|
||||
@ -234,6 +236,7 @@ class UnreadNotificationEndpoint(BaseAPIView):
|
||||
created_issues_count = Notification.objects.filter(
|
||||
workspace__slug=slug,
|
||||
receiver_id=request.user.id,
|
||||
read_at__isnull=True,
|
||||
entity_identifier__in=Issue.objects.filter(
|
||||
workspace__slug=slug, created_by=request.user
|
||||
).values_list("pk", flat=True),
|
||||
|
@ -1028,10 +1028,14 @@ def issue_activity(
|
||||
actor = User.objects.get(pk=actor_id)
|
||||
project = Project.objects.get(pk=project_id)
|
||||
|
||||
issue = Issue.objects.filter(pk=issue_id).first()
|
||||
if issue is not None:
|
||||
|
||||
try:
|
||||
issue = Issue.objects.get(pk=issue_id)
|
||||
issue.updated_at = timezone.now()
|
||||
issue.save()
|
||||
issue.save(update_fields=["updated_at"])
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
if subscriber:
|
||||
# add the user to issue subscriber
|
||||
|
@ -28,7 +28,6 @@ class IssueManager(models.Manager):
|
||||
| models.Q(issue_inbox__status=2)
|
||||
| models.Q(issue_inbox__isnull=True)
|
||||
)
|
||||
.filter(archived_at__isnull=True)
|
||||
.exclude(archived_at__isnull=False)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user