Skip to content

Commit

Permalink
Merge pull request glitch-soc#2411 from ClearlyClaire/glitch-soc/merg…
Browse files Browse the repository at this point in the history
…e-upstream

Merge upstream changes up to 9688c5f
  • Loading branch information
ClearlyClaire authored Sep 19, 2023
2 parents 743fede + 31dedf4 commit 7ea5a2c
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 166 deletions.
2 changes: 1 addition & 1 deletion app/helpers/authorized_fetch_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module AuthorizedFetchHelper
def authorized_fetch_mode?
ENV.fetch('AUTHORIZED_FETCH') { Setting.authorized_fetch } == 'true' || Rails.configuration.x.limited_federation_mode
ENV.fetch('AUTHORIZED_FETCH') { Setting.authorized_fetch && 'true' } == 'true' || Rails.configuration.x.limited_federation_mode
end

def authorized_fetch_overridden?
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/flavours/glitch/features/about/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { Helmet } from 'react-helmet';

import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';

Expand Down Expand Up @@ -161,7 +162,7 @@ class About extends PureComponent {
</Section>

<Section title={intl.formatMessage(messages.rules)}>
{!isLoading && (server.get('rules', []).isEmpty() ? (
{!isLoading && (server.get('rules', ImmutableList()).isEmpty() ? (
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>
) : (
<ol className='rules-list'>
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/flavours/glitch/reducers/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
SEARCH_SHOW,
SEARCH_EXPAND_REQUEST,
SEARCH_EXPAND_SUCCESS,
SEARCH_EXPAND_FAIL,
SEARCH_HISTORY_UPDATE,
} from 'flavours/glitch/actions/search';

Expand Down Expand Up @@ -54,6 +55,7 @@ export default function search(state = initialState, action) {
map.set('type', action.searchType);
});
case SEARCH_FETCH_FAIL:
case SEARCH_EXPAND_FAIL:
return state.set('isLoading', false);
case SEARCH_FETCH_SUCCESS:
return state.withMutations(map => {
Expand All @@ -68,10 +70,10 @@ export default function search(state = initialState, action) {
map.set('isLoading', false);
});
case SEARCH_EXPAND_REQUEST:
return state.set('type', action.searchType);
return state.set('type', action.searchType).set('isLoading', true);
case SEARCH_EXPAND_SUCCESS:
const results = action.searchType === 'hashtags' ? ImmutableOrderedSet(fromJS(action.results.hashtags)) : action.results[action.searchType].map(item => item.id);
return state.updateIn(['results', action.searchType], list => list.union(results));
return state.updateIn(['results', action.searchType], list => list.union(results)).set('isLoading', false);
case SEARCH_HISTORY_UPDATE:
return state.set('recent', ImmutableOrderedSet(fromJS(action.recent)));
default:
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/mastodon/features/about/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { Helmet } from 'react-helmet';

import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';

Expand Down Expand Up @@ -161,7 +162,7 @@ class About extends PureComponent {
</Section>

<Section title={intl.formatMessage(messages.rules)}>
{!isLoading && (server.get('rules', []).isEmpty() ? (
{!isLoading && (server.get('rules', ImmutableList()).isEmpty() ? (
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>
) : (
<ol className='rules-list'>
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/mastodon/reducers/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
SEARCH_SHOW,
SEARCH_EXPAND_REQUEST,
SEARCH_EXPAND_SUCCESS,
SEARCH_EXPAND_FAIL,
SEARCH_HISTORY_UPDATE,
} from '../actions/search';

Expand Down Expand Up @@ -54,6 +55,7 @@ export default function search(state = initialState, action) {
map.set('type', action.searchType);
});
case SEARCH_FETCH_FAIL:
case SEARCH_EXPAND_FAIL:
return state.set('isLoading', false);
case SEARCH_FETCH_SUCCESS:
return state.withMutations(map => {
Expand All @@ -68,10 +70,10 @@ export default function search(state = initialState, action) {
map.set('isLoading', false);
});
case SEARCH_EXPAND_REQUEST:
return state.set('type', action.searchType);
return state.set('type', action.searchType).set('isLoading', true);
case SEARCH_EXPAND_SUCCESS:
const results = action.searchType === 'hashtags' ? ImmutableOrderedSet(fromJS(action.results.hashtags)) : action.results[action.searchType].map(item => item.id);
return state.updateIn(['results', action.searchType], list => list.union(results));
return state.updateIn(['results', action.searchType], list => list.union(results)).set('isLoading', false);
case SEARCH_HISTORY_UPDATE:
return state.set('recent', ImmutableOrderedSet(fromJS(action.recent)));
default:
Expand Down
Loading

0 comments on commit 7ea5a2c

Please sign in to comment.