2017-08-10 16:25:50 +00:00
|
|
|
import React from 'react';
|
2017-09-01 19:42:50 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import PropTypes from 'prop-types';
|
2018-09-25 19:28:42 +00:00
|
|
|
import {
|
2019-12-04 16:39:53 +00:00
|
|
|
View, Text, Switch, ScrollView, StyleSheet, FlatList
|
2018-09-25 19:28:42 +00:00
|
|
|
} from 'react-native';
|
2021-03-15 20:16:34 +00:00
|
|
|
import { dequal } from 'dequal';
|
|
|
|
import * as List from '../containers/List';
|
2018-04-03 16:24:59 +00:00
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
import TextInput from '../presentation/TextInput';
|
2018-04-24 19:34:03 +00:00
|
|
|
import Loading from '../containers/Loading';
|
2018-09-25 19:28:42 +00:00
|
|
|
import { createChannelRequest as createChannelRequestAction } from '../actions/createChannel';
|
|
|
|
import { removeUser as removeUserAction } from '../actions/selectedUsers';
|
2018-08-31 18:13:30 +00:00
|
|
|
import sharedStyles from './Styles';
|
2017-09-01 20:00:31 +00:00
|
|
|
import KeyboardView from '../presentation/KeyboardView';
|
2018-04-24 19:34:03 +00:00
|
|
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
2018-06-01 17:38:13 +00:00
|
|
|
import I18n from '../i18n';
|
2018-08-31 18:13:30 +00:00
|
|
|
import UserItem from '../presentation/UserItem';
|
2020-10-30 16:15:58 +00:00
|
|
|
import * as HeaderButton from '../containers/HeaderButton';
|
2019-03-12 16:23:06 +00:00
|
|
|
import StatusBar from '../containers/StatusBar';
|
2019-12-04 16:39:53 +00:00
|
|
|
import { SWITCH_TRACK_COLOR, themes } from '../constants/colors';
|
|
|
|
import { withTheme } from '../theme';
|
2020-02-03 18:28:18 +00:00
|
|
|
import { Review } from '../utils/review';
|
2020-02-11 14:09:14 +00:00
|
|
|
import { getUserSelector } from '../selectors/login';
|
2020-07-30 13:26:17 +00:00
|
|
|
import { logEvent, events } from '../utils/log';
|
2020-06-15 14:00:46 +00:00
|
|
|
import SafeAreaView from '../containers/SafeAreaView';
|
2018-08-31 18:13:30 +00:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
2018-09-11 16:32:52 +00:00
|
|
|
flex: 1
|
2018-08-31 18:13:30 +00:00
|
|
|
},
|
|
|
|
list: {
|
2019-12-04 16:39:53 +00:00
|
|
|
width: '100%'
|
2018-08-31 18:13:30 +00:00
|
|
|
},
|
|
|
|
input: {
|
|
|
|
height: 54,
|
|
|
|
paddingHorizontal: 18,
|
2019-03-29 19:36:07 +00:00
|
|
|
fontSize: 17,
|
2019-12-04 16:39:53 +00:00
|
|
|
...sharedStyles.textRegular
|
2018-08-31 18:13:30 +00:00
|
|
|
},
|
2020-03-26 13:14:51 +00:00
|
|
|
switchContainer: {
|
2018-08-31 18:13:30 +00:00
|
|
|
height: 54,
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
flexDirection: 'row',
|
|
|
|
paddingHorizontal: 18
|
|
|
|
},
|
|
|
|
label: {
|
2019-03-29 19:36:07 +00:00
|
|
|
fontSize: 17,
|
2019-12-04 16:39:53 +00:00
|
|
|
...sharedStyles.textMedium
|
2018-08-31 18:13:30 +00:00
|
|
|
},
|
|
|
|
invitedHeader: {
|
|
|
|
marginTop: 18,
|
|
|
|
marginHorizontal: 15,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
alignItems: 'center'
|
|
|
|
},
|
|
|
|
invitedTitle: {
|
2019-03-29 19:36:07 +00:00
|
|
|
fontSize: 18,
|
|
|
|
...sharedStyles.textSemibold,
|
2018-08-31 18:13:30 +00:00
|
|
|
lineHeight: 41
|
|
|
|
},
|
|
|
|
invitedCount: {
|
2019-03-29 19:36:07 +00:00
|
|
|
fontSize: 14,
|
2019-12-04 16:39:53 +00:00
|
|
|
...sharedStyles.textRegular
|
2018-08-31 18:13:30 +00:00
|
|
|
}
|
|
|
|
});
|
2017-08-10 16:25:50 +00:00
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
class CreateChannelView extends React.Component {
|
2017-09-01 19:42:50 +00:00
|
|
|
static propTypes = {
|
2019-03-12 16:23:06 +00:00
|
|
|
navigation: PropTypes.object,
|
2021-06-15 20:13:42 +00:00
|
|
|
route: PropTypes.object,
|
2018-09-11 16:32:52 +00:00
|
|
|
baseUrl: PropTypes.string,
|
2018-04-10 13:03:54 +00:00
|
|
|
create: PropTypes.func.isRequired,
|
2018-08-31 18:13:30 +00:00
|
|
|
removeUser: PropTypes.func.isRequired,
|
2018-10-23 21:39:48 +00:00
|
|
|
error: PropTypes.object,
|
|
|
|
failure: PropTypes.bool,
|
|
|
|
isFetching: PropTypes.bool,
|
2021-01-25 17:14:45 +00:00
|
|
|
encryptionEnabled: PropTypes.bool,
|
2019-02-07 19:58:20 +00:00
|
|
|
users: PropTypes.array.isRequired,
|
|
|
|
user: PropTypes.shape({
|
|
|
|
id: PropTypes.string,
|
|
|
|
token: PropTypes.string
|
2019-12-04 16:39:53 +00:00
|
|
|
}),
|
2021-06-15 20:13:42 +00:00
|
|
|
theme: PropTypes.string,
|
|
|
|
teamId: PropTypes.string
|
2017-09-25 13:15:28 +00:00
|
|
|
};
|
2017-08-10 16:25:50 +00:00
|
|
|
|
2021-06-15 20:13:42 +00:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
const { route } = this.props;
|
|
|
|
const isTeam = route?.params?.isTeam || false;
|
|
|
|
this.teamId = route?.params?.teamId;
|
|
|
|
this.state = {
|
|
|
|
channelName: '',
|
|
|
|
type: true,
|
|
|
|
readOnly: false,
|
|
|
|
encrypted: false,
|
|
|
|
broadcast: false,
|
|
|
|
isTeam
|
|
|
|
};
|
|
|
|
this.setHeader();
|
2017-09-25 13:15:28 +00:00
|
|
|
}
|
|
|
|
|
2018-12-21 10:55:35 +00:00
|
|
|
shouldComponentUpdate(nextProps, nextState) {
|
|
|
|
const {
|
2020-09-11 14:31:38 +00:00
|
|
|
channelName, type, readOnly, broadcast, encrypted
|
2018-12-21 10:55:35 +00:00
|
|
|
} = this.state;
|
2020-09-11 14:31:38 +00:00
|
|
|
const {
|
2021-01-25 17:14:45 +00:00
|
|
|
users, isFetching, encryptionEnabled, theme
|
2020-09-11 14:31:38 +00:00
|
|
|
} = this.props;
|
2019-12-04 16:39:53 +00:00
|
|
|
if (nextProps.theme !== theme) {
|
|
|
|
return true;
|
|
|
|
}
|
2018-12-21 10:55:35 +00:00
|
|
|
if (nextState.channelName !== channelName) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (nextState.type !== type) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (nextState.readOnly !== readOnly) {
|
|
|
|
return true;
|
|
|
|
}
|
2020-09-11 14:31:38 +00:00
|
|
|
if (nextState.encrypted !== encrypted) {
|
|
|
|
return true;
|
|
|
|
}
|
2018-12-21 10:55:35 +00:00
|
|
|
if (nextState.broadcast !== broadcast) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (nextProps.isFetching !== isFetching) {
|
|
|
|
return true;
|
|
|
|
}
|
2021-01-25 17:14:45 +00:00
|
|
|
if (nextProps.encryptionEnabled !== encryptionEnabled) {
|
2020-09-11 14:31:38 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-03-15 20:16:34 +00:00
|
|
|
if (!dequal(nextProps.users, users)) {
|
2018-12-21 10:55:35 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-06-15 20:13:42 +00:00
|
|
|
setHeader = () => {
|
|
|
|
const { navigation } = this.props;
|
|
|
|
const { isTeam } = this.state;
|
|
|
|
|
|
|
|
navigation.setOptions({
|
|
|
|
title: isTeam ? I18n.t('Create_Team') : I18n.t('Create_Channel')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-06-15 14:00:46 +00:00
|
|
|
toggleRightButton = (channelName) => {
|
2019-03-12 16:23:06 +00:00
|
|
|
const { navigation } = this.props;
|
2020-06-15 14:00:46 +00:00
|
|
|
navigation.setOptions({
|
|
|
|
headerRight: () => channelName.trim().length > 0 && (
|
2020-10-30 16:15:58 +00:00
|
|
|
<HeaderButton.Container>
|
|
|
|
<HeaderButton.Item title={I18n.t('Create')} onPress={this.submit} testID='create-channel-submit' />
|
|
|
|
</HeaderButton.Container>
|
2020-06-15 14:00:46 +00:00
|
|
|
)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
onChangeText = (channelName) => {
|
|
|
|
this.toggleRightButton(channelName);
|
2018-08-31 18:13:30 +00:00
|
|
|
this.setState({ channelName });
|
|
|
|
}
|
|
|
|
|
2018-05-24 20:17:45 +00:00
|
|
|
submit = () => {
|
|
|
|
const {
|
2021-06-15 20:13:42 +00:00
|
|
|
channelName, type, readOnly, broadcast, encrypted, isTeam
|
2018-05-24 20:17:45 +00:00
|
|
|
} = this.state;
|
2021-06-15 20:13:42 +00:00
|
|
|
const {
|
|
|
|
users: usersProps, isFetching, create
|
|
|
|
} = this.props;
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2018-10-23 21:39:48 +00:00
|
|
|
if (!channelName.trim() || isFetching) {
|
2018-09-25 19:28:42 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-09-25 13:15:28 +00:00
|
|
|
|
|
|
|
// transform users object into array of usernames
|
2018-09-25 19:28:42 +00:00
|
|
|
const users = usersProps.map(user => user.name);
|
2017-09-25 13:15:28 +00:00
|
|
|
|
2021-06-15 20:13:42 +00:00
|
|
|
// create channel or team
|
2018-09-25 19:28:42 +00:00
|
|
|
create({
|
2021-06-15 20:13:42 +00:00
|
|
|
name: channelName, users, type, readOnly, broadcast, encrypted, isTeam, teamId: this.teamId
|
2018-05-24 20:17:45 +00:00
|
|
|
});
|
2020-02-03 18:28:18 +00:00
|
|
|
|
|
|
|
Review.pushPositiveEvent();
|
2017-08-10 16:25:50 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 18:13:30 +00:00
|
|
|
removeUser = (user) => {
|
2021-03-15 20:16:34 +00:00
|
|
|
logEvent(events.CR_REMOVE_USER);
|
2020-03-03 21:25:23 +00:00
|
|
|
const { removeUser } = this.props;
|
2018-09-25 19:28:42 +00:00
|
|
|
removeUser(user);
|
2017-09-21 17:08:00 +00:00
|
|
|
}
|
|
|
|
|
2018-05-24 20:17:45 +00:00
|
|
|
renderSwitch = ({
|
2018-08-31 18:13:30 +00:00
|
|
|
id, value, label, onValueChange, disabled = false
|
2019-12-04 16:39:53 +00:00
|
|
|
}) => {
|
|
|
|
const { theme } = this.props;
|
|
|
|
return (
|
2020-03-26 13:14:51 +00:00
|
|
|
<View style={[styles.switchContainer, { backgroundColor: themes[theme].backgroundColor }]}>
|
2019-12-04 16:39:53 +00:00
|
|
|
<Text style={[styles.label, { color: themes[theme].titleText }]}>{I18n.t(label)}</Text>
|
|
|
|
<Switch
|
|
|
|
value={value}
|
|
|
|
onValueChange={onValueChange}
|
|
|
|
testID={`create-channel-${ id }`}
|
|
|
|
trackColor={SWITCH_TRACK_COLOR}
|
|
|
|
disabled={disabled}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2018-05-24 20:17:45 +00:00
|
|
|
|
|
|
|
renderType() {
|
2021-06-15 20:13:42 +00:00
|
|
|
const { type, isTeam } = this.state;
|
|
|
|
|
2018-05-24 20:17:45 +00:00
|
|
|
return this.renderSwitch({
|
|
|
|
id: 'type',
|
|
|
|
value: type,
|
2021-06-15 20:13:42 +00:00
|
|
|
label: isTeam ? 'Private_Team' : 'Private_Channel',
|
2020-07-30 13:26:17 +00:00
|
|
|
onValueChange: (value) => {
|
2021-03-15 20:16:34 +00:00
|
|
|
logEvent(events.CR_TOGGLE_TYPE);
|
2020-09-11 14:31:38 +00:00
|
|
|
// If we set the channel as public, encrypted status should be false
|
|
|
|
this.setState(({ encrypted }) => ({ type: value, encrypted: value && encrypted }));
|
2020-07-30 13:26:17 +00:00
|
|
|
}
|
2018-05-24 20:17:45 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
renderReadOnly() {
|
2021-06-15 20:13:42 +00:00
|
|
|
const { readOnly, broadcast, isTeam } = this.state;
|
|
|
|
|
2018-05-24 20:17:45 +00:00
|
|
|
return this.renderSwitch({
|
|
|
|
id: 'readonly',
|
|
|
|
value: readOnly,
|
2021-06-15 20:13:42 +00:00
|
|
|
label: isTeam ? 'Read_Only_Team' : 'Read_Only_Channel',
|
2020-07-30 13:26:17 +00:00
|
|
|
onValueChange: (value) => {
|
2021-03-15 20:16:34 +00:00
|
|
|
logEvent(events.CR_TOGGLE_READ_ONLY);
|
2020-07-30 13:26:17 +00:00
|
|
|
this.setState({ readOnly: value });
|
|
|
|
},
|
2018-05-24 20:17:45 +00:00
|
|
|
disabled: broadcast
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-11 14:31:38 +00:00
|
|
|
renderEncrypted() {
|
|
|
|
const { type, encrypted } = this.state;
|
2021-01-25 17:14:45 +00:00
|
|
|
const { encryptionEnabled } = this.props;
|
2020-09-11 14:31:38 +00:00
|
|
|
|
2021-01-25 17:14:45 +00:00
|
|
|
if (!encryptionEnabled) {
|
2020-09-11 14:31:38 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.renderSwitch({
|
|
|
|
id: 'encrypted',
|
|
|
|
value: encrypted,
|
|
|
|
label: 'Encrypted',
|
|
|
|
onValueChange: (value) => {
|
2021-03-15 20:16:34 +00:00
|
|
|
logEvent(events.CR_TOGGLE_ENCRYPTED);
|
2020-09-11 14:31:38 +00:00
|
|
|
this.setState({ encrypted: value });
|
|
|
|
},
|
|
|
|
disabled: !type
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-05-24 20:17:45 +00:00
|
|
|
renderBroadcast() {
|
2021-06-15 20:13:42 +00:00
|
|
|
const { broadcast, readOnly, isTeam } = this.state;
|
|
|
|
|
2018-05-24 20:17:45 +00:00
|
|
|
return this.renderSwitch({
|
|
|
|
id: 'broadcast',
|
|
|
|
value: broadcast,
|
2021-06-15 20:13:42 +00:00
|
|
|
label: isTeam ? 'Broadcast_Team' : 'Broadcast_Channel',
|
2018-05-24 20:17:45 +00:00
|
|
|
onValueChange: (value) => {
|
2021-03-15 20:16:34 +00:00
|
|
|
logEvent(events.CR_TOGGLE_BROADCAST);
|
2018-05-24 20:17:45 +00:00
|
|
|
this.setState({
|
|
|
|
broadcast: value,
|
|
|
|
readOnly: value ? true : readOnly
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2017-09-21 17:08:00 +00:00
|
|
|
}
|
|
|
|
|
2018-09-25 19:28:42 +00:00
|
|
|
renderItem = ({ item }) => {
|
2019-12-04 16:39:53 +00:00
|
|
|
const { baseUrl, user, theme } = this.props;
|
2018-08-31 18:13:30 +00:00
|
|
|
|
2018-09-25 19:28:42 +00:00
|
|
|
return (
|
|
|
|
<UserItem
|
|
|
|
name={item.fname}
|
|
|
|
username={item.name}
|
|
|
|
onPress={() => this.removeUser(item)}
|
|
|
|
testID={`create-channel-view-item-${ item.name }`}
|
2020-03-03 21:25:23 +00:00
|
|
|
icon='check'
|
2018-09-25 19:28:42 +00:00
|
|
|
baseUrl={baseUrl}
|
2019-02-07 19:58:20 +00:00
|
|
|
user={user}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-09-25 19:28:42 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderInvitedList = () => {
|
2019-12-04 16:39:53 +00:00
|
|
|
const { users, theme } = this.props;
|
2018-09-25 19:28:42 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<FlatList
|
|
|
|
data={users}
|
|
|
|
extraData={users}
|
|
|
|
keyExtractor={item => item._id}
|
2019-12-04 16:39:53 +00:00
|
|
|
style={[
|
|
|
|
styles.list,
|
|
|
|
sharedStyles.separatorVertical,
|
|
|
|
{
|
|
|
|
backgroundColor: themes[theme].focusedBackground,
|
|
|
|
borderColor: themes[theme].separatorColor
|
|
|
|
}
|
|
|
|
]}
|
2018-09-25 19:28:42 +00:00
|
|
|
renderItem={this.renderItem}
|
2021-03-15 20:16:34 +00:00
|
|
|
ItemSeparatorComponent={List.Separator}
|
2018-09-25 19:28:42 +00:00
|
|
|
enableEmptySections
|
|
|
|
keyboardShouldPersistTaps='always'
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2018-08-31 18:13:30 +00:00
|
|
|
|
2017-08-10 16:25:50 +00:00
|
|
|
render() {
|
2021-06-15 20:13:42 +00:00
|
|
|
const { channelName, isTeam } = this.state;
|
|
|
|
const {
|
|
|
|
users, isFetching, theme
|
|
|
|
} = this.props;
|
2018-09-25 19:28:42 +00:00
|
|
|
const userCount = users.length;
|
|
|
|
|
2017-08-10 16:25:50 +00:00
|
|
|
return (
|
2017-11-07 16:28:02 +00:00
|
|
|
<KeyboardView
|
2019-12-04 16:39:53 +00:00
|
|
|
style={{ backgroundColor: themes[theme].auxiliaryBackground }}
|
2018-08-31 18:13:30 +00:00
|
|
|
contentContainerStyle={[sharedStyles.container, styles.container]}
|
2018-04-24 19:34:03 +00:00
|
|
|
keyboardVerticalOffset={128}
|
2017-11-07 16:28:02 +00:00
|
|
|
>
|
2020-10-30 13:59:44 +00:00
|
|
|
<StatusBar />
|
|
|
|
<SafeAreaView testID='create-channel-view'>
|
2018-08-31 18:13:30 +00:00
|
|
|
<ScrollView {...scrollPersistTaps}>
|
2019-12-04 16:39:53 +00:00
|
|
|
<View style={[sharedStyles.separatorVertical, { borderColor: themes[theme].separatorColor }]}>
|
2018-08-31 18:13:30 +00:00
|
|
|
<TextInput
|
2019-08-07 19:20:16 +00:00
|
|
|
autoFocus
|
2019-12-04 16:39:53 +00:00
|
|
|
style={[styles.input, { backgroundColor: themes[theme].backgroundColor }]}
|
2021-06-15 20:13:42 +00:00
|
|
|
label={isTeam ? I18n.t('Team_Name') : I18n.t('Channel_Name')}
|
2018-09-25 19:28:42 +00:00
|
|
|
value={channelName}
|
2018-08-31 18:13:30 +00:00
|
|
|
onChangeText={this.onChangeText}
|
2021-06-15 20:13:42 +00:00
|
|
|
placeholder={isTeam ? I18n.t('Team_Name') : I18n.t('Channel_Name')}
|
2018-08-31 18:13:30 +00:00
|
|
|
returnKeyType='done'
|
|
|
|
testID='create-channel-name'
|
|
|
|
autoCorrect={false}
|
|
|
|
autoCapitalize='none'
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-08-31 18:13:30 +00:00
|
|
|
underlineColorAndroid='transparent'
|
2018-05-24 20:17:45 +00:00
|
|
|
/>
|
2021-03-15 20:16:34 +00:00
|
|
|
<List.Separator />
|
2018-08-31 18:13:30 +00:00
|
|
|
{this.renderType()}
|
2021-03-15 20:16:34 +00:00
|
|
|
<List.Separator />
|
2018-08-31 18:13:30 +00:00
|
|
|
{this.renderReadOnly()}
|
2021-03-15 20:16:34 +00:00
|
|
|
<List.Separator />
|
2020-09-11 14:31:38 +00:00
|
|
|
{this.renderEncrypted()}
|
2021-03-15 20:16:34 +00:00
|
|
|
<List.Separator />
|
2018-08-31 18:13:30 +00:00
|
|
|
{this.renderBroadcast()}
|
|
|
|
</View>
|
|
|
|
<View style={styles.invitedHeader}>
|
2019-12-04 16:39:53 +00:00
|
|
|
<Text style={[styles.invitedTitle, { color: themes[theme].titleText }]}>{I18n.t('Invite')}</Text>
|
|
|
|
<Text style={[styles.invitedCount, { color: themes[theme].auxiliaryText }]}>{userCount === 1 ? I18n.t('1_user') : I18n.t('N_users', { n: userCount })}</Text>
|
2018-05-24 20:17:45 +00:00
|
|
|
</View>
|
2018-08-31 18:13:30 +00:00
|
|
|
{this.renderInvitedList()}
|
2018-10-23 21:39:48 +00:00
|
|
|
<Loading visible={isFetching} />
|
2018-08-31 18:13:30 +00:00
|
|
|
</ScrollView>
|
|
|
|
</SafeAreaView>
|
2017-09-01 19:42:50 +00:00
|
|
|
</KeyboardView>
|
2017-08-10 16:25:50 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-08-07 13:51:34 +00:00
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
2020-02-11 14:09:14 +00:00
|
|
|
baseUrl: state.server.server,
|
2019-08-07 13:51:34 +00:00
|
|
|
isFetching: state.createChannel.isFetching,
|
2021-01-25 17:14:45 +00:00
|
|
|
encryptionEnabled: state.encryption.enabled,
|
2019-08-07 13:51:34 +00:00
|
|
|
users: state.selectedUsers.users,
|
2020-02-11 14:09:14 +00:00
|
|
|
user: getUserSelector(state)
|
2019-08-07 13:51:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
|
|
create: data => dispatch(createChannelRequestAction(data)),
|
|
|
|
removeUser: user => dispatch(removeUserAction(user))
|
|
|
|
});
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(CreateChannelView));
|