Skip to content

Commit

Permalink
fixup! update EmailLastSeen for click on notification
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Feb 11, 2025
1 parent d7c09d3 commit 9a3efca
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lacommunaute/notification/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ def process_request(self, request):

try:
uuid.UUID(notif_uuid, version=4)
try:
notification = Notification.objects.get(uuid=notif_uuid)
except Notification.DoesNotExist:
pass
else:
notification.visited_at = timezone.now()
notification.save()
EmailLastSeen.objects.seen(email=notification.recipient, kind=EmailLastSeenKind.VISITED)
except ValueError:
pass
else:
notifs = Notification.objects.filter(uuid=notif_uuid)
notifs.update(visited_at=timezone.now())
[EmailLastSeen.objects.seen(email=notif.recipient, kind=EmailLastSeenKind.VISITED) for notif in notifs]

0 comments on commit 9a3efca

Please sign in to comment.