Show the unsupported alert if server version is available (#4608)

* Show the unsupported alert if server version is available

* Check for supported server version when channel screen updates
This commit is contained in:
Elias Nahum 2020-07-27 11:03:57 -04:00
parent 3e263e9119
commit 977b385dc7
No known key found for this signature in database
GPG key ID: E038DB71E0B61702
2 changed files with 16 additions and 6 deletions

View file

@ -118,6 +118,10 @@ export default class ChannelBase extends PureComponent {
this.props.actions.recordLoadTime('Switch Team', 'teamSwitch');
}
if (prevProps.isSupportedServer && !this.props.isSupportedServer) {
unsupportedServer(this.props.isSystemAdmin, this.context.intl.formatMessage);
}
if (this.props.theme !== prevProps.theme) {
setNavigatorStyles(this.props.componentId, this.props.theme);
EphemeralStore.allNavigationComponentIds.forEach((componentId) => {

View file

@ -9,6 +9,7 @@ import {recordLoadTime} from '@actions/views/root';
import {selectDefaultTeam} from '@actions/views/select_team';
import {ViewTypes} from '@constants';
import {getChannelStats} from '@mm-redux/actions/channels';
import {Client4} from '@mm-redux/client';
import {getCurrentChannelId} from '@mm-redux/selectors/entities/channels';
import {getServerVersion} from '@mm-redux/selectors/entities/general';
import {getTheme} from '@mm-redux/selectors/entities/preferences';
@ -23,12 +24,17 @@ function mapStateToProps(state) {
const currentTeam = getCurrentTeam(state);
const roles = getCurrentUserId(state) ? getCurrentUserRoles(state) : '';
const isSystemAdmin = checkIsSystemAdmin(roles);
const isSupportedServer = isMinimumServerVersion(
getServerVersion(state),
ViewTypes.RequiredServer.MAJOR_VERSION,
ViewTypes.RequiredServer.MIN_VERSION,
ViewTypes.RequiredServer.PATCH_VERSION,
);
const serverVersion = Client4.getServerVersion() || getServerVersion(state);
let isSupportedServer = true;
if (serverVersion) {
isSupportedServer = isMinimumServerVersion(
serverVersion,
ViewTypes.RequiredServer.MAJOR_VERSION,
ViewTypes.RequiredServer.MIN_VERSION,
ViewTypes.RequiredServer.PATCH_VERSION,
);
}
return {
currentTeamId: currentTeam?.id,