Merge commit 'b878e3d8df' into kb_migration_development

This commit is contained in:
KMY 2023-05-10 17:58:14 +09:00
commit f3867c10de
30 changed files with 51 additions and 40 deletions

View file

@ -104,7 +104,6 @@ module.exports = {
'react/jsx-equals-spacing': 'error',
'react/jsx-no-bind': 'error',
'react/jsx-no-target-blank': 'off',
'react/no-deprecated': 'off',
'react/no-unknown-property': 'off',
'react/self-closing-comp': 'error',

View file

@ -154,7 +154,7 @@ export default class AutosuggestInput extends ImmutablePureComponent {
this.input.focus();
};
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.suggestions !== this.props.suggestions && nextProps.suggestions.size > 0 && this.state.suggestionsHidden && this.state.focused) {
this.setState({ suggestionsHidden: false });
}

View file

@ -153,7 +153,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
this.textarea.focus();
};
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.suggestions !== this.props.suggestions && nextProps.suggestions.size > 0 && this.state.suggestionsHidden && this.state.focused) {
this.setState({ suggestionsHidden: false });
}

View file

@ -1,15 +1,13 @@
import React from 'react';
import logo from 'mastodon/../images/logo.svg';
export const WordmarkLogo = () => (
export const WordmarkLogo: React.FC = () => (
<svg viewBox='0 0 261 66' className='logo logo--wordmark' role='img'>
<title>Mastodon</title>
<use xlinkHref='#logo-symbol-wordmark' />
</svg>
);
export const SymbolLogo = () => (
export const SymbolLogo: React.FC = () => (
<img src={logo} alt='Mastodon' className='logo logo--icon' />
);
export default WordmarkLogo;

View file

@ -241,7 +241,7 @@ class MediaGallery extends React.PureComponent {
window.removeEventListener('resize', this.handleResize);
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!is(nextProps.media, this.props.media) && nextProps.visible === undefined) {
this.setState({ visible: displayMedia !== 'hide_all' && !nextProps.sensitive || displayMedia === 'show_all' });
} else if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {

View file

@ -57,7 +57,7 @@ export default class ModalRoot extends React.PureComponent {
this.history = this.context.router ? this.context.router.history : createBrowserHistory();
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!!nextProps.children && !this.props.children) {
this.activeElement = document.activeElement;

View file

@ -22,7 +22,7 @@ class InlineAlert extends React.PureComponent {
static TRANSITION_DELAY = 200;
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!this.props.show && nextProps.show) {
this.setState({ mountMessage: true });
} else if (this.props.show && !nextProps.show) {
@ -58,11 +58,11 @@ class AccountNote extends ImmutablePureComponent {
saved: false,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this._reset();
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
const accountWillChange = !is(this.props.account, nextProps.account);
const newState = {};

View file

@ -136,7 +136,7 @@ class Audio extends React.PureComponent {
}
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {
this.setState({ revealed: nextProps.visible });
}

View file

@ -34,7 +34,7 @@ class Blocks extends ImmutablePureComponent {
multiColumn: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchBlocks());
}

View file

@ -34,7 +34,7 @@ class Bookmarks extends ImmutablePureComponent {
isLoading: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchBookmarkedStatuses());
}

View file

@ -59,7 +59,7 @@ class ModifierPickerMenu extends React.PureComponent {
this.props.onSelect(e.currentTarget.getAttribute('data-index') * 1);
};
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.active) {
this.attachListeners();
} else {

View file

@ -214,7 +214,7 @@ class PrivacyDropdown extends React.PureComponent {
this.props.onChange(value);
};
componentWillMount () {
UNSAFE_componentWillMount () {
const { intl: { formatMessage } } = this.props;
this.options = [

View file

@ -34,7 +34,7 @@ class Blocks extends ImmutablePureComponent {
multiColumn: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchDomainBlocks());
}

View file

@ -34,7 +34,7 @@ class Favourites extends ImmutablePureComponent {
isLoading: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchFavouritedStatuses());
}

View file

@ -31,13 +31,13 @@ class Favourites extends ImmutablePureComponent {
intl: PropTypes.object.isRequired,
};
componentWillMount () {
UNSAFE_componentWillMount () {
if (!this.props.accountIds) {
this.props.dispatch(fetchFavourites(this.props.params.statusId));
}
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this.props.dispatch(fetchFavourites(nextProps.params.statusId));
}

View file

@ -39,7 +39,7 @@ class FollowRequests extends ImmutablePureComponent {
multiColumn: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchFollowRequests());
}

View file

@ -76,7 +76,7 @@ class ListTimeline extends React.PureComponent {
this.disconnect = dispatch(connectListStream(id));
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
const { dispatch } = this.props;
const { id } = nextProps.params;

View file

@ -42,7 +42,7 @@ class Lists extends ImmutablePureComponent {
multiColumn: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchLists());
}

View file

@ -35,7 +35,7 @@ class Mutes extends ImmutablePureComponent {
multiColumn: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchMutes());
}

View file

@ -93,7 +93,7 @@ class Notifications extends React.PureComponent {
trackScroll: true,
};
componentWillMount() {
UNSAFE_componentWillMount() {
this.props.dispatch(mountNotifications());
}

View file

@ -29,7 +29,7 @@ class PinnedStatuses extends ImmutablePureComponent {
multiColumn: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchPinnedStatuses());
}

View file

@ -31,13 +31,13 @@ class Reblogs extends ImmutablePureComponent {
intl: PropTypes.object.isRequired,
};
componentWillMount () {
UNSAFE_componentWillMount () {
if (!this.props.accountIds) {
this.props.dispatch(fetchReblogs(this.props.params.statusId));
}
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this.props.dispatch(fetchReblogs(nextProps.params.statusId));
}

View file

@ -66,7 +66,7 @@ export default class Card extends React.PureComponent {
revealed: !this.props.sensitive,
};
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!Immutable.is(this.props.card, nextProps.card)) {
this.setState({ embedded: false, previewLoaded: false });
}

View file

@ -209,7 +209,7 @@ class Status extends ImmutablePureComponent {
loadedStatusId: undefined,
};
componentWillMount () {
UNSAFE_componentWillMount () {
this.props.dispatch(fetchStatus(this.props.params.statusId));
}
@ -217,7 +217,7 @@ class Status extends ImmutablePureComponent {
attachFullscreenListener(this.onFullScreenChange);
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this._scrolledIntoView = false;
this.props.dispatch(fetchStatus(nextProps.params.statusId));

View file

@ -33,11 +33,11 @@ class Bundle extends React.PureComponent {
forceRender: false,
};
componentWillMount() {
UNSAFE_componentWillMount() {
this.load(this.props);
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.fetchComponent !== this.props.fetchComponent) {
this.load(nextProps);
}

View file

@ -78,7 +78,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
this.isRtlLayout = document.getElementsByTagName('body')[0].classList.contains('rtl');
}
componentWillUpdate(nextProps) {
UNSAFE_componentWillUpdate(nextProps) {
if (this.props.singleColumn !== nextProps.singleColumn && nextProps.singleColumn) {
this.node.removeEventListener('wheel', this.handleWheel);
}

View file

@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import Logo from 'mastodon/components/logo';
import { WordmarkLogo } from 'mastodon/components/logo';
import { timelinePreview, showTrends } from 'mastodon/initial_state';
import ColumnLink from './column_link';
import DisabledAccountBanner from './disabled_account_banner';
@ -46,7 +46,7 @@ class NavigationPanel extends React.Component {
return (
<div className='navigation-panel'>
<div className='navigation-panel__logo'>
<Link to='/' className='column-link column-link--logo'><Logo /></Link>
<Link to='/' className='column-link column-link--logo'><WordmarkLogo /></Link>
<hr />
</div>

View file

@ -126,7 +126,7 @@ class SwitchingColumnsArea extends React.PureComponent {
mobile: PropTypes.bool,
};
componentWillMount () {
UNSAFE_componentWillMount () {
if (this.props.mobile) {
document.body.classList.toggle('layout-single-column', true);
document.body.classList.toggle('layout-multiple-columns', false);

View file

@ -370,7 +370,7 @@ class Video extends React.PureComponent {
}
}
componentWillReceiveProps (nextProps) {
UNSAFE_componentWillReceiveProps (nextProps) {
if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {
this.setState({ revealed: nextProps.visible });
}

View file

@ -8,7 +8,21 @@ import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
export const store = configureStore({
reducer: rootReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware()
getDefaultMiddleware({
// In development, Redux Toolkit enables 2 default middlewares to detect
// common issues with states. Unfortunately, our use of ImmutableJS for state
// triggers both, so lets disable them until our state is fully refactored
// https://redux-toolkit.js.org/api/serializabilityMiddleware
// This checks recursively that every values in the state are serializable in JSON
// Which is not the case, as we use ImmutableJS structures, but also File objects
serializableCheck: false,
// https://redux-toolkit.js.org/api/immutabilityMiddleware
// This checks recursively if every value in the state is immutable (ie, a JS primitive type)
// But this is not the case, as our Root State is an ImmutableJS map, which is an object
immutableCheck: false,
})
.concat(
loadingBarMiddleware({
promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'],