m.get('sender') -> m.isIncoming(), filter in getLoadedUnreadCount
FREEBIE
This commit is contained in:
parent
5b46ef3562
commit
e2ee63efaa
2 changed files with 3 additions and 7 deletions
|
@ -261,7 +261,6 @@
|
||||||
var message = new Whisper.Message({
|
var message = new Whisper.Message({
|
||||||
conversationId : this.id,
|
conversationId : this.id,
|
||||||
type : 'verified-change',
|
type : 'verified-change',
|
||||||
// why is sent_at set to this.get('timestamp?')
|
|
||||||
sent_at : this.get('timestamp'),
|
sent_at : this.get('timestamp'),
|
||||||
received_at : timestamp,
|
received_at : timestamp,
|
||||||
verifiedChanged : id,
|
verifiedChanged : id,
|
||||||
|
@ -555,7 +554,7 @@
|
||||||
return Boolean(m.sender);
|
return Boolean(m.sender);
|
||||||
});
|
});
|
||||||
unreadMessages = unreadMessages.filter(function(m) {
|
unreadMessages = unreadMessages.filter(function(m) {
|
||||||
return Boolean(m.get('sender'));
|
return Boolean(m.isIncoming());
|
||||||
});
|
});
|
||||||
|
|
||||||
var unreadCount = unreadMessages.length - read.length;
|
var unreadCount = unreadMessages.length - read.length;
|
||||||
|
|
|
@ -546,11 +546,8 @@
|
||||||
|
|
||||||
getLoadedUnreadCount: function() {
|
getLoadedUnreadCount: function() {
|
||||||
return this.models.reduce(function(total, model) {
|
return this.models.reduce(function(total, model) {
|
||||||
var count = model.get('unread');
|
var unread = model.get('unread') && model.isIncoming();
|
||||||
if (count === undefined) {
|
return total + (unread ? 1 : 0);
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
return total + count;
|
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue