Skip to content

Commit

Permalink
don't merge messages over an hour old
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf committed Sep 19, 2017
1 parent fb8df38 commit f3b02b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion App.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ export default class App extends React.Component {
}

addMessage(messages, newMessage) {
if (messages.length > 0 && messages[messages.length - 1].sender == newMessage.sender) {
if (messages.length > 0 && messages[messages.length - 1].sender == newMessage.sender
&& ((newMessage.ts - messages[messages.length - 1].ts)) < 3600000) {
item = messages[messages.length - 1]
item.messages.push(newMessage.messages[0])

Expand Down

0 comments on commit f3b02b7

Please sign in to comment.