sforkowany z mirror/soapbox
Chats: sort messages properly
rodzic
759c4ae4d0
commit
4b173f0580
|
@ -12,7 +12,7 @@ const mapStateToProps = (state, { chatMessageIds }) => ({
|
|||
chatMessages: chatMessageIds.reduce((acc, curr) => {
|
||||
const chatMessage = state.getIn(['chat_messages', curr]);
|
||||
return chatMessage ? acc.push(chatMessage) : acc;
|
||||
}, ImmutableList()),
|
||||
}, ImmutableList()).sort(),
|
||||
});
|
||||
|
||||
export default @connect(mapStateToProps)
|
||||
|
|
|
@ -28,7 +28,7 @@ export default function chatMessageLists(state = initialState, action) {
|
|||
case CHAT_MESSAGES_IMPORT:
|
||||
return importMessages(state, action.chatMessages);
|
||||
case CHAT_MESSAGES_FETCH_SUCCESS:
|
||||
return updateList(state, action.chatId, action.data.map(chat => chat.id));
|
||||
return updateList(state, action.chatId, action.data.map(chat => chat.id).reverse());
|
||||
case CHAT_MESSAGE_SEND_SUCCESS:
|
||||
return updateList(state, action.chatId, [action.data.id]);
|
||||
default:
|
||||
|
|
Ładowanie…
Reference in New Issue