diff --git a/app/actions/views/select_team.js b/app/actions/views/select_team.js index 24685e2fe..34989f131 100644 --- a/app/actions/views/select_team.js +++ b/app/actions/views/select_team.js @@ -3,7 +3,7 @@ import {batchActions} from 'redux-batched-actions'; -import {markChannelAsRead, viewChannel} from 'mattermost-redux/actions/channels'; +import {markChannelAsRead, markChannelAsViewed} from 'mattermost-redux/actions/channels'; import {ChannelTypes, TeamTypes} from 'mattermost-redux/action_types'; import EventEmitter from 'mattermost-redux/utils/event_emitter'; import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels'; @@ -31,7 +31,7 @@ export function handleTeamChange(teamId, selectChannel = true) { const lastChannels = state.views.team.lastChannelForTeam[teamId] || []; const lastChannelId = lastChannels[0] || ''; const currentChannelId = getCurrentChannelId(state); - viewChannel(currentChannelId)(dispatch, getState); + markChannelAsViewed(currentChannelId)(dispatch, getState); markChannelAsRead(lastChannelId, currentChannelId)(dispatch, getState); } diff --git a/app/components/channel_drawer/channel_drawer.js b/app/components/channel_drawer/channel_drawer.js index 9cf00ef1b..aa3a0628f 100644 --- a/app/components/channel_drawer/channel_drawer.js +++ b/app/components/channel_drawer/channel_drawer.js @@ -30,7 +30,7 @@ export default class ChannelDrawer extends Component { actions: PropTypes.shape({ getTeams: PropTypes.func.isRequired, handleSelectChannel: PropTypes.func.isRequired, - viewChannel: PropTypes.func.isRequired, + markChannelAsViewed: PropTypes.func.isRequired, makeDirectChannel: PropTypes.func.isRequired, markChannelAsRead: PropTypes.func.isRequired, setChannelDisplayName: PropTypes.func.isRequired, @@ -203,7 +203,7 @@ export default class ChannelDrawer extends Component { markChannelAsRead, setChannelLoading, setChannelDisplayName, - viewChannel + markChannelAsViewed } = actions; setChannelLoading(channel.id !== currentChannelId); @@ -217,7 +217,7 @@ export default class ChannelDrawer extends Component { // mark the channel as viewed after all the frame has flushed markChannelAsRead(channel.id, currentChannelId); if (channel.id !== currentChannelId) { - viewChannel(currentChannelId); + markChannelAsViewed(currentChannelId); } }); }); diff --git a/app/components/channel_drawer/index.js b/app/components/channel_drawer/index.js index 4d2114f7f..4324d3834 100644 --- a/app/components/channel_drawer/index.js +++ b/app/components/channel_drawer/index.js @@ -4,7 +4,7 @@ import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; -import {joinChannel, viewChannel, markChannelAsRead} from 'mattermost-redux/actions/channels'; +import {joinChannel, markChannelAsRead, markChannelAsViewed} from 'mattermost-redux/actions/channels'; import {getTeams} from 'mattermost-redux/actions/teams'; import {getCurrentTeamId, getMyTeamsCount} from 'mattermost-redux/selectors/entities/teams'; @@ -34,7 +34,7 @@ function mapDispatchToProps(dispatch) { getTeams, handleSelectChannel, joinChannel, - viewChannel, + markChannelAsViewed, makeDirectChannel, markChannelAsRead, setChannelDisplayName, diff --git a/app/mattermost.js b/app/mattermost.js index 31c80eb3c..439512d3b 100644 --- a/app/mattermost.js +++ b/app/mattermost.js @@ -472,7 +472,7 @@ export default class Mattermost { } if (data.type === 'clear') { - markChannelAsRead(data.channel_id)(dispatch, getState); + markChannelAsRead(data.channel_id, null, false)(dispatch, getState); } else if (foreground) { EventEmitter.emit(ViewTypes.NOTIFICATION_IN_APP, notification); } else if (userInteraction && !notification.localNotification) { diff --git a/app/screens/channel/channel.js b/app/screens/channel/channel.js index c3932f2be..e64095fde 100644 --- a/app/screens/channel/channel.js +++ b/app/screens/channel/channel.js @@ -37,14 +37,12 @@ class Channel extends PureComponent { connection: PropTypes.func.isRequired, loadChannelsIfNecessary: PropTypes.func.isRequired, loadProfilesAndTeamMembersForDMSidebar: PropTypes.func.isRequired, - markChannelAsRead: PropTypes.func.isRequired, selectFirstAvailableTeam: PropTypes.func.isRequired, selectInitialChannel: PropTypes.func.isRequired, initWebSocket: PropTypes.func.isRequired, closeWebSocket: PropTypes.func.isRequired, startPeriodicStatusUpdates: PropTypes.func.isRequired, - stopPeriodicStatusUpdates: PropTypes.func.isRequired, - viewChannel: PropTypes.func.isRequired + stopPeriodicStatusUpdates: PropTypes.func.isRequired }).isRequired, currentChannelId: PropTypes.string, channelsRequestFailed: PropTypes.bool, diff --git a/app/screens/channel/index.js b/app/screens/channel/index.js index f0584fc87..ec8b1ff90 100644 --- a/app/screens/channel/index.js +++ b/app/screens/channel/index.js @@ -4,7 +4,6 @@ import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; -import {viewChannel, markChannelAsRead} from 'mattermost-redux/actions/channels'; import {startPeriodicStatusUpdates, stopPeriodicStatusUpdates} from 'mattermost-redux/actions/users'; import {init as initWebSocket, close as closeWebSocket} from 'mattermost-redux/actions/websocket'; import {RequestStatus} from 'mattermost-redux/constants'; @@ -39,14 +38,12 @@ function mapDispatchToProps(dispatch) { connection, loadChannelsIfNecessary, loadProfilesAndTeamMembersForDMSidebar, - markChannelAsRead, selectFirstAvailableTeam, selectInitialChannel, initWebSocket, closeWebSocket, startPeriodicStatusUpdates, - stopPeriodicStatusUpdates, - viewChannel + stopPeriodicStatusUpdates }, dispatch) }; } diff --git a/app/screens/search/index.js b/app/screens/search/index.js index f57557ac7..400163221 100644 --- a/app/screens/search/index.js +++ b/app/screens/search/index.js @@ -4,7 +4,7 @@ import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; -import {viewChannel, markChannelAsRead} from 'mattermost-redux/actions/channels'; +import {markChannelAsRead, markChannelAsViewed} from 'mattermost-redux/actions/channels'; import {selectPost} from 'mattermost-redux/actions/posts'; import {clearSearch, removeSearchTerms, searchPosts} from 'mattermost-redux/actions/search'; import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels'; @@ -43,12 +43,12 @@ function mapDispatchToProps(dispatch) { handleSelectChannel, loadThreadIfNecessary, markChannelAsRead, + markChannelAsViewed, removeSearchTerms, searchPosts, selectPost, setChannelDisplayName, - setChannelLoading, - viewChannel + setChannelLoading }, dispatch) }; } diff --git a/app/screens/search/search.js b/app/screens/search/search.js index 3f9352674..be6c4614a 100644 --- a/app/screens/search/search.js +++ b/app/screens/search/search.js @@ -46,6 +46,8 @@ class Search extends PureComponent { clearSearch: PropTypes.func.isRequired, handleSearchDraftChanged: PropTypes.func.isRequired, loadThreadIfNecessary: PropTypes.func.isRequired, + markChannelAsRead: PropTypes.func.isRequired, + markChannelAsViewed: PropTypes.func.isRequired, removeSearchTerms: PropTypes.func.isRequired, searchPosts: PropTypes.func.isRequired, selectPost: PropTypes.func.isRequired @@ -442,7 +444,7 @@ class Search extends PureComponent { markChannelAsRead, setChannelLoading, setChannelDisplayName, - viewChannel + markChannelAsViewed } = actions; setChannelLoading(channelId !== currentChannelId); @@ -454,7 +456,7 @@ class Search extends PureComponent { // mark the channel as viewed after all the frame has flushed markChannelAsRead(channelId, currentChannelId); if (channelId !== currentChannelId) { - viewChannel(currentChannelId); + markChannelAsViewed(currentChannelId); } }); diff --git a/yarn.lock b/yarn.lock index 74e930772..b7e8e9e15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3961,7 +3961,7 @@ makeerror@1.0.x: mattermost-redux@mattermost/mattermost-redux#master: version "1.0.1" - resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/1c755c104fccbe30a2c31a423e031971d9a7c7d1" + resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/cd2699d64fe044a9c9c32fcdd9c18ab7fa420e6d" dependencies: deep-equal "1.0.1" form-data "2.3.1"