MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / dismiss_all

Method dismiss_all

core/api_views.py:691–711  ·  view source on GitHub ↗

Dismiss all notifications for the current user.

(self, request)

Source from the content-addressed store, hash-verified

689
690 @action(detail=False, methods=['post'], url_path='dismiss-all')
691 def dismiss_all(self, request):
692 """Dismiss all notifications for the current user."""
693 notifications = self.get_queryset()
694
695 # Get notifications not yet dismissed
696 dismissed_ids = NotificationDismissal.objects.filter(
697 user=request.user
698 ).values_list('notification_id', flat=True)
699 to_dismiss = notifications.exclude(id__in=dismissed_ids)
700
701 # Create dismissals for all
702 dismissals = [
703 NotificationDismissal(user=request.user, notification=n)
704 for n in to_dismiss
705 ]
706 NotificationDismissal.objects.bulk_create(dismissals, ignore_conflicts=True)
707
708 return Response({
709 'success': True,
710 'dismissed_count': len(dismissals)
711 })
712
713 @action(detail=False, methods=['get'], url_path='count')
714 def unread_count(self, request):

Callers

nothing calls this directly

Calls 3

get_querysetMethod · 0.95
filterMethod · 0.45

Tested by

no test coverage detected