~cytrogen/masto-fe

934f50dc210a70a1ebfebc8049d5f5eba39d8177 — tobi 1 year, 4 months ago a21f6a9
tweaky bombeeky
M app/javascript/flavours/glitch/actions/server.js => app/javascript/flavours/glitch/actions/server.js +0 -27
@@ 69,33 69,6 @@ const fetchServerTranslationLanguagesFail = 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) => {
  if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) {
    return;

M app/javascript/flavours/glitch/features/about/index.jsx => app/javascript/flavours/glitch/features/about/index.jsx +6 -10
@@ 10,7 10,7 @@ import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
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 { Icon } from 'flavours/glitch/components/icon';
import { ServerHeroImage } from 'flavours/glitch/components/server_hero_image';


@@ 42,7 42,6 @@ const severityMessages = {

const mapStateToProps = state => ({
  server: state.getIn(['server', 'server']),
  extendedDescription: state.getIn(['server', 'extendedDescription']),
  domainBlocks: state.getIn(['server', 'domainBlocks']),
});



@@ 89,7 88,6 @@ class About extends PureComponent {

  static propTypes = {
    server: ImmutablePropTypes.map,
    extendedDescription: ImmutablePropTypes.map,
    domainBlocks: ImmutablePropTypes.contains({
      isLoading: PropTypes.bool,
      isAvailable: PropTypes.bool,


@@ 103,7 101,6 @@ class About extends PureComponent {
  componentDidMount () {
    const { dispatch } = this.props;
    dispatch(fetchServer());
    dispatch(fetchExtendedDescription());
  }

  handleDomainBlocksOpen = () => {


@@ 112,7 109,7 @@ class About extends PureComponent {
  };

  render () {
    const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
    const { multiColumn, intl, server, domainBlocks } = this.props;
    const isLoading = server.get('isLoading');

    return (


@@ 141,7 138,7 @@ class About extends PureComponent {
          </div>

          <Section open title={intl.formatMessage(messages.title)}>
            {extendedDescription.get('isLoading') ? (
            {isLoading ? (
              <>
                <Skeleton width='100%' />
                <br />


@@ 151,10 148,10 @@ class About extends PureComponent {
                <br />
                <Skeleton width='70%' />
              </>
            ) : (extendedDescription.get('content')?.length > 0 ? (
            ) : (server.get('description')?.length > 0 ? (
              <div
                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>


@@ 207,8 204,7 @@ class About extends PureComponent {
          <LinkFooter />

          <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.disclaimer' defaultMessage='Mastodon is free, open-source software, and a trademark of Mastodon gGmbH.' /></p>
            <p><FormattedMessage id='about.fork_disclaimer' defaultMessage='Masto-FE (sloth flavour) is open source software forked from Mastodon via Glitch.' /></p>
          </div>
        </div>


M app/javascript/flavours/glitch/locales/en.json => app/javascript/flavours/glitch/locales/en.json +1 -1
@@ 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.disclaimer_full": "Information below may reflect the user's profile incompletely.",
  "account.follows": "Follows",

M app/javascript/flavours/glitch/locales/szl.json => app/javascript/flavours/glitch/locales/szl.json +1 -1
@@ 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.disclaimer_full": "Information below may reflect the user's profile incompletely.",
  "account.follows": "Follows",

M app/javascript/flavours/glitch/locales/tai.json => app/javascript/flavours/glitch/locales/tai.json +1 -1
@@ 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.disclaimer_full": "Information below may reflect the user's profile incompletely.",
  "account.follows": "Follows",

M app/javascript/flavours/glitch/locales/zgh.json => app/javascript/flavours/glitch/locales/zgh.json +1 -1
@@ 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.disclaimer_full": "Information below may reflect the user's profile incompletely.",
  "account.follows": "Follows",

M app/javascript/flavours/glitch/reducers/server.js => app/javascript/flavours/glitch/reducers/server.js +0 -13
@@ 7,9 7,6 @@ import {
  SERVER_TRANSLATION_LANGUAGES_FETCH_REQUEST,
  SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS,
  SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL,
  EXTENDED_DESCRIPTION_REQUEST,
  EXTENDED_DESCRIPTION_SUCCESS,
  EXTENDED_DESCRIPTION_FAIL,
  SERVER_DOMAIN_BLOCKS_FETCH_REQUEST,
  SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS,
  SERVER_DOMAIN_BLOCKS_FETCH_FAIL,


@@ 20,10 17,6 @@ const initialState = ImmutableMap({
    isLoading: false,
  }),

  extendedDescription: ImmutableMap({
    isLoading: false,
  }),

  domainBlocks: ImmutableMap({
    isLoading: false,
    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);
  case SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL:
    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:
    return state.setIn(['domainBlocks', 'isLoading'], true);
  case SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS:

M app/javascript/mastodon/actions/server.js => app/javascript/mastodon/actions/server.js +0 -31
@@ 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_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_SUCCESS = 'SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS';
export const SERVER_DOMAIN_BLOCKS_FETCH_FAIL    = 'SERVER_DOMAIN_BLOCKS_FETCH_FAIL';


@@ 69,33 65,6 @@ const fetchServerTranslationLanguagesFail = 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) => {
  if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) {
    return;

M app/javascript/mastodon/features/about/index.jsx => app/javascript/mastodon/features/about/index.jsx +5 -8
@@ 10,7 10,7 @@ import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
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 { Icon  }  from 'mastodon/components/icon';
import { ServerHeroImage } from 'mastodon/components/server_hero_image';


@@ 42,7 42,6 @@ const severityMessages = {

const mapStateToProps = state => ({
  server: state.getIn(['server', 'server']),
  extendedDescription: state.getIn(['server', 'extendedDescription']),
  domainBlocks: state.getIn(['server', 'domainBlocks']),
});



@@ 89,7 88,6 @@ class About extends PureComponent {

  static propTypes = {
    server: ImmutablePropTypes.map,
    extendedDescription: ImmutablePropTypes.map,
    domainBlocks: ImmutablePropTypes.contains({
      isLoading: PropTypes.bool,
      isAvailable: PropTypes.bool,


@@ 103,7 101,6 @@ class About extends PureComponent {
  componentDidMount () {
    const { dispatch } = this.props;
    dispatch(fetchServer());
    dispatch(fetchExtendedDescription());
  }

  handleDomainBlocksOpen = () => {


@@ 112,7 109,7 @@ class About extends PureComponent {
  };

  render () {
    const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
    const { multiColumn, intl, server, domainBlocks } = this.props;
    const isLoading = server.get('isLoading');

    return (


@@ 141,7 138,7 @@ class About extends PureComponent {
          </div>

          <Section open title={intl.formatMessage(messages.title)}>
            {extendedDescription.get('isLoading') ? (
            {isLoading ? (
              <>
                <Skeleton width='100%' />
                <br />


@@ 151,10 148,10 @@ class About extends PureComponent {
                <br />
                <Skeleton width='70%' />
              </>
            ) : (extendedDescription.get('content')?.length > 0 ? (
            ) : (server.get('description')?.length > 0 ? (
              <div
                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>

M app/javascript/mastodon/reducers/server.js => app/javascript/mastodon/reducers/server.js +0 -13
@@ 7,9 7,6 @@ import {
  SERVER_TRANSLATION_LANGUAGES_FETCH_REQUEST,
  SERVER_TRANSLATION_LANGUAGES_FETCH_SUCCESS,
  SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL,
  EXTENDED_DESCRIPTION_REQUEST,
  EXTENDED_DESCRIPTION_SUCCESS,
  EXTENDED_DESCRIPTION_FAIL,
  SERVER_DOMAIN_BLOCKS_FETCH_REQUEST,
  SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS,
  SERVER_DOMAIN_BLOCKS_FETCH_FAIL,


@@ 20,10 17,6 @@ const initialState = ImmutableMap({
    isLoading: false,
  }),

  extendedDescription: ImmutableMap({
    isLoading: false,
  }),

  domainBlocks: ImmutableMap({
    isLoading: false,
    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);
  case SERVER_TRANSLATION_LANGUAGES_FETCH_FAIL:
    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:
    return state.setIn(['domainBlocks', 'isLoading'], true);
  case SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS: