From 934f50dc210a70a1ebfebc8049d5f5eba39d8177 Mon Sep 17 00:00:00 2001 From: tobi Date: Wed, 18 Dec 2024 11:39:49 +0100 Subject: [PATCH] tweaky bombeeky --- .../flavours/glitch/actions/server.js | 27 ---------------- .../flavours/glitch/features/about/index.jsx | 16 ++++------ .../flavours/glitch/locales/en.json | 2 +- .../flavours/glitch/locales/szl.json | 2 +- .../flavours/glitch/locales/tai.json | 2 +- .../flavours/glitch/locales/zgh.json | 2 +- .../flavours/glitch/reducers/server.js | 13 -------- app/javascript/mastodon/actions/server.js | 31 ------------------- .../mastodon/features/about/index.jsx | 13 +++----- app/javascript/mastodon/reducers/server.js | 13 -------- 10 files changed, 15 insertions(+), 106 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/server.js b/app/javascript/flavours/glitch/actions/server.js index 65f3efc3a72a3dba3dfeb5dbbb6f1b8c0deee561..5648064117b7e8b4069d68b6de048f300103934c 100644 --- a/app/javascript/flavours/glitch/actions/server.js +++ b/app/javascript/flavours/glitch/actions/server.js @@ -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; diff --git a/app/javascript/flavours/glitch/features/about/index.jsx b/app/javascript/flavours/glitch/features/about/index.jsx index ec243709255a772d48757d6acd70f04bd35e952d..539af46b5c77d7441bfd7b18af76b549ecb01925 100644 --- a/app/javascript/flavours/glitch/features/about/index.jsx +++ b/app/javascript/flavours/glitch/features/about/index.jsx @@ -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 {
- {extendedDescription.get('isLoading') ? ( + {isLoading ? ( <>
@@ -151,10 +148,10 @@ class About extends PureComponent {
- ) : (extendedDescription.get('content')?.length > 0 ? ( + ) : (server.get('description')?.length > 0 ? (
) : (

@@ -207,8 +204,7 @@ class About extends PureComponent {
-

-

+

diff --git a/app/javascript/flavours/glitch/locales/en.json b/app/javascript/flavours/glitch/locales/en.json index 3c2ee218b2eb469ed4de1d713d8424204d6b266f..e5c74967731f6d9cff30691576b014bd115d1475 100644 --- a/app/javascript/flavours/glitch/locales/en.json +++ b/app/javascript/flavours/glitch/locales/en.json @@ -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", diff --git a/app/javascript/flavours/glitch/locales/szl.json b/app/javascript/flavours/glitch/locales/szl.json index bc033e492810009eb9c0abd51ae4e43273c46ff8..422ce458816551205cf396e4af380f95cc398aa6 100644 --- a/app/javascript/flavours/glitch/locales/szl.json +++ b/app/javascript/flavours/glitch/locales/szl.json @@ -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", diff --git a/app/javascript/flavours/glitch/locales/tai.json b/app/javascript/flavours/glitch/locales/tai.json index bc033e492810009eb9c0abd51ae4e43273c46ff8..422ce458816551205cf396e4af380f95cc398aa6 100644 --- a/app/javascript/flavours/glitch/locales/tai.json +++ b/app/javascript/flavours/glitch/locales/tai.json @@ -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", diff --git a/app/javascript/flavours/glitch/locales/zgh.json b/app/javascript/flavours/glitch/locales/zgh.json index bc033e492810009eb9c0abd51ae4e43273c46ff8..422ce458816551205cf396e4af380f95cc398aa6 100644 --- a/app/javascript/flavours/glitch/locales/zgh.json +++ b/app/javascript/flavours/glitch/locales/zgh.json @@ -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", diff --git a/app/javascript/flavours/glitch/reducers/server.js b/app/javascript/flavours/glitch/reducers/server.js index e39e2ba48b8054144e27a72472fd53670282903e..e295c6b4754dcdb482d74892810c39d590b375c2 100644 --- a/app/javascript/flavours/glitch/reducers/server.js +++ b/app/javascript/flavours/glitch/reducers/server.js @@ -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: diff --git a/app/javascript/mastodon/actions/server.js b/app/javascript/mastodon/actions/server.js index 65f3efc3a72a3dba3dfeb5dbbb6f1b8c0deee561..b917ca4c72fb00be2bb06a1b6001d2f308f1341d 100644 --- a/app/javascript/mastodon/actions/server.js +++ b/app/javascript/mastodon/actions/server.js @@ -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; diff --git a/app/javascript/mastodon/features/about/index.jsx b/app/javascript/mastodon/features/about/index.jsx index 8837c5a9917f4a85bbb475d6d2a6e81753c586fe..df6e151a58f15f37405b0b901400b3979eede8cf 100644 --- a/app/javascript/mastodon/features/about/index.jsx +++ b/app/javascript/mastodon/features/about/index.jsx @@ -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 {
- {extendedDescription.get('isLoading') ? ( + {isLoading ? ( <>
@@ -151,10 +148,10 @@ class About extends PureComponent {
- ) : (extendedDescription.get('content')?.length > 0 ? ( + ) : (server.get('description')?.length > 0 ? (
) : (

diff --git a/app/javascript/mastodon/reducers/server.js b/app/javascript/mastodon/reducers/server.js index 2bbf0f9a308def935ea09228c993a6bb9abd0a2b..5c5f561ccdf203641d95810a89e4ee1a708f69d2 100644 --- a/app/javascript/mastodon/reducers/server.js +++ b/app/javascript/mastodon/reducers/server.js @@ -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: