mattermost-mobile/app/screens/channel/index.js
Elias Nahum 56c593d36c
MM-25946 prompt sys admins if they are running server versions below 5.19 (#4488)
* MM-25946 prompt sys admins if they are running server versions below 5.19

* Update alert message

* Change alert buttons
2020-06-26 15:58:37 -04:00

59 lines
2.2 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {loadChannelsForTeam, selectInitialChannel} from '@actions/views/channel';
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 {getCurrentChannelId} from '@mm-redux/selectors/entities/channels';
import {getServerVersion} from '@mm-redux/selectors/entities/general';
import {getTheme} from '@mm-redux/selectors/entities/preferences';
import {getCurrentTeam} from '@mm-redux/selectors/entities/teams';
import {getCurrentUserId, getCurrentUserRoles, shouldShowTermsOfService} from '@mm-redux/selectors/entities/users';
import {isMinimumServerVersion} from '@mm-redux/utils/helpers';
import {isSystemAdmin as checkIsSystemAdmin} from '@mm-redux/utils/user_utils';
import Channel from './channel';
function mapStateToProps(state) {
const currentTeam = getCurrentTeam(state);
const roles = getCurrentUserId(state) ? getCurrentUserRoles(state) : '';
const isSystemAdmin = checkIsSystemAdmin(roles);
let isSupportedServer = true;
if (isSystemAdmin) {
isSupportedServer = isMinimumServerVersion(
getServerVersion(state),
ViewTypes.RequiredServer.MAJOR_VERSION,
ViewTypes.RequiredServer.MIN_VERSION,
ViewTypes.RequiredServer.PATCH_VERSION,
);
}
return {
currentTeamId: currentTeam?.id,
currentChannelId: getCurrentChannelId(state),
isSupportedServer,
teamName: currentTeam?.display_name,
theme: getTheme(state),
showTermsOfService: shouldShowTermsOfService(state),
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
getChannelStats,
loadChannelsForTeam,
selectDefaultTeam,
selectInitialChannel,
recordLoadTime,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Channel);