Sorting *before* flattening events.
Makes sure we're using the timestamps from our own owner/node.
@@ -490,12 +490,6 @@ export const selectSortedChatMessages = createSelector(
}
return remote && remote.get('hasTextMessage');
}
- }).map(event => {
- const remote = event.get('hasCorrespondingRemoteMessage');
- if (event.get('hasTextMessage'))
- return event;
- else
- return remote;
})
/* sort them so the latest get shown last */
@@ -521,6 +515,14 @@ export const selectSortedChatMessages = createSelector(
}
})
+ .map(event => {
+ const remote = event.get('hasCorrespondingRemoteMessage');
+ if (event.get('hasTextMessage'))
+ return event;
+ else
+ return remote;
+ })
+
/* add a nice relative timestamp */
.map(event => event.set(
'humanReadableTimestamp',
