Skip to content

Commit

Permalink
Don't add totals to unread if chat is active (#81)
Browse files Browse the repository at this point in the history
Currently, we've been adding to unread message totals even when the
chat the messages are being received for is active. This commit fixes
that issue.
  • Loading branch information
schancel authored Apr 16, 2020
1 parent 67d7e08 commit 39ac123
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/store/modules/chats.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,11 @@ export default {
}

state.data[addr].lastReceived = newMsg.receivedTime
state.data[addr].totalUnreadMessages += 1
const messageValue = stampPrice(newMsg.outpoints) + newMsg.items.reduce((totalValue, { amount = 0 }) => totalValue + amount, 0)
state.data[addr].totalUnreadValue += messageValue
if (addr !== state.activeChatAddr) {
state.data[addr].totalUnreadValue += messageValue
state.data[addr].totalUnreadMessages += 1
}
state.data[addr].totalValue += messageValue
},
setLastReceived (state, lastReceived) {
Expand Down

0 comments on commit 39ac123

Please sign in to comment.