Fetch frontend_configurations once again, reenable /soapbox/config route

This commit is contained in:
Alex Gleason 2022-03-21 15:13:33 -05:00
parent b4d677dfde
commit 4ccbce71e0
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 15 additions and 17 deletions

View File

@ -5,7 +5,7 @@ import { getHost } from 'soapbox/actions/instance';
import KVStore from 'soapbox/storage/kv_store'; import KVStore from 'soapbox/storage/kv_store';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features';
import { staticClient } from '../api'; import api, { staticClient } from '../api';
export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS'; export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS';
export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL'; export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
@ -88,19 +88,17 @@ export function rememberSoapboxConfig(host) {
} }
export function fetchSoapboxConfig(host) { export function fetchSoapboxConfig(host) {
return fetchSoapboxJson(host); return (dispatch, getState) => {
api(getState).get('/api/pleroma/frontend_configurations').then(response => {
// return (dispatch, getState) => { if (response.data.soapbox_fe) {
// api(getState).get('/api/pleroma/frontend_configurations').then(response => { dispatch(importSoapboxConfig(response.data.soapbox_fe, host));
// if (response.data.soapbox_fe) { } else {
// dispatch(importSoapboxConfig(response.data.soapbox_fe, host)); dispatch(fetchSoapboxJson(host));
// } else { }
// dispatch(fetchSoapboxJson(host)); }).catch(error => {
// } dispatch(fetchSoapboxJson(host));
// }).catch(error => { });
// dispatch(fetchSoapboxJson(host)); };
// });
// };
} }
// Tries to remember the config from browser storage before fetching it // Tries to remember the config from browser storage before fetching it

View File

@ -48,7 +48,7 @@ const Navbar = () => {
> >
{logo ? ( {logo ? (
<Link key='logo' to='/' data-preview-title-id='column.home' className='flex-shrink-0 flex items-center'> <Link key='logo' to='/' data-preview-title-id='column.home' className='flex-shrink-0 flex items-center'>
<img alt='Logo' src={logo} className='h-5 lg:h-6 w-auto lg:min-w-[160px] cursor-pointer' /> <img alt='Logo' src={logo} className='h-5 lg:h-6 w-auto cursor-pointer' />
<span className='hidden'><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></span> <span className='hidden'><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></span>
</Link> </Link>
) : ( ) : (

View File

@ -89,7 +89,7 @@ import {
EditPassword, EditPassword,
EmailConfirmation, EmailConfirmation,
DeleteAccount, DeleteAccount,
// SoapboxConfig, SoapboxConfig,
// ExportData, // ExportData,
// ImportData, // ImportData,
// Backups, // Backups,
@ -330,7 +330,7 @@ class SwitchingColumnsArea extends React.PureComponent {
<WrappedRoute path='/settings/media_display' page={DefaultPage} component={MediaDisplay} content={children} /> <WrappedRoute path='/settings/media_display' page={DefaultPage} component={MediaDisplay} content={children} />
<WrappedRoute path='/settings' page={DefaultPage} component={Settings} content={children} /> <WrappedRoute path='/settings' page={DefaultPage} component={Settings} content={children} />
{/* <WrappedRoute path='/backups' page={DefaultPage} component={Backups} content={children} /> */} {/* <WrappedRoute path='/backups' page={DefaultPage} component={Backups} content={children} /> */}
{/* <WrappedRoute path='/soapbox/config' adminOnly page={DefaultPage} component={SoapboxConfig} content={children} /> */} <WrappedRoute path='/soapbox/config' adminOnly page={DefaultPage} component={SoapboxConfig} content={children} />
{/* {/*
<Redirect from='/admin/dashboard' to='/admin' exact /> <Redirect from='/admin/dashboard' to='/admin' exact />