Fix DM mark as unread on team switch (#523)

This commit is contained in:
enahum 2017-05-09 12:20:20 -03:00 committed by GitHub
parent 30b306c39c
commit 5d11935a40
4 changed files with 18 additions and 8 deletions

View file

@ -30,8 +30,7 @@ export default class ChannelDrawer extends PureComponent {
selectChannel = (id) => {
const {
actions,
currentChannel,
currentTeam
currentChannel
} = this.props;
const {
@ -44,7 +43,7 @@ export default class ChannelDrawer extends PureComponent {
markChannelAsRead(id, currentChannel.id);
setChannelLoading();
viewChannel(currentTeam.id);
viewChannel(id);
closeDrawers();
InteractionManager.runAfterInteractions(() => {
handleSelectChannel(id);

View file

@ -8,6 +8,8 @@ import navigationSceneConnect from '../navigationSceneConnect';
import {closeDrawers, closeModal, goBack} from 'app/actions/navigation';
import {handleTeamChange} from 'app/actions/views/select_team';
import {markChannelAsRead} from 'mattermost-redux/actions/channels';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentTeam, getTeams, getTeamMemberships} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
@ -27,7 +29,8 @@ function mapStateToProps(state) {
config: state.entities.general.config,
teamsRequest: state.requests.teams.allTeams,
teams: myTeams.sort(sortTeams),
currentTeam: getCurrentTeam(state)
currentTeam: getCurrentTeam(state),
currentChannelId: getCurrentChannelId(state)
};
}
@ -37,7 +40,8 @@ function mapDispatchToProps(dispatch) {
closeDrawers,
closeModal,
goBack,
handleTeamChange
handleTeamChange,
markChannelAsRead
}, dispatch)
};
}

View file

@ -21,6 +21,7 @@ import logo from 'assets/images/logo.png';
export default class SelectTeam extends PureComponent {
static propTypes = {
config: PropTypes.object.isRequired,
currentChannelId: PropTypes.string,
teams: PropTypes.array.isRequired,
subscribeToHeaderEvent: PropTypes.func.isRequired,
unsubscribeFromHeaderEvent: PropTypes.func.isRequired,
@ -28,7 +29,8 @@ export default class SelectTeam extends PureComponent {
closeDrawers: PropTypes.func.isRequired,
closeModal: PropTypes.func.isRequired,
goBack: PropTypes.func.isRequired,
handleTeamChange: PropTypes.func.isRequired
handleTeamChange: PropTypes.func.isRequired,
markChannelAsRead: PropTypes.func.isRequired
}).isRequired
};
@ -67,9 +69,14 @@ export default class SelectTeam extends PureComponent {
const {
closeDrawers,
closeModal,
handleTeamChange
currentChannelId,
handleTeamChange,
markChannelAsRead
} = this.props.actions;
if (currentChannelId) {
markChannelAsRead(currentChannelId);
}
handleTeamChange(team);
closeDrawers();
InteractionManager.runAfterInteractions(closeModal);

View file

@ -3518,7 +3518,7 @@ makeerror@1.0.x:
mattermost-redux@mattermost/mattermost-redux#master:
version "0.0.1"
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/3611e6cc9aeb2501f35f8f59f2cc775f6c553ddf"
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/91d41649862b77ae5636a35e03908c571c2bb1c7"
dependencies:
deep-equal "1.0.1"
harmony-reflect "1.5.1"