If only one mevent, return than one

Also, the net change of nil is detected as having the first and last events being _different_. The summary should only include those that have their first and last events being the _same_ because that is a net change (within the block of member events).
This commit is contained in:
Luke Barnard 2016-11-16 16:07:19 +00:00
parent beecbc7cd7
commit 324448563a

View file

@ -162,10 +162,15 @@ module.exports = React.createClass({
return e.getSender() === userId;
});
if (userEvents.length === 1) {
filteredEvents.push(userEvents[0]);
return;
}
let firstEvent = userEvents[0];
let lastEvent = userEvents[userEvents.length - 1];
if (firstEvent.getContent().membership !== lastEvent.getContent().membership) {
if (firstEvent.getContent().membership === lastEvent.getContent().membership) {
filteredEvents.push(lastEvent);
}
}