notifications: only include unread count in badge (#16963)
This commit is contained in:
parent
40f3eda4f2
commit
cd476b852f
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
Loading…
Reference in New Issue