From c7c774c6318fcc8a13cb7f31e2672eea4ebfc777 Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Wed, 27 Apr 2022 15:07:24 +0100 Subject: Add Ferdi server to hosted services (#49) * 'SettingsNavigation.js' and 'TeamDashboard.js' also have a call to 'LIVE_FERDI_API', but it handles the teams feature that I think neither Ferdi or Ferdium provide. * Removes comment on 'apiBase.ts' because I tested and the Terms was redirecting fine on the 'Help' Menu. --- src/components/auth/ChangeServer.js | 11 +++++---- src/components/auth/Login.js | 20 ++++++++++++++++- .../settings/account/AccountDashboard.js | 26 +++++++++++++++++++++- 3 files changed, 51 insertions(+), 6 deletions(-) (limited to 'src/components') diff --git a/src/components/auth/ChangeServer.js b/src/components/auth/ChangeServer.js index 682f6512c..7e74fe779 100644 --- a/src/components/auth/ChangeServer.js +++ b/src/components/auth/ChangeServer.js @@ -9,7 +9,7 @@ import Button from '../ui/Button'; import Link from '../ui/Link'; import Infobox from '../ui/Infobox'; import { url, required } from '../../helpers/validation-helpers'; -import { LIVE_FERDIUM_API, LIVE_FRANZ_API } from '../../config'; +import { LIVE_FERDIUM_API, LIVE_FRANZ_API, LIVE_FERDI_API } from '../../config'; import globalMessages from '../../i18n/globalMessages'; const messages = defineMessages({ @@ -43,9 +43,11 @@ class ChangeServer extends Component { ferdiumServer = LIVE_FERDIUM_API; + ferdiServer = LIVE_FERDI_API; + franzServer = LIVE_FRANZ_API; - defaultServers = [this.franzServer, this.ferdiumServer]; + defaultServers = [this.ferdiumServer, this.franzServer, this.ferdiServer]; form = new Form( { @@ -54,8 +56,9 @@ class ChangeServer extends Component { label: this.props.intl.formatMessage(messages.label), value: this.props.server, options: [ - { value: this.ferdiumServer, label: 'Ferdium' }, + { value: this.ferdiumServer, label: 'Ferdium (Default)' }, { value: this.franzServer, label: 'Franz' }, + { value: this.ferdiServer, label: 'Ferdi' }, { value: this.defaultServers.includes(this.props.server) ? '' @@ -108,7 +111,7 @@ class ChangeServer extends Component {
this.submit(e)}>

{intl.formatMessage(messages.headline)}

- {form.$('server').value === this.franzServer && ( + {(form.$('server').value === this.franzServer || form.$('server').value === this.ferdiServer) && ( {intl.formatMessage(messages.warning)} diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index 3c9c07f0d..ccffd0c6a 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { observer, inject } from 'mobx-react'; import { defineMessages, injectIntl } from 'react-intl'; -import { LIVE_FRANZ_API } from '../../config'; +import { LIVE_FRANZ_API, LIVE_FERDI_API } from '../../config'; import { API_VERSION } from '../../environment-remote'; import Form from '../../lib/Form'; import { required, email } from '../../helpers/validation-helpers'; @@ -153,6 +153,24 @@ class Login extends Component {

)} + {window['ferdium'].stores.settings.all.app.server !== + LIVE_FERDI_API && ( +

+ {intl.formatMessage(messages.customServerQuestion)}{' '} + + {intl.formatMessage(messages.customServerSuggestion)} + +

+ )} )} {isSubmitting ? ( diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js index b500b82cf..78d41a273 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.js @@ -8,7 +8,7 @@ import { H1, H2 } from '../../ui/headline'; import Loader from '../../ui/Loader'; import Button from '../../ui/Button'; import Infobox from '../../ui/Infobox'; -import { LOCAL_SERVER, LIVE_FRANZ_API } from '../../../config'; +import { LOCAL_SERVER, LIVE_FRANZ_API, LIVE_FERDI_API } from '../../../config'; const messages = defineMessages({ headline: { @@ -95,6 +95,7 @@ class AccountDashboard extends Component { const isUsingWithoutAccount = server === LOCAL_SERVER; const isUsingFranzServer = server === LIVE_FRANZ_API; + const isUsingFerdiServer = server === LIVE_FERDI_API; return (
@@ -210,6 +211,29 @@ class AccountDashboard extends Component {
)} + {isUsingFerdiServer && ( +
+
+

+ {intl.formatMessage(messages.headlineDangerZone)} +

+ {!isDeleteAccountSuccessful && ( +
+

{intl.formatMessage(messages.deleteInfo)}

+
+ )} + {isDeleteAccountSuccessful && ( +

{intl.formatMessage(messages.deleteEmailSent)}

+ )} +
+
+ )} )} -- cgit v1.2.3-54-g00ecf