Merge branch 'move-to-frontend_configurations-endpoint' into 'rebase/glitch-soc'

Move to `/api/pleroma/frontend_configurations` endpoint

See merge request pleroma/mastofe!22
This commit is contained in:
Haelwenn 2019-03-06 01:27:29 +00:00
commit 201f8d89be
5 changed files with 8 additions and 69 deletions

View file

@ -161,18 +161,7 @@ export default class GettingStarted extends ImmutablePureComponent {
</div>,
]);
const dot = ' • ';
const staticContent = (customPanelEnabled ? <div dangerouslySetInnerHTML={{__html: customPanel}} style={{marginLeft: -12, marginRight: -12}} /> :
<p>
<a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.faq' defaultMessage='FAQ' /></a>
{dot}
<a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/User-guide.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.userguide' defaultMessage='User Guide' /></a>
{dot}
<a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.appsshort' defaultMessage='Apps' /></a>
{dot}
<a href='https://pleroma.social'><FormattedMessage id='getting_started.pleroma' defaultMessage='Pleroma' /></a>
</p>
);
const instance_panel = (customPanelEnabled ? <div className='getting-started getting-started__panel scrollable' dangerouslySetInnerHTML={{__html: customPanel}} /> : null);
return (
<Column name='getting-started' icon='asterisk' heading={intl.formatMessage(messages.heading)} label={intl.formatMessage(messages.menu)} hideHeadingOnMobile>
@ -187,9 +176,7 @@ export default class GettingStarted extends ImmutablePureComponent {
<ColumnLink icon='sign-out' text={intl.formatMessage(messages.sign_out)} href={signOutLink} method='delete' />
</div>
<div className='getting-started getting-started__panel scrollable'>
{staticContent}
</div>
{instance_panel}
<div className='getting-started__footer scrollable'>
<p>

View file

@ -11,7 +11,7 @@ export default function custom_panel(state = initialPanel, action) {
case PANEL_FETCH_SUCCESS:
return state.set('panel', action.panel); break;
case PLEROMA_CONFIG_FETCH_SUCCESS:
return state.set('enabled', (action.config || {}).site.pleromafe.showInstanceSpecificPanel || false);
return state.set('enabled', (action.config || {}).showInstanceSpecificPanel);
}
return state;

View file

@ -1,8 +1,5 @@
import api from '../api';
export const TOS_FETCH_REQUEST = 'TOS_FETCH_REQUEST';
export const TOS_FETCH_SUCCESS = 'TOS_FETCH_SUCCESS';
export const TOS_FETCH_FAIL = 'TOS_FETCH_FAIL';
export const FLAVOUR_SWITCH_REQUEST = 'FLAVOUR_SWITCH_REQUEST';
export const FLAVOUR_SWITCH_SUCCESS = 'FLAVOUR_SWITCH_SUCCESS';
export const FLAVOUR_SWITCH_FAIL = 'FLAVOUR_SWITCH_FAIL';
@ -29,18 +26,6 @@ export function switchFlavour(flavour) {
};
};
export function fetchTOS() {
return (dispatch, getState) => {
dispatch(fetchTOSRequest());
api(getState).get('/static/terms-of-service.html').then(response => {
dispatch(fetchTOSSuccess(response.data));
}).catch(error => {
dispatch(fetchTOSFail(error));
});
};
};
export function fetchPanel() {
return (dispatch, getState) => {
dispatch(fetchPanelRequest());
@ -57,34 +42,14 @@ export function fetchPleromaConfig() {
return (dispatch, getState) => {
dispatch(fetchPleromaConfigRequest());
api(getState).get('/api/statusnet/config.json').then(response => {
dispatch(fetchPleromaConfigSuccess(response.data));
api(getState).get('/api/pleroma/frontend_configurations').then(response => {
dispatch(fetchPleromaConfigSuccess(response.data.masto_fe));
}).catch(error => {
dispatch(fetchPleromaConfigFail(error));
});
};
};
export function fetchTOSRequest() {
return {
type: TOS_FETCH_REQUEST,
};
};
export function fetchTOSSuccess(tos) {
return {
type: TOS_FETCH_SUCCESS,
tos,
};
};
export function fetchTOSFail(error) {
return {
type: TOS_FETCH_FAIL,
error,
};
};
export function switchFlavourRequest() {
return {
type: FLAVOUR_SWITCH_REQUEST,

View file

@ -156,18 +156,7 @@ class GettingStarted extends ImmutablePureComponent {
height += 34 + 48;
}
const dot = ' • ';
const staticContent = (customPanelEnabled ? <div dangerouslySetInnerHTML={{ __html: customPanel }} style={{ marginLeft: -12, marginRight: -12 }} /> : (
<p>
<a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.faq' defaultMessage='FAQ' /></a>
{dot}
<a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/User-guide.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.userguide' defaultMessage='User Guide' /></a>
{dot}
<a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.appsshort' defaultMessage='Apps' /></a>
{dot}
<a href='https://pleroma.social'><FormattedMessage id='getting_started.pleroma' defaultMessage='Pleroma' /></a>
</p> )
);
const instance_panel = (customPanelEnabled ? <div className='getting-started getting-started__panel scrollable' dangerouslySetInnerHTML={{__html: customPanel}} /> : null);
return (
<Column label={intl.formatMessage(messages.menu)}>
@ -188,9 +177,7 @@ class GettingStarted extends ImmutablePureComponent {
{!multiColumn && <div className='flex-spacer' />}
<div className='getting-started getting-started__panel scrollable'>
{staticContent}
</div>
{instance_panel}
{!multiColumn && <div className='flex-spacer' />}

View file

@ -11,7 +11,7 @@ export function custom_panel(state = initialPanel, action) {
case PANEL_FETCH_SUCCESS:
return state.set('panel', action.panel); break;
case PLEROMA_CONFIG_FETCH_SUCCESS:
return state.set('enabled', (action.config || {}).site.pleromafe.showInstanceSpecificPanel || false);
return state.set('enabled', (action.config || {}).showInstanceSpecificPanel || false);
}
return state;