Don't let unreadCount become negative
If you had an inaccurate unread count due to previously broken unread tracking, it's possible to go negative and never fully recover. Fixed by clamping to zero. // FREEBIE
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
updateUnreadCount: function(model, count) {
|
||||
var prev = model.previous('unreadCount') || 0;
|
||||
var newUnreadCount = storage.get("unreadCount", 0) - (prev - count);
|
||||
if (newUnreadCount < 0) { newUnreadCount = 0; }
|
||||
storage.remove("unreadCount");
|
||||
storage.put("unreadCount", newUnreadCount);
|
||||
|
||||
|
Reference in New Issue
Block a user