From f5a88ccd3403e0aff15865c1cabc50629d72e613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 18 Jun 2017 13:43:09 +0200 Subject: [PATCH] notifications: only include unread count in badge (#16963) --- combo/apps/notifications/models.py | 2 +- tests/test_notification.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/combo/apps/notifications/models.py b/combo/apps/notifications/models.py index 080acc2..d28553f 100644 --- a/combo/apps/notifications/models.py +++ b/combo/apps/notifications/models.py @@ -132,7 +132,7 @@ class NotificationsCell(CellBase): new = notifs.filter(acked=False).count() if not new: return - return {'badge': '%s/%s' % (new, notifs.count())} + return {'badge': str(new)} def render(self, context): self.context = context diff --git a/tests/test_notification.py b/tests/test_notification.py index 816c8fc..f6eff6d 100644 --- a/tests/test_notification.py +++ b/tests/test_notification.py @@ -95,13 +95,13 @@ def test_notification_cell(user, user2): content = cell.render(context) assert 'notibar' in content assert 'notifoo' in content - assert cell.get_badge(context) == {'badge': '2/2'} + assert cell.get_badge(context) == {'badge': '2'} Notification.forget(user, id_noti2) content = cell.render(context) assert 'notibar' in content assert 'notifoo' not in content - assert cell.get_badge(context) == {'badge': '1/1'} + assert cell.get_badge(context) == {'badge': '1'} Notification.notify(user, 'notirebar', id=id_noti1) content = cell.render(context) @@ -117,7 +117,7 @@ def test_notification_cell(user, user2): Notification.ack(user, id=ackme) content = cell.render(context) assert 'acked' in content - assert cell.get_badge(context) == {'badge': '1/2'} + assert cell.get_badge(context) == {'badge': '1'} Notification.ack(user, id=id_noti1) content = cell.render(context) @@ -132,7 +132,7 @@ def test_notification_cell(user, user2): content = cell.render(context) assert 'notiurl' not in content assert 'notiother' in content - assert cell.get_badge(context) == {'badge': '1/1'} + assert cell.get_badge(context) == {'badge': '1'} def test_notification_ws(user): -- 2.11.0