Remove server.adding
This commit is contained in:
parent
64f4cc3cf1
commit
943e179e18
|
@ -7,7 +7,6 @@ const initialState = {
|
|||
server: '',
|
||||
version: null,
|
||||
loading: true,
|
||||
adding: false,
|
||||
previousServer: null,
|
||||
changingServer: false
|
||||
};
|
||||
|
@ -58,13 +57,11 @@ export default function server(state = initialState, action) {
|
|||
case SERVER.INIT_ADD:
|
||||
return {
|
||||
...state,
|
||||
adding: true,
|
||||
previousServer: action.previousServer
|
||||
};
|
||||
case SERVER.FINISH_ADD:
|
||||
return {
|
||||
...state,
|
||||
adding: false,
|
||||
previousServer: null
|
||||
};
|
||||
default:
|
||||
|
|
|
@ -118,7 +118,7 @@ const fetchRooms = function* fetchRooms() {
|
|||
|
||||
const handleLoginSuccess = function* handleLoginSuccess({ user }) {
|
||||
try {
|
||||
const adding = yield select(state => state.server.adding);
|
||||
// const adding = yield select(state => state.server.adding);
|
||||
|
||||
RocketChat.getUserPresence(user.id);
|
||||
|
||||
|
@ -170,25 +170,26 @@ const handleLoginSuccess = function* handleLoginSuccess({ user }) {
|
|||
yield put(setUser(user));
|
||||
EventEmitter.emit('connected');
|
||||
|
||||
let currentRoot;
|
||||
if (adding) {
|
||||
yield put(serverFinishAdd());
|
||||
yield put(appStart({ root: ROOT_INSIDE }));
|
||||
} else {
|
||||
currentRoot = yield select(state => state.app.root);
|
||||
if (currentRoot !== ROOT_INSIDE) {
|
||||
yield put(appStart({ root: ROOT_INSIDE }));
|
||||
}
|
||||
}
|
||||
// let currentRoot;
|
||||
// const currentRoot = yield select(state => state.app.root);
|
||||
// if (adding) {
|
||||
// yield put(serverFinishAdd());
|
||||
// yield put(appStart({ root: ROOT_INSIDE }));
|
||||
// } else {
|
||||
// currentRoot = yield select(state => state.app.root);
|
||||
// if (currentRoot !== ROOT_INSIDE) {
|
||||
yield put(appStart({ root: ROOT_INSIDE }));
|
||||
// }
|
||||
// }
|
||||
|
||||
// after a successful login, check if it's been invited via invite link
|
||||
currentRoot = yield select(state => state.app.root);
|
||||
if (currentRoot === ROOT_INSIDE) {
|
||||
const inviteLinkToken = yield select(state => state.inviteLinks.token);
|
||||
if (inviteLinkToken) {
|
||||
yield put(inviteLinksRequest(inviteLinkToken));
|
||||
}
|
||||
// currentRoot = yield select(state => state.app.root);
|
||||
// if (currentRoot === ROOT_INSIDE) {
|
||||
const inviteLinkToken = yield select(state => state.inviteLinks.token);
|
||||
if (inviteLinkToken) {
|
||||
yield put(inviteLinksRequest(inviteLinkToken));
|
||||
}
|
||||
// }
|
||||
} catch (e) {
|
||||
log(e);
|
||||
}
|
||||
|
|
|
@ -137,11 +137,11 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
|
|||
logServerVersion(serverVersion);
|
||||
yield put(selectServerSuccess(server, serverVersion));
|
||||
|
||||
// if the adding state is true, finish add server
|
||||
const adding = yield select(state => state.server.adding);
|
||||
if (adding) {
|
||||
yield put(serverFinishAdd());
|
||||
}
|
||||
// // if the adding state is true, finish add server
|
||||
// const adding = yield select(state => state.server.adding);
|
||||
// if (adding) {
|
||||
// yield put(serverFinishAdd());
|
||||
// }
|
||||
} catch (e) {
|
||||
yield put(selectServerFailure());
|
||||
log(e);
|
||||
|
|
|
@ -74,7 +74,7 @@ class NewServerView extends React.Component {
|
|||
connecting: PropTypes.bool.isRequired,
|
||||
connectServer: PropTypes.func.isRequired,
|
||||
selectServer: PropTypes.func.isRequired,
|
||||
adding: PropTypes.bool,
|
||||
// adding: PropTypes.bool,
|
||||
previousServer: PropTypes.string,
|
||||
inviteLinksClear: PropTypes.func
|
||||
};
|
||||
|
@ -100,12 +100,12 @@ class NewServerView extends React.Component {
|
|||
this.queryServerHistory();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { adding } = this.props;
|
||||
if (prevProps.adding !== adding) {
|
||||
this.setHeader();
|
||||
}
|
||||
}
|
||||
// componentDidUpdate(prevProps) {
|
||||
// const { adding } = this.props;
|
||||
// if (prevProps.adding !== adding) {
|
||||
// this.setHeader();
|
||||
// }
|
||||
// }
|
||||
|
||||
componentWillUnmount() {
|
||||
EventEmitter.removeListener('NewServer', this.handleNewServerEvent);
|
||||
|
@ -113,8 +113,8 @@ class NewServerView extends React.Component {
|
|||
}
|
||||
|
||||
setHeader = () => {
|
||||
const { adding, navigation } = this.props;
|
||||
if (adding) {
|
||||
const { previousServer, navigation } = this.props;
|
||||
if (previousServer) {
|
||||
return navigation.setOptions({
|
||||
headerTitle: I18n.t('Workspaces'),
|
||||
headerLeft: () => <HeaderButton.CloseModal navigation={navigation} onPress={this.close} testID='new-server-view-close' />
|
||||
|
@ -314,9 +314,9 @@ class NewServerView extends React.Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { connecting, theme, adding, width, height } = this.props;
|
||||
const { connecting, theme, previousServer, width, height } = this.props;
|
||||
const { text, connectingOpen, serversHistory } = this.state;
|
||||
const marginTopHeader = adding ? 25 : 70;
|
||||
const marginTopHeader = previousServer ? 0 : 70;
|
||||
|
||||
return (
|
||||
<FormContainer theme={theme} testID='new-server-view' keyboardShouldPersistTaps='never'>
|
||||
|
@ -402,7 +402,7 @@ class NewServerView extends React.Component {
|
|||
|
||||
const mapStateToProps = state => ({
|
||||
connecting: state.server.connecting,
|
||||
adding: state.server.adding,
|
||||
// adding: state.server.adding,
|
||||
previousServer: state.server.previousServer
|
||||
});
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ class WorkspaceView extends React.Component {
|
|||
|
||||
const mapStateToProps = state => ({
|
||||
server: state.server.server,
|
||||
adding: state.server.adding,
|
||||
Site_Name: state.settings.Site_Name,
|
||||
Site_Url: state.settings.Site_Url,
|
||||
Assets_favicon_512: state.settings.Assets_favicon_512,
|
||||
|
|
Loading…
Reference in New Issue