tweaky bombeeky

This commit is contained in:
tobi
2024-12-18 11:39:49 +01:00
parent a21f6a9a6b
commit 934f50dc21
10 changed files with 15 additions and 106 deletions

View File

@@ -69,33 +69,6 @@ const fetchServerTranslationLanguagesFail = error => ({
error, error,
}); });
export const fetchExtendedDescription = () => (dispatch, getState) => {
if (getState().getIn(['server', 'extendedDescription', 'isLoading'])) {
return;
}
dispatch(fetchExtendedDescriptionRequest());
api(getState)
.get('/api/v1/instance/extended_description')
.then(({ data }) => dispatch(fetchExtendedDescriptionSuccess(data)))
.catch(err => dispatch(fetchExtendedDescriptionFail(err)));
};
const fetchExtendedDescriptionRequest = () => ({
type: EXTENDED_DESCRIPTION_REQUEST,
});
const fetchExtendedDescriptionSuccess = description => ({
type: EXTENDED_DESCRIPTION_SUCCESS,
description,
});
const fetchExtendedDescriptionFail = error => ({
type: EXTENDED_DESCRIPTION_FAIL,
error,
});
export const fetchDomainBlocks = () => (dispatch, getState) => { export const fetchDomainBlocks = () => (dispatch, getState) => {
if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) { if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) {
return; return;

View File

@@ -10,7 +10,7 @@ import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'flavours/glitch/actions/server'; import { fetchServer, fetchDomainBlocks } from 'flavours/glitch/actions/server';
import Column from 'flavours/glitch/components/column'; import Column from 'flavours/glitch/components/column';
import { Icon } from 'flavours/glitch/components/icon'; import { Icon } from 'flavours/glitch/components/icon';
import { ServerHeroImage } from 'flavours/glitch/components/server_hero_image'; import { ServerHeroImage } from 'flavours/glitch/components/server_hero_image';
@@ -42,7 +42,6 @@ const severityMessages = {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
server: state.getIn(['server', 'server']), server: state.getIn(['server', 'server']),
extendedDescription: state.getIn(['server', 'extendedDescription']),
domainBlocks: state.getIn(['server', 'domainBlocks']), domainBlocks: state.getIn(['server', 'domainBlocks']),
}); });
@@ -89,7 +88,6 @@ class About extends PureComponent {
static propTypes = { static propTypes = {
server: ImmutablePropTypes.map, server: ImmutablePropTypes.map,
extendedDescription: ImmutablePropTypes.map,
domainBlocks: ImmutablePropTypes.contains({ domainBlocks: ImmutablePropTypes.contains({
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
isAvailable: PropTypes.bool, isAvailable: PropTypes.bool,
@@ -103,7 +101,6 @@ class About extends PureComponent {
componentDidMount () { componentDidMount () {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch(fetchServer()); dispatch(fetchServer());
dispatch(fetchExtendedDescription());
} }
handleDomainBlocksOpen = () => { handleDomainBlocksOpen = () => {
@@ -112,7 +109,7 @@ class About extends PureComponent {
}; };
render () { render () {
const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props; const { multiColumn, intl, server, domainBlocks } = this.props;
const isLoading = server.get('isLoading'); const isLoading = server.get('isLoading');
return ( return (
@@ -141,7 +138,7 @@ class About extends PureComponent {
</div> </div>
<Section open title={intl.formatMessage(messages.title)}> <Section open title={intl.formatMessage(messages.title)}>
{extendedDescription.get('isLoading') ? ( {isLoading ? (
<> <>
<Skeleton width='100%' /> <Skeleton width='100%' />
<br /> <br />
@@ -151,10 +148,10 @@ class About extends PureComponent {
<br /> <br />
<Skeleton width='70%' /> <Skeleton width='70%' />
</> </>
) : (extendedDescription.get('content')?.length > 0 ? ( ) : (server.get('description')?.length > 0 ? (
<div <div
className='prose' className='prose'
dangerouslySetInnerHTML={{ __html: extendedDescription.get('content') }} dangerouslySetInnerHTML={{ __html: server.get('description') }}
/> />
) : ( ) : (
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p> <p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>
@@ -207,8 +204,7 @@ class About extends PureComponent {
<LinkFooter /> <LinkFooter />
<div className='about__footer'> <div className='about__footer'>
<p><FormattedMessage id='about.fork_disclaimer' defaultMessage='Glitch-soc is free open source software forked from Mastodon.' /></p> <p><FormattedMessage id='about.fork_disclaimer' defaultMessage='Masto-FE (sloth flavour) is open source software forked from Mastodon via Glitch.' /></p>
<p><FormattedMessage id='about.disclaimer' defaultMessage='Mastodon is free, open-source software, and a trademark of Mastodon gGmbH.' /></p>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,5 @@
{ {
"about.fork_disclaimer": "Glitch-soc is free open source software forked from Mastodon.", "about.fork_disclaimer": "Masto-FE (sloth flavour) is open source software forked from Mastodon via Glitch.",
"account.add_account_note": "Add note for @{name}", "account.add_account_note": "Add note for @{name}",
"account.disclaimer_full": "Information below may reflect the user's profile incompletely.", "account.disclaimer_full": "Information below may reflect the user's profile incompletely.",
"account.follows": "Follows", "account.follows": "Follows",

View File

@@ -1,5 +1,5 @@
{ {
"about.fork_disclaimer": "Glitch-soc is free open source software forked from Mastodon.", "about.fork_disclaimer": "Masto-FE (sloth flavour) is open source software forked from Mastodon via Glitch.",
"account.add_account_note": "Add note for @{name}", "account.add_account_note": "Add note for @{name}",
"account.disclaimer_full": "Information below may reflect the user's profile incompletely.", "account.disclaimer_full": "Information below may reflect the user's profile incompletely.",
"account.follows": "Follows", "account.follows": "Follows",

View File

@@ -1,5 +1,5 @@
{ {
"about.fork_disclaimer": "Glitch-soc is free open source software forked from Mastodon.", "about.fork_disclaimer": "Masto-FE (sloth flavour) is open source software forked from Mastodon via Glitch.",
"account.add_account_note": "Add note for @{name}", "account.add_account_note": "Add note for @{name}",
"account.disclaimer_full": "Information below may reflect the user's profile incompletely.", "account.disclaimer_full": "Information below may reflect the user's profile incompletely.",
"account.follows": "Follows", "account.follows": "Follows",

View File

@@ -1,5 +1,5 @@
{ {
"about.fork_disclaimer": "Glitch-soc is free open source software forked from Mastodon.", "about.fork_disclaimer": "Masto-FE (sloth flavour) is open source software forked from Mastodon via Glitch.",
"account.add_account_note": "Add note for @{name}", "account.add_account_note": "Add note for @{name}",
"account.disclaimer_full": "Information below may reflect the user's profile incompletely.", "account.disclaimer_full": "Information below may reflect the user's profile incompletely.",
"account.follows": "Follows", "account.follows": "Follows",

View File

@@ -7,9 +7,6 @@ import {
SERVER_TRANSLATION_LANGUAGES_FETCH_REQUEST, SERVER_TRANSLATION_LANGUAGES_FETCH_REQUEST,
SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS, SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS,
SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL, SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL,
EXTENDED_DESCRIPTION_REQUEST,
EXTENDED_DESCRIPTION_SUCCESS,
EXTENDED_DESCRIPTION_FAIL,
SERVER_DOMAIN_BLOCKS_FETCH_REQUEST, SERVER_DOMAIN_BLOCKS_FETCH_REQUEST,
SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS, SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS,
SERVER_DOMAIN_BLOCKS_FETCH_FAIL, SERVER_DOMAIN_BLOCKS_FETCH_FAIL,
@@ -20,10 +17,6 @@ const initialState = ImmutableMap({
isLoading: false, isLoading: false,
}), }),
extendedDescription: ImmutableMap({
isLoading: false,
}),
domainBlocks: ImmutableMap({ domainBlocks: ImmutableMap({
isLoading: false, isLoading: false,
isAvailable: true, isAvailable: true,
@@ -45,12 +38,6 @@ export default function server(state = initialState, action) {
return state.setIn(['translationLanguages', 'items'], fromJS(action.translationLanguages)).setIn(['translationLanguages', 'isLoading'], false); return state.setIn(['translationLanguages', 'items'], fromJS(action.translationLanguages)).setIn(['translationLanguages', 'isLoading'], false);
case SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL: case SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL:
return state.setIn(['translationLanguages', 'isLoading'], false); return state.setIn(['translationLanguages', 'isLoading'], false);
case EXTENDED_DESCRIPTION_REQUEST:
return state.setIn(['extendedDescription', 'isLoading'], true);
case EXTENDED_DESCRIPTION_SUCCESS:
return state.set('extendedDescription', fromJS(action.description)).setIn(['extendedDescription', 'isLoading'], false);
case EXTENDED_DESCRIPTION_FAIL:
return state.setIn(['extendedDescription', 'isLoading'], false);
case SERVER_DOMAIN_BLOCKS_FETCH_REQUEST: case SERVER_DOMAIN_BLOCKS_FETCH_REQUEST:
return state.setIn(['domainBlocks', 'isLoading'], true); return state.setIn(['domainBlocks', 'isLoading'], true);
case SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS: case SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS:

View File

@@ -10,10 +10,6 @@ export const SERVER_TRANSLATION_LANGUAGES_FETCH_REQUEST = 'SERVER_TRANSLATION_LA
export const SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS = 'SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS'; export const SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS = 'SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS';
export const SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL = 'SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL'; export const SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL = 'SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL';
export const EXTENDED_DESCRIPTION_REQUEST = 'EXTENDED_DESCRIPTION_REQUEST';
export const EXTENDED_DESCRIPTION_SUCCESS = 'EXTENDED_DESCRIPTION_SUCCESS';
export const EXTENDED_DESCRIPTION_FAIL = 'EXTENDED_DESCRIPTION_FAIL';
export const SERVER_DOMAIN_BLOCKS_FETCH_REQUEST = 'SERVER_DOMAIN_BLOCKS_FETCH_REQUEST'; export const SERVER_DOMAIN_BLOCKS_FETCH_REQUEST = 'SERVER_DOMAIN_BLOCKS_FETCH_REQUEST';
export const SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS = 'SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS'; export const SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS = 'SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS';
export const SERVER_DOMAIN_BLOCKS_FETCH_FAIL = 'SERVER_DOMAIN_BLOCKS_FETCH_FAIL'; export const SERVER_DOMAIN_BLOCKS_FETCH_FAIL = 'SERVER_DOMAIN_BLOCKS_FETCH_FAIL';
@@ -69,33 +65,6 @@ const fetchServerTranslationLanguagesFail = error => ({
error, error,
}); });
export const fetchExtendedDescription = () => (dispatch, getState) => {
if (getState().getIn(['server', 'extendedDescription', 'isLoading'])) {
return;
}
dispatch(fetchExtendedDescriptionRequest());
api(getState)
.get('/api/v1/instance/extended_description')
.then(({ data }) => dispatch(fetchExtendedDescriptionSuccess(data)))
.catch(err => dispatch(fetchExtendedDescriptionFail(err)));
};
const fetchExtendedDescriptionRequest = () => ({
type: EXTENDED_DESCRIPTION_REQUEST,
});
const fetchExtendedDescriptionSuccess = description => ({
type: EXTENDED_DESCRIPTION_SUCCESS,
description,
});
const fetchExtendedDescriptionFail = error => ({
type: EXTENDED_DESCRIPTION_FAIL,
error,
});
export const fetchDomainBlocks = () => (dispatch, getState) => { export const fetchDomainBlocks = () => (dispatch, getState) => {
if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) { if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) {
return; return;

View File

@@ -10,7 +10,7 @@ import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'mastodon/actions/server'; import { fetchServer, fetchDomainBlocks } from 'mastodon/actions/server';
import Column from 'mastodon/components/column'; import Column from 'mastodon/components/column';
import { Icon } from 'mastodon/components/icon'; import { Icon } from 'mastodon/components/icon';
import { ServerHeroImage } from 'mastodon/components/server_hero_image'; import { ServerHeroImage } from 'mastodon/components/server_hero_image';
@@ -42,7 +42,6 @@ const severityMessages = {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
server: state.getIn(['server', 'server']), server: state.getIn(['server', 'server']),
extendedDescription: state.getIn(['server', 'extendedDescription']),
domainBlocks: state.getIn(['server', 'domainBlocks']), domainBlocks: state.getIn(['server', 'domainBlocks']),
}); });
@@ -89,7 +88,6 @@ class About extends PureComponent {
static propTypes = { static propTypes = {
server: ImmutablePropTypes.map, server: ImmutablePropTypes.map,
extendedDescription: ImmutablePropTypes.map,
domainBlocks: ImmutablePropTypes.contains({ domainBlocks: ImmutablePropTypes.contains({
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
isAvailable: PropTypes.bool, isAvailable: PropTypes.bool,
@@ -103,7 +101,6 @@ class About extends PureComponent {
componentDidMount () { componentDidMount () {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch(fetchServer()); dispatch(fetchServer());
dispatch(fetchExtendedDescription());
} }
handleDomainBlocksOpen = () => { handleDomainBlocksOpen = () => {
@@ -112,7 +109,7 @@ class About extends PureComponent {
}; };
render () { render () {
const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props; const { multiColumn, intl, server, domainBlocks } = this.props;
const isLoading = server.get('isLoading'); const isLoading = server.get('isLoading');
return ( return (
@@ -141,7 +138,7 @@ class About extends PureComponent {
</div> </div>
<Section open title={intl.formatMessage(messages.title)}> <Section open title={intl.formatMessage(messages.title)}>
{extendedDescription.get('isLoading') ? ( {isLoading ? (
<> <>
<Skeleton width='100%' /> <Skeleton width='100%' />
<br /> <br />
@@ -151,10 +148,10 @@ class About extends PureComponent {
<br /> <br />
<Skeleton width='70%' /> <Skeleton width='70%' />
</> </>
) : (extendedDescription.get('content')?.length > 0 ? ( ) : (server.get('description')?.length > 0 ? (
<div <div
className='prose' className='prose'
dangerouslySetInnerHTML={{ __html: extendedDescription.get('content') }} dangerouslySetInnerHTML={{ __html: server.get('description') }}
/> />
) : ( ) : (
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p> <p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>

View File

@@ -7,9 +7,6 @@ import {
SERVER_TRANSLATION_LANGUAGES_FETCH_REQUEST, SERVER_TRANSLATION_LANGUAGES_FETCH_REQUEST,
SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS, SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS,
SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL, SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL,
EXTENDED_DESCRIPTION_REQUEST,
EXTENDED_DESCRIPTION_SUCCESS,
EXTENDED_DESCRIPTION_FAIL,
SERVER_DOMAIN_BLOCKS_FETCH_REQUEST, SERVER_DOMAIN_BLOCKS_FETCH_REQUEST,
SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS, SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS,
SERVER_DOMAIN_BLOCKS_FETCH_FAIL, SERVER_DOMAIN_BLOCKS_FETCH_FAIL,
@@ -20,10 +17,6 @@ const initialState = ImmutableMap({
isLoading: false, isLoading: false,
}), }),
extendedDescription: ImmutableMap({
isLoading: false,
}),
domainBlocks: ImmutableMap({ domainBlocks: ImmutableMap({
isLoading: false, isLoading: false,
isAvailable: true, isAvailable: true,
@@ -45,12 +38,6 @@ export default function server(state = initialState, action) {
return state.setIn(['translationLanguages', 'items'], fromJS(action.translationLanguages)).setIn(['translationLanguages', 'isLoading'], false); return state.setIn(['translationLanguages', 'items'], fromJS(action.translationLanguages)).setIn(['translationLanguages', 'isLoading'], false);
case SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL: case SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL:
return state.setIn(['translationLanguages', 'isLoading'], false); return state.setIn(['translationLanguages', 'isLoading'], false);
case EXTENDED_DESCRIPTION_REQUEST:
return state.setIn(['extendedDescription', 'isLoading'], true);
case EXTENDED_DESCRIPTION_SUCCESS:
return state.set('extendedDescription', fromJS(action.description)).setIn(['extendedDescription', 'isLoading'], false);
case EXTENDED_DESCRIPTION_FAIL:
return state.setIn(['extendedDescription', 'isLoading'], false);
case SERVER_DOMAIN_BLOCKS_FETCH_REQUEST: case SERVER_DOMAIN_BLOCKS_FETCH_REQUEST:
return state.setIn(['domainBlocks', 'isLoading'], true); return state.setIn(['domainBlocks', 'isLoading'], true);
case SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS: case SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS: