Fix new line indicator for center channel & thread (#394)

This commit is contained in:
enahum 2017-03-26 22:22:26 -03:00 committed by GitHub
parent 23f3397ec1
commit 43b582d4e5
3 changed files with 18 additions and 2 deletions

View file

@ -32,7 +32,7 @@ export default class ChannelDrawer extends PureComponent {
currentTeam
} = this.props;
this.props.actions.markChannelAsRead(id, currentChannel.id);
this.props.actions.markChannelAsRead(currentChannel.id);
this.props.actions.viewChannel(currentTeam.id, id);
this.props.actions.closeDrawers();
InteractionManager.runAfterInteractions(() => {

View file

@ -27,6 +27,7 @@ export default class Thread extends PureComponent {
}).isRequired,
teamId: PropTypes.string.isRequired,
channelId: PropTypes.string.isRequired,
myMember: PropTypes.object.isRequired,
files: PropTypes.array,
rootId: PropTypes.string.isRequired,
draft: PropTypes.string.isRequired,
@ -40,6 +41,14 @@ export default class Thread extends PureComponent {
}
};
state = {};
componentWillReceiveProps(nextProps) {
if (!this.state.lastViewedAt) {
this.setState({lastViewedAt: nextProps.myMember.last_viewed_at});
}
}
componentWillUnmount() {
this.props.actions.selectPost('');
}
@ -58,7 +67,12 @@ export default class Thread extends PureComponent {
keyboardVerticalOffset={65}
>
<StatusBar barStyle='light-content'/>
<PostList posts={this.props.posts}/>
<PostList
indicateNewMessages={true}
posts={this.props.posts}
currentUserId={this.props.myMember.user_id}
lastViewedAt={this.state.lastViewedAt}
/>
<PostTextbox
rootId={this.props.rootId}
value={this.props.draft}

View file

@ -8,6 +8,7 @@ import {selectPost} from 'mattermost-redux/actions/posts';
import {makeGetPostsForThread} from 'mattermost-redux/selectors/entities/posts';
import {getTheme} from 'app/selectors/preferences';
import {getCurrentChannelMembership} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import navigationSceneConnect from '../navigationSceneConnect';
@ -33,6 +34,7 @@ function makeMapStateToProps() {
...ownProps,
teamId,
channelId: ownProps.channelId,
myMember: getCurrentChannelMembership(state),
rootId: ownProps.rootId,
draft: threadDraft.draft,
files: threadDraft.files,