MM-16477 Check for modified users on reconnect (#2936)
* MM-16477 Move websocket status to redux * MM-16477 Check for modified users on reconnect * Update mattermost-redux * Update mattermost-redux
This commit is contained in:
parent
9f88923656
commit
0ff6dba3c8
8 changed files with 12 additions and 42 deletions
|
|
@ -198,7 +198,7 @@ export function loadPostsIfNecessaryWithRetry(channelId) {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
const {lastConnectAt} = state.device.websocket;
|
||||
const {lastConnectAt} = state.websocket;
|
||||
const lastGetPosts = state.views.channel.lastGetPosts[channelId];
|
||||
|
||||
let since;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import dimension from './dimension';
|
|||
import isTablet from './is_tablet';
|
||||
import orientation from './orientation';
|
||||
import statusBarHeight from './status_bar';
|
||||
import websocket from './websocket';
|
||||
|
||||
export default combineReducers({
|
||||
connection,
|
||||
|
|
@ -16,5 +15,4 @@ export default combineReducers({
|
|||
isTablet,
|
||||
orientation,
|
||||
statusBarHeight,
|
||||
websocket,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {GeneralTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||
|
||||
function getInitialState() {
|
||||
return {
|
||||
connected: false,
|
||||
lastConnectAt: 0,
|
||||
lastDisconnectAt: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export default function(state = getInitialState(), action) {
|
||||
if (!state.connected && action.type === GeneralTypes.WEBSOCKET_SUCCESS) {
|
||||
return {
|
||||
...state,
|
||||
connected: true,
|
||||
lastConnectAt: new Date().getTime(),
|
||||
};
|
||||
} else if (state.connected && (action.type === GeneralTypes.WEBSOCKET_FAILURE || action.type === GeneralTypes.WEBSOCKET_CLOSED)) {
|
||||
return {
|
||||
...state,
|
||||
connected: false,
|
||||
lastDisconnectAt: new Date().getTime(),
|
||||
};
|
||||
}
|
||||
|
||||
if (action.type === UserTypes.LOGOUT_SUCCESS) {
|
||||
return getInitialState();
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
@ -172,6 +172,10 @@ function resetStateForNewVersion(action) {
|
|||
selectServer,
|
||||
recentEmojis,
|
||||
},
|
||||
websocket: {
|
||||
lastConnectAt: payload.websocket?.lastConnectAt,
|
||||
lastDisconnectAt: payload.websocket?.lastDisconnectAt,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
@ -328,6 +332,10 @@ export function cleanUpState(action, keepCurrent = false) {
|
|||
...payload.views.channel,
|
||||
},
|
||||
},
|
||||
websocket: {
|
||||
lastConnectAt: payload.websocket?.lastConnectAt,
|
||||
lastDisconnectAt: payload.websocket?.lastDisconnectAt,
|
||||
},
|
||||
};
|
||||
|
||||
nextState.errors = payload.errors;
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -13155,8 +13155,8 @@
|
|||
"integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A=="
|
||||
},
|
||||
"mattermost-redux": {
|
||||
"version": "github:mattermost/mattermost-redux#f9b616dfbb532e1a196be67744e2277366532a73",
|
||||
"from": "github:mattermost/mattermost-redux#f9b616dfbb532e1a196be67744e2277366532a73",
|
||||
"version": "github:mattermost/mattermost-redux#66dcea7c71de9f87e3fe12652458e16f9517f6b7",
|
||||
"from": "github:mattermost/mattermost-redux#66dcea7c71de9f87e3fe12652458e16f9517f6b7",
|
||||
"requires": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint-plugin-header": "3.0.0",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
"intl": "1.2.5",
|
||||
"jail-monkey": "2.2.0",
|
||||
"jsc-android": "241213.2.0",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#f9b616dfbb532e1a196be67744e2277366532a73",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#66dcea7c71de9f87e3fe12652458e16f9517f6b7",
|
||||
"mime-db": "1.40.0",
|
||||
"moment-timezone": "0.5.25",
|
||||
"prop-types": "15.7.2",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ module.exports = [
|
|||
'app/reducers/device/is_tablet.js',
|
||||
'app/reducers/device/orientation.js',
|
||||
'app/reducers/device/status_bar.js',
|
||||
'app/reducers/device/websocket.js',
|
||||
'app/reducers/index.js',
|
||||
'app/reducers/navigation/index.js',
|
||||
'app/reducers/views/announcement.js',
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ module.exports = ['./node_modules/app/components/loading.js',
|
|||
'./node_modules/app/reducers/device/is_tablet.js',
|
||||
'./node_modules/app/reducers/device/orientation.js',
|
||||
'./node_modules/app/reducers/device/status_bar.js',
|
||||
'./node_modules/app/reducers/device/websocket.js',
|
||||
'./node_modules/app/reducers/index.js',
|
||||
'./node_modules/app/reducers/navigation/index.js',
|
||||
'./node_modules/app/reducers/views/announcement.js',
|
||||
|
|
|
|||
Loading…
Reference in a new issue