2020-03-27 13:59:38 -07:00
|
|
|
import { connect } from 'react-redux';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2020-03-27 13:59:38 -07:00
|
|
|
import { markConversationRead } from '../../../actions/conversations';
|
2022-01-10 14:17:52 -08:00
|
|
|
import Conversation from '../components/conversation';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { conversationId }) => {
|
|
|
|
const conversation = state.getIn(['conversations', 'items']).find(x => x.get('id') === conversationId);
|
|
|
|
|
|
|
|
return {
|
|
|
|
accounts: conversation.get('accounts').map(accountId => state.getIn(['accounts', accountId], null)),
|
|
|
|
unread: conversation.get('unread'),
|
|
|
|
lastStatusId: conversation.get('last_status', null),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch, { conversationId }) => ({
|
|
|
|
markRead: () => dispatch(markConversationRead(conversationId)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Conversation);
|