diff --git a/mayan/apps/events/api_views.py b/mayan/apps/events/api_views.py index 227e813c9b..396ea31d65 100644 --- a/mayan/apps/events/api_views.py +++ b/mayan/apps/events/api_views.py @@ -143,4 +143,13 @@ class APINotificationListView(generics.ListAPIView): serializer_class = NotificationSerializer def get_queryset(self): - return Notification.objects.filter(user=self.request.user) + parameter_read = self.request.GET.get('read') + + queryset = Notification.objects.filter(user=self.request.user) + + if parameter_read == 'True': + queryset = queryset.filter(read=True) + elif parameter_read == 'False': + queryset = queryset.filter(read=False) + + return queryset diff --git a/mayan/apps/events/links.py b/mayan/apps/events/links.py index 0d50cc7a76..bae4ecbf57 100644 --- a/mayan/apps/events/links.py +++ b/mayan/apps/events/links.py @@ -70,7 +70,7 @@ link_user_events = Link( link_user_notifications_list = Link( html_data={ 'apw-attribute': 'count', 'apw-interval': '5000', - 'apw-url': '/api/notifications/', + 'apw-url': '/api/notifications/?read=False', 'apw-callback': 'App.mayanNotificationBadge' }, icon='fa fa-bell', text='', view='events:user_notifications_list' )