diff --git a/app/reducers/server.js b/app/reducers/server.js index f3934a68d..14c7bbfdf 100644 --- a/app/reducers/server.js +++ b/app/reducers/server.js @@ -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: diff --git a/app/sagas/login.js b/app/sagas/login.js index 516599c3d..aad736990 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -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); } diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index 1252647e6..9e7b38d7d 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -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); diff --git a/app/views/NewServerView/index.js b/app/views/NewServerView/index.js index e2dd6b25f..77fda9c6d 100644 --- a/app/views/NewServerView/index.js +++ b/app/views/NewServerView/index.js @@ -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: () => @@ -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 ( @@ -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 }); diff --git a/app/views/WorkspaceView/index.js b/app/views/WorkspaceView/index.js index b29e07674..dbd1c69e0 100644 --- a/app/views/WorkspaceView/index.js +++ b/app/views/WorkspaceView/index.js @@ -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,