Commit 9678fe7d authored by Joram Wilander's avatar Joram Wilander Committed by GitHub

Remove duplicate view channel calls on app focus and channel switch (#811)

parent 695e3878
......@@ -8,8 +8,7 @@ import {
getMyChannelMember,
joinChannel,
markChannelAsRead,
selectChannel,
viewChannel
selectChannel
} from 'mattermost-redux/actions/channels';
import {getPostThread} from 'mattermost-redux/actions/posts';
import {removeUserFromTeam} from 'mattermost-redux/actions/teams';
......@@ -58,7 +57,6 @@ export function emitChannelClickEvent(channel) {
getMyChannelMemberPromise.then(() => {
getChannelStats(chan.id)(dispatch, getState);
viewChannel(chan.id, oldChannelId)(dispatch, getState);
// Mark previous and next channel as read
dispatch(markChannelAsRead(chan.id, oldChannelId));
......
......@@ -135,11 +135,10 @@ export default class NeedsTeam extends React.Component {
// Set up tracking for whether the window is active
window.isActive = true;
$(window).on('focus', async () => {
this.props.actions.markChannelAsRead(ChannelStore.getCurrentId());
await this.props.actions.markChannelAsRead(ChannelStore.getCurrentId());
ChannelStore.emitChange();
window.isActive = true;
await this.props.actions.viewChannel(ChannelStore.getCurrentId());
if (new Date().getTime() - this.blurTime > UNREAD_CHECK_TIME_MILLISECONDS) {
this.props.actions.getMyChannelMembers(TeamStore.getCurrentId()).then(loadProfilesForSidebar);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment