MM-20947 Don't mark channel as read when reconnecting to manually unread channel (#3685)
This commit is contained in:
parent
855c12d80e
commit
dc66b443a3
3 changed files with 16 additions and 4 deletions
|
|
@ -33,6 +33,7 @@ import {
|
|||
getMyChannelMember,
|
||||
getRedirectChannelNameForTeam,
|
||||
getChannelsNameMapInTeam,
|
||||
isManuallyUnread,
|
||||
} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {getCurrentTeamId, getTeamByName} from 'mattermost-redux/selectors/entities/teams';
|
||||
|
||||
|
|
@ -447,6 +448,17 @@ export function markChannelViewedAndRead(channelId, previousChannelId, markOnSer
|
|||
};
|
||||
}
|
||||
|
||||
export function markChannelViewedAndReadOnReconnect(channelId) {
|
||||
return (dispatch, getState) => {
|
||||
if (isManuallyUnread(getState(), channelId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(markChannelAsRead(channelId));
|
||||
dispatch(markChannelAsViewed(channelId));
|
||||
};
|
||||
}
|
||||
|
||||
export function toggleDMChannel(otherUserId, visible, channelId) {
|
||||
return async (dispatch, getState) => {
|
||||
const state = getState();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {init as initWebSocket, close as closeWebSocket} from 'mattermost-redux/a
|
|||
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
|
||||
|
||||
import {connection} from 'app/actions/device';
|
||||
import {markChannelViewedAndRead, setChannelRetryFailed} from 'app/actions/views/channel';
|
||||
import {markChannelViewedAndReadOnReconnect, setChannelRetryFailed} from 'app/actions/views/channel';
|
||||
import {setCurrentUserStatusOffline} from 'app/actions/views/user';
|
||||
import {getConnection, isLandscape} from 'app/selectors/device';
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ function mapDispatchToProps(dispatch) {
|
|||
connection,
|
||||
initWebSocket,
|
||||
logout,
|
||||
markChannelViewedAndRead,
|
||||
markChannelViewedAndReadOnReconnect,
|
||||
setChannelRetryFailed,
|
||||
setCurrentUserStatusOffline,
|
||||
startPeriodicStatusUpdates,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export default class NetworkIndicator extends PureComponent {
|
|||
closeWebSocket: PropTypes.func.isRequired,
|
||||
connection: PropTypes.func.isRequired,
|
||||
initWebSocket: PropTypes.func.isRequired,
|
||||
markChannelViewedAndRead: PropTypes.func.isRequired,
|
||||
markChannelViewedAndReadOnReconnect: PropTypes.func.isRequired,
|
||||
logout: PropTypes.func.isRequired,
|
||||
setChannelRetryFailed: PropTypes.func.isRequired,
|
||||
setCurrentUserStatusOffline: PropTypes.func.isRequired,
|
||||
|
|
@ -245,7 +245,7 @@ export default class NetworkIndicator extends PureComponent {
|
|||
// foreground by tapping a notification from another channel
|
||||
this.clearNotificationTimeout = setTimeout(() => {
|
||||
PushNotifications.clearChannelNotifications(currentChannelId);
|
||||
actions.markChannelViewedAndRead(currentChannelId);
|
||||
actions.markChannelViewedAndReadOnReconnect(currentChannelId);
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue