Projet

Général

Profil

0001-notifications-only-include-unread-count-in-badge-169.patch

Frédéric Péters, 18 juin 2017 13:43

Télécharger (2,33 ko)

Voir les différences:

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(-)
combo/apps/notifications/models.py
132 132
        new = notifs.filter(acked=False).count()
133 133
        if not new:
134 134
            return
135
        return {'badge': '%s/%s' % (new, notifs.count())}
135
        return {'badge': str(new)}
136 136

  
137 137
    def render(self, context):
138 138
        self.context = context
tests/test_notification.py
95 95
    content = cell.render(context)
96 96
    assert 'notibar' in content
97 97
    assert 'notifoo' in content
98
    assert cell.get_badge(context) == {'badge': '2/2'}
98
    assert cell.get_badge(context) == {'badge': '2'}
99 99

  
100 100
    Notification.forget(user, id_noti2)
101 101
    content = cell.render(context)
102 102
    assert 'notibar' in content
103 103
    assert 'notifoo' not in content
104
    assert cell.get_badge(context) == {'badge': '1/1'}
104
    assert cell.get_badge(context) == {'badge': '1'}
105 105

  
106 106
    Notification.notify(user, 'notirebar', id=id_noti1)
107 107
    content = cell.render(context)
......
117 117
    Notification.ack(user, id=ackme)
118 118
    content = cell.render(context)
119 119
    assert 'acked' in content
120
    assert cell.get_badge(context) == {'badge': '1/2'}
120
    assert cell.get_badge(context) == {'badge': '1'}
121 121

  
122 122
    Notification.ack(user, id=id_noti1)
123 123
    content = cell.render(context)
......
132 132
    content = cell.render(context)
133 133
    assert 'notiurl' not in content
134 134
    assert 'notiother' in content
135
    assert cell.get_badge(context) == {'badge': '1/1'}
135
    assert cell.get_badge(context) == {'badge': '1'}
136 136

  
137 137
def test_notification_ws(user):
138 138

  
139
-