notifications: only include unread count in badge (#16963)

This commit is contained in:
Frédéric Péters 2017-06-18 13:43:09 +02:00
parent 40f3eda4f2
commit cd476b852f
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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):