fix: notification count only for web (#36459)

This commit is contained in:
Ahtisham Shahid
2025-03-28 18:13:20 +05:00
committed by GitHub
parent 1303965a29
commit 79f33a670a
2 changed files with 2 additions and 1 deletions

View File

@@ -793,6 +793,7 @@ class NotificationCountViewSetTestCase(ModuleStoreTestCase):
Notification.objects.create(user=self.user, app_name='App Name 1', notification_type='Type B')
Notification.objects.create(user=self.user, app_name='App Name 2', notification_type='Type A')
Notification.objects.create(user=self.user, app_name='App Name 3', notification_type='Type C')
Notification.objects.create(user=self.user, app_name='App Name 4', notification_type='Type D', web=False)
@override_waffle_flag(ENABLE_NOTIFICATIONS, active=True)
@ddt.unpack

View File

@@ -332,7 +332,7 @@ class NotificationCountView(APIView):
# Get the unseen notifications count for each app name.
count_by_app_name = (
Notification.objects
.filter(user_id=request.user, last_seen__isnull=True)
.filter(user_id=request.user, last_seen__isnull=True, web=True)
.values('app_name')
.annotate(count=Count('*'))
)