Add unread indicator to conversations (#9009)
This commit is contained in:
parent
bebe8ec887
commit
a38a452481
13 changed files with 98 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
|||
import { connect } from 'react-redux';
|
||||
import Conversation from '../components/conversation';
|
||||
import { markConversationRead } from '../../../actions/conversations';
|
||||
|
||||
const mapStateToProps = (state, { conversationId }) => {
|
||||
const conversation = state.getIn(['conversations', 'items']).find(x => x.get('id') === conversationId);
|
||||
|
@ -7,9 +8,14 @@ const mapStateToProps = (state, { conversationId }) => {
|
|||
|
||||
return {
|
||||
accounts: conversation.get('accounts').map(accountId => state.getIn(['accounts', accountId], null)),
|
||||
unread: conversation.get('unread'),
|
||||
lastStatus,
|
||||
lastAccount: lastStatus === null ? null : state.getIn(['accounts', lastStatus.get('account')], null),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(Conversation);
|
||||
const mapDispatchToProps = (dispatch, { conversationId }) => ({
|
||||
markRead: () => dispatch(markConversationRead(conversationId)),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Conversation);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue