forked from Ivasoft/mattermost-mobile
Show join teams option in the team sidebar when there are other joinable teams (#2293)
This commit is contained in:
@@ -5,7 +5,7 @@ import {bindActionCreators} from 'redux';
|
||||
import {connect} from 'react-redux';
|
||||
|
||||
import {getCurrentUrl} from 'mattermost-redux/selectors/entities/general';
|
||||
import {getCurrentTeamId, getMySortedTeamIds} from 'mattermost-redux/selectors/entities/teams';
|
||||
import {getCurrentTeamId, getMySortedTeamIds, getJoinableTeamIds} from 'mattermost-redux/selectors/entities/teams';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
|
||||
import {handleTeamChange} from 'app/actions/views/select_team';
|
||||
@@ -20,6 +20,7 @@ function mapStateToProps(state) {
|
||||
return {
|
||||
currentTeamId: getCurrentTeamId(state),
|
||||
currentUrl: removeProtocol(getCurrentUrl(state)),
|
||||
hasOtherJoinableTeams: getJoinableTeamIds(state).length > 0,
|
||||
teamIds: getMySortedTeamIds(state, locale),
|
||||
theme: getTheme(state),
|
||||
};
|
||||
|
||||
@@ -36,6 +36,7 @@ export default class TeamsList extends PureComponent {
|
||||
closeChannelDrawer: PropTypes.func.isRequired,
|
||||
currentTeamId: PropTypes.string.isRequired,
|
||||
currentUrl: PropTypes.string.isRequired,
|
||||
hasOtherJoinableTeams: PropTypes.bool,
|
||||
navigator: PropTypes.object.isRequired,
|
||||
teamIds: PropTypes.array.isRequired,
|
||||
theme: PropTypes.object.isRequired,
|
||||
@@ -109,22 +110,25 @@ export default class TeamsList extends PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const {teamIds, theme} = this.props;
|
||||
const {hasOtherJoinableTeams, teamIds, theme} = this.props;
|
||||
const styles = getStyleSheet(theme);
|
||||
|
||||
const moreAction = (
|
||||
<TouchableHighlight
|
||||
style={styles.moreActionContainer}
|
||||
onPress={this.goToSelectTeam}
|
||||
underlayColor={changeOpacity(theme.sidebarHeaderBg, 0.5)}
|
||||
>
|
||||
<Text
|
||||
style={styles.moreAction}
|
||||
let moreAction;
|
||||
if (hasOtherJoinableTeams) {
|
||||
moreAction = (
|
||||
<TouchableHighlight
|
||||
style={styles.moreActionContainer}
|
||||
onPress={this.goToSelectTeam}
|
||||
underlayColor={changeOpacity(theme.sidebarHeaderBg, 0.5)}
|
||||
>
|
||||
{'+'}
|
||||
</Text>
|
||||
</TouchableHighlight>
|
||||
);
|
||||
<Text
|
||||
style={styles.moreAction}
|
||||
>
|
||||
{'+'}
|
||||
</Text>
|
||||
</TouchableHighlight>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
|
||||
Reference in New Issue
Block a user