Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions api/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,4 @@ const schema = makeExecutableSchema({
resolvers,
});

if (process.env.REACT_APP_MAINTENANCE_MODE === 'enabled') {
console.error('\n\n⚠️ ----MAINTENANCE MODE ENABLED----⚠️\n\n');
addSchemaLevelResolveFunction(schema, () => {
throw new UserError(
"We're currently undergoing planned maintenance. We'll be back by 3pm UTC, please check https://twitter.com/withspectrum for ongoing updates!"
);
});
}

module.exports = schema;
17 changes: 5 additions & 12 deletions hyperion/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ import './browser-shim';
const Routes = require('../../src/routes').default;
import { initStore } from '../../src/store';

const IN_MAINTENANCE_MODE =
process.env.REACT_APP_MAINTENANCE_MODE === 'enabled';
const IS_PROD = process.env.NODE_ENV === 'production';
const FORCE_DEV = process.env.FORCE_DEV;

if (!IS_PROD || FORCE_DEV) console.log('Querying API at localhost:3001/api');
if (!IS_PROD || FORCE_DEV) debug('Querying API at localhost:3001/api');

const renderer = (req: express$Request, res: express$Response) => {
res.setHeader('Content-Type', 'text/html; charset=utf-8');
Expand Down Expand Up @@ -93,7 +91,7 @@ const renderer = (req: express$Request, res: express$Response) => {
<HelmetProvider context={helmetContext}>
<Provider store={store}>
<StaticRouter location={req.url} context={routerContext}>
<Routes maintenanceMode={IN_MAINTENANCE_MODE} />
<Routes />
</StaticRouter>
</Provider>
</HelmetProvider>
Expand All @@ -111,14 +109,9 @@ const renderer = (req: express$Request, res: express$Response) => {
res.redirect(301, routerContext.url);
return;
}
// maintainance mode
if (IN_MAINTENANCE_MODE) {
debug('maintainance mode enabled, sending 503');
res.status(503);
res.set('Retry-After', '3600');
} else {
res.status(200);
}

res.status(200);

const state = store.getState();
const data = client.extract();
const { helmet } = helmetContext;
Expand Down
1 change: 0 additions & 1 deletion src/components/emailInvitationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { addToastWithTimeout } from '../../actions/toasts';
import Icon from '../icons';
import isEmail from 'validator/lib/isEmail';
import sendCommunityEmailInvitations from 'shared/graphql/mutations/community/sendCommunityEmailInvites';
// import sendChannelEmailInvitations from 'shared/graphql/mutations/community/sendCommunityEmailInvites';
import { Button } from '../buttons';
import { Error } from '../formElements';
import { SectionCardFooter } from '../settingsViews/style';
Expand Down
60 changes: 0 additions & 60 deletions src/components/maintenance/index.js

This file was deleted.

6 changes: 1 addition & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ function render() {
<HelmetProvider>
<ApolloProvider client={client}>
<Router history={history}>
<Routes
maintenanceMode={
process.env.REACT_APP_MAINTENANCE_MODE === 'enabled'
}
/>
<Routes />
</Router>
</ApolloProvider>
</HelmetProvider>
Expand Down
23 changes: 1 addition & 22 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Head from './components/head';
import ModalRoot from './components/modals/modalRoot';
import Gallery from './components/gallery';
import Toasts from './components/toasts';
import Maintenance from './components/maintenance';
import { Loading, LoadingScreen } from './components/loading';
import LoadingDashboard from './views/dashboard/components/dashboardLoading';
import Composer from './components/composer';
Expand Down Expand Up @@ -146,11 +145,7 @@ const ComposerFallback = signedOutFallback(Composer, () => (
<Redirect to="/login" />
));

type Props = {
maintenanceMode?: boolean,
};

class Routes extends React.Component<Props> {
class Routes extends React.Component<{||}> {
componentDidMount() {
const AMPLITUDE_API_KEY =
process.env.NODE_ENV === 'production'
Expand All @@ -171,22 +166,6 @@ class Routes extends React.Component<Props> {
render() {
const { title, description } = generateMetaInfo();

if (this.props.maintenanceMode) {
return (
<ThemeProvider theme={theme}>
<ScrollManager>
<Body>
<Head
title="Ongoing Maintenance - Spectrum"
description="Spectrum is currently undergoing scheduled maintenance downtime. Please check https://twitter.com/withspectrum for ongoing updates."
/>
<Maintenance />
</Body>
</ScrollManager>
</ThemeProvider>
);
}

return (
<ThemeProvider theme={theme}>
<ErrorBoundary fallbackComponent={ErrorFallback}>
Expand Down