forked from Ivasoft/mattermost-mobile
* Fixing team join without the invite id * Fixing tests * Adding tests to verify proper behavior calling the correct function based on the server version * Extract server version from headers * Make linter happy * Update mattermost-redux * Update mattermost-redux
44 lines
1.4 KiB
JavaScript
44 lines
1.4 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 {getTeams, addUserToTeam, joinTeam} from 'mattermost-redux/actions/teams';
|
|
import {logout} from 'mattermost-redux/actions/users';
|
|
import {getJoinableTeams} from 'mattermost-redux/selectors/entities/teams';
|
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
|
|
|
import {handleTeamChange} from 'app/actions/views/select_team';
|
|
import {isLandscape} from 'app/selectors/device';
|
|
import {isGuest} from 'app/utils/users';
|
|
|
|
import SelectTeam from './select_team.js';
|
|
|
|
function mapStateToProps(state) {
|
|
const currentUser = getCurrentUser(state);
|
|
const currentUserIsGuest = isGuest(currentUser);
|
|
return {
|
|
teamsRequest: state.requests.teams.getTeams,
|
|
teams: getJoinableTeams(state),
|
|
isLandscape: isLandscape(state),
|
|
currentUserId: currentUser && currentUser.id,
|
|
currentUserIsGuest,
|
|
serverVersion: state.entities.general.serverVersion,
|
|
};
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
return {
|
|
actions: bindActionCreators({
|
|
getTeams,
|
|
handleTeamChange,
|
|
joinTeam,
|
|
addUserToTeam,
|
|
logout,
|
|
}, dispatch),
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(SelectTeam);
|