From 83b21e90d29ad381af1fdce44244d832ce9eb091 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Wed, 4 May 2022 15:52:19 +0000 Subject: [PATCH] Bump React from 16.14.0 to 18.1.0 --- .../__tests__/autosuggest_emoji-test.js | 1 - .../components/__tests__/avatar-test.js | 1 - .../__tests__/avatar_overlay-test.js | 1 - .../components/__tests__/button-test.js | 1 - .../components/__tests__/display_name-test.js | 1 - app/javascript/mastodon/components/account.js | 9 +- .../mastodon/components/admin/Counter.js | 16 +- .../mastodon/components/admin/Dimension.js | 4 +- .../components/admin/ReportReasonSelector.js | 8 +- .../mastodon/components/admin/Retention.js | 4 +- .../mastodon/components/admin/Trends.js | 4 +- .../mastodon/components/animated_number.js | 6 +- .../mastodon/components/attachment_list.js | 1 - .../mastodon/components/autosuggest_emoji.js | 4 +- .../components/autosuggest_hashtag.js | 4 +- .../mastodon/components/autosuggest_input.js | 3 +- .../components/autosuggest_textarea.js | 3 +- app/javascript/mastodon/components/avatar.js | 4 +- .../mastodon/components/avatar_composite.js | 4 +- .../mastodon/components/avatar_overlay.js | 4 +- .../mastodon/components/blurhash.js | 4 +- app/javascript/mastodon/components/button.js | 4 +- app/javascript/mastodon/components/check.js | 2 - app/javascript/mastodon/components/column.js | 4 +- .../mastodon/components/column_back_button.js | 4 +- .../components/column_back_button_slim.js | 1 - .../mastodon/components/column_header.js | 4 +- .../mastodon/components/common_counter.js | 1 - .../mastodon/components/display_name.js | 4 +- app/javascript/mastodon/components/domain.js | 1 - .../mastodon/components/dropdown_menu.js | 12 +- .../components/edited_timestamp/index.js | 4 +- .../mastodon/components/error_boundary.js | 4 +- app/javascript/mastodon/components/gifv.js | 6 +- app/javascript/mastodon/components/hashtag.js | 6 +- app/javascript/mastodon/components/icon.js | 4 +- .../mastodon/components/icon_button.js | 10 +- .../mastodon/components/icon_with_badge.js | 1 - .../mastodon/components/inline_account.js | 4 +- .../intersection_observer_article.js | 8 +- .../mastodon/components/load_gap.js | 4 +- .../mastodon/components/load_more.js | 4 +- .../mastodon/components/load_pending.js | 4 +- .../mastodon/components/loading_indicator.js | 1 - app/javascript/mastodon/components/logo.js | 2 - .../mastodon/components/media_attachments.js | 1 - .../mastodon/components/media_gallery.js | 8 +- .../mastodon/components/missing_indicator.js | 1 - .../mastodon/components/modal_root.js | 6 +- .../mastodon/components/permalink.js | 4 +- .../picture_in_picture_placeholder.js | 4 +- app/javascript/mastodon/components/poll.js | 1 - .../mastodon/components/radio_button.js | 4 +- .../components/regeneration_indicator.js | 1 - .../mastodon/components/relative_timestamp.js | 8 +- .../mastodon/components/scrollable_list.js | 12 +- .../mastodon/components/setting_text.js | 4 +- .../mastodon/components/short_number.js | 4 +- .../mastodon/components/skeleton.js | 1 - app/javascript/mastodon/components/status.js | 1 - .../mastodon/components/status_action_bar.js | 1 - .../mastodon/components/status_content.js | 4 +- .../mastodon/components/status_list.js | 1 - .../mastodon/components/timeline_hint.js | 1 - .../mastodon/containers/account_container.js | 1 - .../mastodon/containers/admin_component.js | 4 +- .../mastodon/containers/compose_container.js | 4 +- .../mastodon/containers/domain_container.js | 1 - .../mastodon/containers/mastodon.js | 4 +- .../mastodon/containers/media_container.js | 10 +- .../mastodon/containers/status_container.js | 1 - .../mastodon/containers/timeline_container.js | 12 +- .../account/components/account_note.js | 10 +- .../features/account/components/header.js | 5 +- .../account_gallery/components/media_item.js | 1 - .../features/account_gallery/index.js | 1 - .../account_timeline/components/header.js | 1 - .../components/limited_account_hint.js | 4 +- .../account_timeline/components/moved_note.js | 1 - .../containers/header_container.js | 1 - .../features/account_timeline/index.js | 1 - .../mastodon/features/audio/index.js | 4 +- .../mastodon/features/blocks/index.js | 3 +- .../features/bookmarked_statuses/index.js | 3 +- .../components/column_settings.js | 4 +- .../features/community_timeline/index.js | 4 +- .../features/compose/components/action_bar.js | 4 +- .../compose/components/autosuggest_account.js | 1 - .../compose/components/character_counter.js | 4 +- .../compose/components/compose_form.js | 1 - .../components/emoji_picker_dropdown.js | 12 +- .../compose/components/language_dropdown.js | 6 +- .../compose/components/navigation_bar.js | 1 - .../compose/components/poll_button.js | 4 +- .../features/compose/components/poll_form.js | 4 +- .../compose/components/privacy_dropdown.js | 8 +- .../compose/components/reply_indicator.js | 1 - .../features/compose/components/search.js | 6 +- .../compose/components/search_results.js | 1 - .../compose/components/text_icon_button.js | 4 +- .../features/compose/components/upload.js | 1 - .../compose/components/upload_button.js | 1 - .../compose/components/upload_form.js | 1 - .../compose/components/upload_progress.js | 4 +- .../features/compose/components/warning.js | 4 +- .../containers/sensitive_button_container.js | 4 +- .../compose/containers/warning_container.js | 1 - .../mastodon/features/compose/index.js | 4 +- .../components/conversation.js | 1 - .../components/conversations_list.js | 1 - .../features/direct_timeline/index.js | 4 +- .../directory/components/account_card.js | 1 - .../mastodon/features/directory/index.js | 4 +- .../mastodon/features/domain_blocks/index.js | 3 +- .../features/explore/components/story.js | 8 +- .../mastodon/features/explore/index.js | 8 +- .../mastodon/features/explore/links.js | 4 +- .../mastodon/features/explore/results.js | 8 +- .../mastodon/features/explore/statuses.js | 4 +- .../mastodon/features/explore/suggestions.js | 4 +- .../mastodon/features/explore/tags.js | 4 +- .../features/favourited_statuses/index.js | 3 +- .../mastodon/features/favourites/index.js | 5 +- .../components/account.js | 1 - .../features/follow_recommendations/index.js | 5 +- .../components/account_authorize.js | 1 - .../features/follow_requests/index.js | 3 +- .../mastodon/features/followers/index.js | 1 - .../mastodon/features/following/index.js | 1 - .../features/generic_not_found/index.js | 1 - .../components/announcements.js | 4 +- .../getting_started/components/trends.js | 1 - .../features/getting_started/index.js | 1 - .../components/column_settings.js | 4 +- .../features/hashtag_timeline/index.js | 6 +- .../components/column_settings.js | 4 +- .../mastodon/features/home_timeline/index.js | 4 +- .../features/keyboard_shortcuts/index.js | 1 - .../features/list_adder/components/account.js | 1 - .../features/list_adder/components/list.js | 1 - .../mastodon/features/list_adder/index.js | 1 - .../list_editor/components/account.js | 1 - .../list_editor/components/edit_list_form.js | 4 +- .../features/list_editor/components/search.js | 4 +- .../mastodon/features/list_editor/index.js | 1 - .../mastodon/features/list_timeline/index.js | 6 +- .../lists/components/new_list_form.js | 4 +- .../mastodon/features/lists/index.js | 3 +- .../mastodon/features/mutes/index.js | 3 +- .../components/clear_column_button.js | 4 +- .../components/column_settings.js | 4 +- .../notifications/components/filter_bar.js | 4 +- .../components/follow_request.js | 5 +- .../components/grant_permission_button.js | 4 +- .../notifications/components/notification.js | 1 - .../notifications_permission_banner.js | 4 +- .../notifications/components/report.js | 5 +- .../components/setting_toggle.js | 4 +- .../mastodon/features/notifications/index.js | 6 +- .../picture_in_picture/components/footer.js | 1 - .../picture_in_picture/components/header.js | 1 - .../features/picture_in_picture/index.js | 4 +- .../features/pinned_statuses/index.js | 3 +- .../components/column_settings.js | 4 +- .../features/public_timeline/index.js | 4 +- .../mastodon/features/reblogs/index.js | 5 +- .../mastodon/features/report/category.js | 8 +- .../mastodon/features/report/comment.js | 12 +- .../features/report/components/option.js | 4 +- .../report/components/status_check_box.js | 4 +- .../mastodon/features/report/rules.js | 8 +- .../mastodon/features/report/statuses.js | 8 +- .../mastodon/features/report/thanks.js | 12 +- .../features/standalone/compose/index.js | 4 +- .../standalone/hashtag_timeline/index.js | 4 +- .../standalone/public_timeline/index.js | 4 +- .../features/status/components/action_bar.js | 4 +- .../features/status/components/card.js | 6 +- .../status/components/detailed_status.js | 23 ++- .../mastodon/features/status/index.js | 5 +- .../ui/components/__tests__/column-test.js | 1 - .../features/ui/components/actions_modal.js | 1 - .../features/ui/components/audio_modal.js | 1 - .../features/ui/components/block_modal.js | 4 +- .../features/ui/components/boost_modal.js | 1 - .../mastodon/features/ui/components/bundle.js | 8 +- .../ui/components/bundle_column_error.js | 4 +- .../ui/components/bundle_modal_error.js | 4 +- .../mastodon/features/ui/components/column.js | 4 +- .../features/ui/components/column_header.js | 4 +- .../features/ui/components/column_link.js | 1 - .../features/ui/components/column_loading.js | 1 - .../ui/components/column_subheading.js | 1 - .../features/ui/components/columns_area.js | 10 +- .../ui/components/compare_history_modal.js | 8 +- .../features/ui/components/compose_panel.js | 4 +- .../ui/components/confirmation_modal.js | 4 +- .../features/ui/components/drawer_loading.js | 2 - .../features/ui/components/embed_modal.js | 1 - .../ui/components/focal_point_modal.js | 8 +- .../ui/components/follow_requests_nav_link.js | 4 +- .../features/ui/components/image_loader.js | 6 +- .../features/ui/components/link_footer.js | 4 +- .../features/ui/components/list_panel.js | 1 - .../features/ui/components/media_modal.js | 1 - .../features/ui/components/modal_loading.js | 2 - .../features/ui/components/modal_root.js | 4 +- .../features/ui/components/mute_modal.js | 4 +- .../ui/components/navigation_panel.js | 1 - .../features/ui/components/report_modal.js | 1 - .../features/ui/components/tabs_bar.js | 6 +- .../features/ui/components/upload_area.js | 4 +- .../features/ui/components/video_modal.js | 1 - .../features/ui/components/zoomable_image.js | 8 +- app/javascript/mastodon/features/ui/index.js | 8 +- .../features/ui/util/react_router_helpers.js | 8 +- .../features/ui/util/reduced_motion.js | 4 +- .../mastodon/features/video/index.js | 6 +- app/javascript/mastodon/main.js | 18 +- app/javascript/packs/about.js | 19 +- app/javascript/packs/admin.js | 25 +-- app/javascript/packs/public.js | 30 ++-- app/javascript/packs/share.js | 18 +- babel.config.js | 1 + package.json | 10 +- yarn.lock | 167 +++++++++--------- 226 files changed, 531 insertions(+), 610 deletions(-) diff --git a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js index 05616e4448..80aa33a187 100644 --- a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js +++ b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js @@ -1,4 +1,3 @@ -import React from 'react'; import renderer from 'react-test-renderer'; import AutosuggestEmoji from '../autosuggest_emoji'; diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.js b/app/javascript/mastodon/components/__tests__/avatar-test.js index dd3f7b7d21..d4f81e273d 100644 --- a/app/javascript/mastodon/components/__tests__/avatar-test.js +++ b/app/javascript/mastodon/components/__tests__/avatar-test.js @@ -1,4 +1,3 @@ -import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; import Avatar from '../avatar'; diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js index 44addea832..a5b418c6c9 100644 --- a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js +++ b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js @@ -1,4 +1,3 @@ -import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; import AvatarOverlay from '../avatar_overlay'; diff --git a/app/javascript/mastodon/components/__tests__/button-test.js b/app/javascript/mastodon/components/__tests__/button-test.js index f5a649f70e..82d307e843 100644 --- a/app/javascript/mastodon/components/__tests__/button-test.js +++ b/app/javascript/mastodon/components/__tests__/button-test.js @@ -1,5 +1,4 @@ import { render, fireEvent, screen } from '@testing-library/react'; -import React from 'react'; import renderer from 'react-test-renderer'; import Button from '../button'; diff --git a/app/javascript/mastodon/components/__tests__/display_name-test.js b/app/javascript/mastodon/components/__tests__/display_name-test.js index 0d040c4cd8..2506cc7800 100644 --- a/app/javascript/mastodon/components/__tests__/display_name-test.js +++ b/app/javascript/mastodon/components/__tests__/display_name-test.js @@ -1,4 +1,3 @@ -import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; import DisplayName from '../display_name'; diff --git a/app/javascript/mastodon/components/account.js b/app/javascript/mastodon/components/account.js index af9f119c82..98709742c4 100644 --- a/app/javascript/mastodon/components/account.js +++ b/app/javascript/mastodon/components/account.js @@ -1,4 +1,3 @@ -import React, { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import Avatar from './avatar'; @@ -72,10 +71,10 @@ class Account extends ImmutablePureComponent { if (hidden) { return ( - + <> {account.get('display_name')} {account.get('username')} - + ); } @@ -103,10 +102,10 @@ class Account extends ImmutablePureComponent { hidingNotificationsButton = ; } buttons = ( - + <> {hidingNotificationsButton} - + ); } else if (defaultAction === 'mute') { buttons = ; diff --git a/app/javascript/mastodon/components/admin/Counter.js b/app/javascript/mastodon/components/admin/Counter.js index 5a5b2b869e..9eaafbca88 100644 --- a/app/javascript/mastodon/components/admin/Counter.js +++ b/app/javascript/mastodon/components/admin/Counter.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import api from 'mastodon/api'; import { FormattedNumber } from 'react-intl'; @@ -24,7 +24,7 @@ const percIncrease = (a, b) => { return percent; }; -export default class Counter extends React.PureComponent { +export default class Counter extends PureComponent { static propTypes = { measure: PropTypes.string.isRequired, @@ -62,25 +62,25 @@ export default class Counter extends React.PureComponent { if (loading) { content = ( - + <> - + ); } else { const measure = data[0]; const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1); content = ( - + <> {measure.human_value || } {measure.previous_total && ( 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'})} - + ); } const inner = ( - + <>
{content}
@@ -96,7 +96,7 @@ export default class Counter extends React.PureComponent { )} -
+ ); if (href) { diff --git a/app/javascript/mastodon/components/admin/Dimension.js b/app/javascript/mastodon/components/admin/Dimension.js index 977c8208df..090cea9fcb 100644 --- a/app/javascript/mastodon/components/admin/Dimension.js +++ b/app/javascript/mastodon/components/admin/Dimension.js @@ -1,11 +1,11 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import api from 'mastodon/api'; import { FormattedNumber } from 'react-intl'; import { roundTo10 } from 'mastodon/utils/numbers'; import Skeleton from 'mastodon/components/skeleton'; -export default class Dimension extends React.PureComponent { +export default class Dimension extends PureComponent { static propTypes = { dimension: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/components/admin/ReportReasonSelector.js b/app/javascript/mastodon/components/admin/ReportReasonSelector.js index 1f91d25175..3cdff8997f 100644 --- a/app/javascript/mastodon/components/admin/ReportReasonSelector.js +++ b/app/javascript/mastodon/components/admin/ReportReasonSelector.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import api from 'mastodon/api'; import { injectIntl, defineMessages } from 'react-intl'; @@ -10,7 +10,7 @@ const messages = defineMessages({ violation: { id: 'report.categories.violation', defaultMessage: 'Content violates one or more server rules' }, }); -class Category extends React.PureComponent { +class Category extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, @@ -52,7 +52,7 @@ class Category extends React.PureComponent { } -class Rule extends React.PureComponent { +class Rule extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, @@ -85,7 +85,7 @@ class Rule extends React.PureComponent { } export default @injectIntl -class ReportReasonSelector extends React.PureComponent { +class ReportReasonSelector extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/components/admin/Retention.js b/app/javascript/mastodon/components/admin/Retention.js index 47c9e71513..c724bd5ce1 100644 --- a/app/javascript/mastodon/components/admin/Retention.js +++ b/app/javascript/mastodon/components/admin/Retention.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import api from 'mastodon/api'; import { FormattedMessage, FormattedNumber, FormattedDate } from 'react-intl'; @@ -14,7 +14,7 @@ const dateForCohort = cohort => { } }; -export default class Retention extends React.PureComponent { +export default class Retention extends PureComponent { static propTypes = { start_at: PropTypes.string, diff --git a/app/javascript/mastodon/components/admin/Trends.js b/app/javascript/mastodon/components/admin/Trends.js index 635bdf37d5..bb7777a542 100644 --- a/app/javascript/mastodon/components/admin/Trends.js +++ b/app/javascript/mastodon/components/admin/Trends.js @@ -1,11 +1,11 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import api from 'mastodon/api'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import Hashtag from 'mastodon/components/hashtag'; -export default class Trends extends React.PureComponent { +export default class Trends extends PureComponent { static propTypes = { limit: PropTypes.number.isRequired, diff --git a/app/javascript/mastodon/components/animated_number.js b/app/javascript/mastodon/components/animated_number.js index fbe948c5b0..46bb82dafc 100644 --- a/app/javascript/mastodon/components/animated_number.js +++ b/app/javascript/mastodon/components/animated_number.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { FormattedNumber } from 'react-intl'; import TransitionMotion from 'react-motion/lib/TransitionMotion'; @@ -15,7 +15,7 @@ const obfuscatedCount = count => { } }; -export default class AnimatedNumber extends React.PureComponent { +export default class AnimatedNumber extends PureComponent { static propTypes = { value: PropTypes.number.isRequired, @@ -26,7 +26,7 @@ export default class AnimatedNumber extends React.PureComponent { direction: 1, }; - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { if (nextProps.value > this.props.value) { this.setState({ direction: 1 }); } else if (nextProps.value < this.props.value) { diff --git a/app/javascript/mastodon/components/attachment_list.js b/app/javascript/mastodon/components/attachment_list.js index 0e23889ded..e65c7956b5 100644 --- a/app/javascript/mastodon/components/attachment_list.js +++ b/app/javascript/mastodon/components/attachment_list.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/components/autosuggest_emoji.js b/app/javascript/mastodon/components/autosuggest_emoji.js index 4937e4d984..8afbdd9cb5 100644 --- a/app/javascript/mastodon/components/autosuggest_emoji.js +++ b/app/javascript/mastodon/components/autosuggest_emoji.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light'; import { assetHost } from 'mastodon/utils/config'; -export default class AutosuggestEmoji extends React.PureComponent { +export default class AutosuggestEmoji extends PureComponent { static propTypes = { emoji: PropTypes.object.isRequired, diff --git a/app/javascript/mastodon/components/autosuggest_hashtag.js b/app/javascript/mastodon/components/autosuggest_hashtag.js index 9e9d888f83..4fd23ec9a8 100644 --- a/app/javascript/mastodon/components/autosuggest_hashtag.js +++ b/app/javascript/mastodon/components/autosuggest_hashtag.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ShortNumber from 'mastodon/components/short_number'; import { FormattedMessage } from 'react-intl'; -export default class AutosuggestHashtag extends React.PureComponent { +export default class AutosuggestHashtag extends PureComponent { static propTypes = { tag: PropTypes.shape({ diff --git a/app/javascript/mastodon/components/autosuggest_input.js b/app/javascript/mastodon/components/autosuggest_input.js index 12d44b5d0b..5c6ac019c6 100644 --- a/app/javascript/mastodon/components/autosuggest_input.js +++ b/app/javascript/mastodon/components/autosuggest_input.js @@ -1,4 +1,3 @@ -import React from 'react'; import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container'; import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestHashtag from './autosuggest_hashtag'; @@ -152,7 +151,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 }); } diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index 08b9cd80bb..7d17107be0 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -1,4 +1,3 @@ -import React from 'react'; import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container'; import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestHashtag from './autosuggest_hashtag'; @@ -152,7 +151,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 }); } diff --git a/app/javascript/mastodon/components/avatar.js b/app/javascript/mastodon/components/avatar.js index 12ab7d2dfe..3394a8e265 100644 --- a/app/javascript/mastodon/components/avatar.js +++ b/app/javascript/mastodon/components/avatar.js @@ -1,10 +1,10 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { autoPlayGif } from '../initial_state'; import classNames from 'classnames'; -export default class Avatar extends React.PureComponent { +export default class Avatar extends PureComponent { static propTypes = { account: ImmutablePropTypes.map, diff --git a/app/javascript/mastodon/components/avatar_composite.js b/app/javascript/mastodon/components/avatar_composite.js index 5d5b897492..2a49bf4264 100644 --- a/app/javascript/mastodon/components/avatar_composite.js +++ b/app/javascript/mastodon/components/avatar_composite.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { autoPlayGif } from '../initial_state'; -export default class AvatarComposite extends React.PureComponent { +export default class AvatarComposite extends PureComponent { static propTypes = { accounts: ImmutablePropTypes.list.isRequired, diff --git a/app/javascript/mastodon/components/avatar_overlay.js b/app/javascript/mastodon/components/avatar_overlay.js index 3ec1d77304..0de08ef036 100644 --- a/app/javascript/mastodon/components/avatar_overlay.js +++ b/app/javascript/mastodon/components/avatar_overlay.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { autoPlayGif } from '../initial_state'; -export default class AvatarOverlay extends React.PureComponent { +export default class AvatarOverlay extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/components/blurhash.js b/app/javascript/mastodon/components/blurhash.js index 2af5cfc568..21fbebc70a 100644 --- a/app/javascript/mastodon/components/blurhash.js +++ b/app/javascript/mastodon/components/blurhash.js @@ -1,7 +1,7 @@ // @ts-check import { decode } from 'blurhash'; -import React, { useRef, useEffect } from 'react'; +import { memo, useRef, useEffect } from 'react'; import PropTypes from 'prop-types'; /** @@ -62,4 +62,4 @@ Blurhash.propTypes = { dummy: PropTypes.bool, }; -export default React.memo(Blurhash); +export default memo(Blurhash); diff --git a/app/javascript/mastodon/components/button.js b/app/javascript/mastodon/components/button.js index 85b2d78ca9..f153d8c9cc 100644 --- a/app/javascript/mastodon/components/button.js +++ b/app/javascript/mastodon/components/button.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -export default class Button extends React.PureComponent { +export default class Button extends PureComponent { static propTypes = { text: PropTypes.node, diff --git a/app/javascript/mastodon/components/check.js b/app/javascript/mastodon/components/check.js index ee2ef1595a..d818480b7b 100644 --- a/app/javascript/mastodon/components/check.js +++ b/app/javascript/mastodon/components/check.js @@ -1,5 +1,3 @@ -import React from 'react'; - const Check = () => ( diff --git a/app/javascript/mastodon/components/column.js b/app/javascript/mastodon/components/column.js index 239824a4fe..94ffa998e3 100644 --- a/app/javascript/mastodon/components/column.js +++ b/app/javascript/mastodon/components/column.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { supportsPassiveEvents } from 'detect-passive-events'; import { scrollTop } from '../scroll'; -export default class Column extends React.PureComponent { +export default class Column extends PureComponent { static propTypes = { children: PropTypes.node, diff --git a/app/javascript/mastodon/components/column_back_button.js b/app/javascript/mastodon/components/column_back_button.js index d97622705e..754afb1bdf 100644 --- a/app/javascript/mastodon/components/column_back_button.js +++ b/app/javascript/mastodon/components/column_back_button.js @@ -1,10 +1,10 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import Icon from 'mastodon/components/icon'; import { createPortal } from 'react-dom'; -export default class ColumnBackButton extends React.PureComponent { +export default class ColumnBackButton extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/mastodon/components/column_back_button_slim.js b/app/javascript/mastodon/components/column_back_button_slim.js index cc8bfb1515..6447635178 100644 --- a/app/javascript/mastodon/components/column_back_button_slim.js +++ b/app/javascript/mastodon/components/column_back_button_slim.js @@ -1,4 +1,3 @@ -import React from 'react'; import { FormattedMessage } from 'react-intl'; import ColumnBackButton from './column_back_button'; import Icon from 'mastodon/components/icon'; diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/mastodon/components/column_header.js index cbbc490a83..51d806e4ee 100644 --- a/app/javascript/mastodon/components/column_header.js +++ b/app/javascript/mastodon/components/column_header.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { createPortal } from 'react-dom'; import classNames from 'classnames'; @@ -13,7 +13,7 @@ const messages = defineMessages({ }); export default @injectIntl -class ColumnHeader extends React.PureComponent { +class ColumnHeader extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/mastodon/components/common_counter.js b/app/javascript/mastodon/components/common_counter.js index dd9b62de9b..5d169c9332 100644 --- a/app/javascript/mastodon/components/common_counter.js +++ b/app/javascript/mastodon/components/common_counter.js @@ -1,5 +1,4 @@ // @ts-check -import React from 'react'; import { FormattedMessage } from 'react-intl'; /** diff --git a/app/javascript/mastodon/components/display_name.js b/app/javascript/mastodon/components/display_name.js index 7ccfbd0cd5..df6136e948 100644 --- a/app/javascript/mastodon/components/display_name.js +++ b/app/javascript/mastodon/components/display_name.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { autoPlayGif } from 'mastodon/initial_state'; -export default class DisplayName extends React.PureComponent { +export default class DisplayName extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/components/domain.js b/app/javascript/mastodon/components/domain.js index 697065d874..935d260f48 100644 --- a/app/javascript/mastodon/components/domain.js +++ b/app/javascript/mastodon/components/domain.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import IconButton from './icon_button'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js index 4b4ad83555..f29d4eb539 100644 --- a/app/javascript/mastodon/components/dropdown_menu.js +++ b/app/javascript/mastodon/components/dropdown_menu.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { Children, PureComponent, cloneElement } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import IconButton from './icon_button'; @@ -12,7 +12,7 @@ import { CircularProgress } from 'mastodon/components/loading_indicator'; const listenerOptions = supportsPassiveEvents ? { passive: true } : false; let id = 0; -class DropdownMenu extends React.PureComponent { +class DropdownMenu extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -178,7 +178,7 @@ class DropdownMenu extends React.PureComponent { } -export default class Dropdown extends React.PureComponent { +export default class Dropdown extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -313,7 +313,7 @@ export default class Dropdown extends React.PureComponent { const open = this.state.id === openDropdownId; - const button = children ? React.cloneElement(React.Children.only(children), { + const button = children ? cloneElement(Children.only(children), { ref: this.setTargetRef, onClick: this.handleClick, onMouseDown: this.handleMouseDown, @@ -335,7 +335,7 @@ export default class Dropdown extends React.PureComponent { ); return ( - + <> {button} @@ -350,7 +350,7 @@ export default class Dropdown extends React.PureComponent { onItemClick={this.handleItemClick} /> - + ); } diff --git a/app/javascript/mastodon/components/edited_timestamp/index.js b/app/javascript/mastodon/components/edited_timestamp/index.js index bebf938865..679ec4e4cd 100644 --- a/app/javascript/mastodon/components/edited_timestamp/index.js +++ b/app/javascript/mastodon/components/edited_timestamp/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, injectIntl } from 'react-intl'; import Icon from 'mastodon/components/icon'; @@ -18,7 +18,7 @@ const mapDispatchToProps = (dispatch, { statusId }) => ({ export default @connect(null, mapDispatchToProps) @injectIntl -class EditedTimestamp extends React.PureComponent { +class EditedTimestamp extends PureComponent { static propTypes = { statusId: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/components/error_boundary.js b/app/javascript/mastodon/components/error_boundary.js index ca4a2cfe14..7ca9facd2a 100644 --- a/app/javascript/mastodon/components/error_boundary.js +++ b/app/javascript/mastodon/components/error_boundary.js @@ -1,10 +1,10 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { version, source_url } from 'mastodon/initial_state'; import StackTrace from 'stacktrace-js'; -export default class ErrorBoundary extends React.PureComponent { +export default class ErrorBoundary extends PureComponent { static propTypes = { children: PropTypes.node, diff --git a/app/javascript/mastodon/components/gifv.js b/app/javascript/mastodon/components/gifv.js index b775e52005..848411a119 100644 --- a/app/javascript/mastodon/components/gifv.js +++ b/app/javascript/mastodon/components/gifv.js @@ -1,7 +1,7 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; -export default class GIFV extends React.PureComponent { +export default class GIFV extends PureComponent { static propTypes = { src: PropTypes.string.isRequired, @@ -19,7 +19,7 @@ export default class GIFV extends React.PureComponent { this.setState({ loading: false }); } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { if (nextProps.src !== this.props.src) { this.setState({ loading: true }); } diff --git a/app/javascript/mastodon/components/hashtag.js b/app/javascript/mastodon/components/hashtag.js index 7f442d189c..5fee2bfc87 100644 --- a/app/javascript/mastodon/components/hashtag.js +++ b/app/javascript/mastodon/components/hashtag.js @@ -1,5 +1,5 @@ // @ts-check -import React from 'react'; +import { Component } from 'react'; import { Sparklines, SparklinesCurve } from 'react-sparklines'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; @@ -9,7 +9,7 @@ import ShortNumber from 'mastodon/components/short_number'; import Skeleton from 'mastodon/components/skeleton'; import classNames from 'classnames'; -class SilentErrorBoundary extends React.Component { +class SilentErrorBoundary extends Component { static propTypes = { children: PropTypes.node, @@ -68,7 +68,7 @@ const Hashtag = ({ name, href, to, people, uses, history, className }) => (
- {name ? #{name} : } + {name ? <>#{name} : } {typeof people !== 'undefined' ? : } diff --git a/app/javascript/mastodon/components/icon.js b/app/javascript/mastodon/components/icon.js index d8a17722fe..11178dd127 100644 --- a/app/javascript/mastodon/components/icon.js +++ b/app/javascript/mastodon/components/icon.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -export default class Icon extends React.PureComponent { +export default class Icon extends PureComponent { static propTypes = { id: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/components/icon_button.js b/app/javascript/mastodon/components/icon_button.js index 81743a1dbe..1c1c3244b0 100644 --- a/app/javascript/mastodon/components/icon_button.js +++ b/app/javascript/mastodon/components/icon_button.js @@ -1,10 +1,10 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import Icon from 'mastodon/components/icon'; import AnimatedNumber from 'mastodon/components/animated_number'; -export default class IconButton extends React.PureComponent { +export default class IconButton extends PureComponent { static propTypes = { className: PropTypes.string, @@ -44,7 +44,7 @@ export default class IconButton extends React.PureComponent { deactivate: false, } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { if (!nextProps.animate) return; if (this.props.active && !nextProps.active) { @@ -126,9 +126,9 @@ export default class IconButton extends React.PureComponent { } let contents = ( - + <> + ); if (href) { diff --git a/app/javascript/mastodon/components/icon_with_badge.js b/app/javascript/mastodon/components/icon_with_badge.js index 4214eccfde..812ebfe573 100644 --- a/app/javascript/mastodon/components/icon_with_badge.js +++ b/app/javascript/mastodon/components/icon_with_badge.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import Icon from 'mastodon/components/icon'; diff --git a/app/javascript/mastodon/components/inline_account.js b/app/javascript/mastodon/components/inline_account.js index a1b4955904..c5c30fb989 100644 --- a/app/javascript/mastodon/components/inline_account.js +++ b/app/javascript/mastodon/components/inline_account.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import { makeGetAccount } from 'mastodon/selectors'; @@ -15,7 +15,7 @@ const makeMapStateToProps = () => { }; export default @connect(makeMapStateToProps) -class InlineAccount extends React.PureComponent { +class InlineAccount extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/components/intersection_observer_article.js b/app/javascript/mastodon/components/intersection_observer_article.js index 26f85fa400..88a12b2425 100644 --- a/app/javascript/mastodon/components/intersection_observer_article.js +++ b/app/javascript/mastodon/components/intersection_observer_article.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { cloneElement, Component } from 'react'; import PropTypes from 'prop-types'; import scheduleIdleTask from '../features/ui/util/schedule_idle_task'; import getRectFromEntry from '../features/ui/util/get_rect_from_entry'; @@ -6,7 +6,7 @@ import getRectFromEntry from '../features/ui/util/get_rect_from_entry'; // Diff these props in the "unrendered" state const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight']; -export default class IntersectionObserverArticle extends React.Component { +export default class IntersectionObserverArticle extends Component { static propTypes = { intersectionObserverWrapper: PropTypes.object.isRequired, @@ -115,14 +115,14 @@ export default class IntersectionObserverArticle extends React.Component { data-id={id} tabIndex='0' > - {children && React.cloneElement(children, { hidden: true })} + {children && cloneElement(children, { hidden: true })} ); } return (
- {children && React.cloneElement(children, { hidden: false })} + {children && cloneElement(children, { hidden: false })}
); } diff --git a/app/javascript/mastodon/components/load_gap.js b/app/javascript/mastodon/components/load_gap.js index a44d55d093..ca2077a239 100644 --- a/app/javascript/mastodon/components/load_gap.js +++ b/app/javascript/mastodon/components/load_gap.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; import Icon from 'mastodon/components/icon'; @@ -8,7 +8,7 @@ const messages = defineMessages({ }); export default @injectIntl -class LoadGap extends React.PureComponent { +class LoadGap extends PureComponent { static propTypes = { disabled: PropTypes.bool, diff --git a/app/javascript/mastodon/components/load_more.js b/app/javascript/mastodon/components/load_more.js index 389c3e1e11..f7bd70d7da 100644 --- a/app/javascript/mastodon/components/load_more.js +++ b/app/javascript/mastodon/components/load_more.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -export default class LoadMore extends React.PureComponent { +export default class LoadMore extends PureComponent { static propTypes = { onClick: PropTypes.func, diff --git a/app/javascript/mastodon/components/load_pending.js b/app/javascript/mastodon/components/load_pending.js index 7e27024036..96727c7f93 100644 --- a/app/javascript/mastodon/components/load_pending.js +++ b/app/javascript/mastodon/components/load_pending.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -export default class LoadPending extends React.PureComponent { +export default class LoadPending extends PureComponent { static propTypes = { onClick: PropTypes.func, diff --git a/app/javascript/mastodon/components/loading_indicator.js b/app/javascript/mastodon/components/loading_indicator.js index 33c59d94c0..c3f7a4e9ef 100644 --- a/app/javascript/mastodon/components/loading_indicator.js +++ b/app/javascript/mastodon/components/loading_indicator.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; export const CircularProgress = ({ size, strokeWidth }) => { diff --git a/app/javascript/mastodon/components/logo.js b/app/javascript/mastodon/components/logo.js index d1c7f08a91..26df5753d8 100644 --- a/app/javascript/mastodon/components/logo.js +++ b/app/javascript/mastodon/components/logo.js @@ -1,5 +1,3 @@ -import React from 'react'; - const Logo = () => ( diff --git a/app/javascript/mastodon/components/media_attachments.js b/app/javascript/mastodon/components/media_attachments.js index d27720de41..7ebe743d63 100644 --- a/app/javascript/mastodon/components/media_attachments.js +++ b/app/javascript/mastodon/components/media_attachments.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js index 2e7ce2e608..25d34cb58d 100644 --- a/app/javascript/mastodon/components/media_gallery.js +++ b/app/javascript/mastodon/components/media_gallery.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { is } from 'immutable'; @@ -14,7 +14,7 @@ const messages = defineMessages({ toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: '{number, plural, one {Hide image} other {Hide images}}' }, }); -class Item extends React.PureComponent { +class Item extends PureComponent { static propTypes = { attachment: ImmutablePropTypes.map.isRequired, @@ -221,7 +221,7 @@ class Item extends React.PureComponent { } export default @injectIntl -class MediaGallery extends React.PureComponent { +class MediaGallery extends PureComponent { static propTypes = { sensitive: PropTypes.bool, @@ -255,7 +255,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) { diff --git a/app/javascript/mastodon/components/missing_indicator.js b/app/javascript/mastodon/components/missing_indicator.js index 7b0101bab8..eeb88f6bcd 100644 --- a/app/javascript/mastodon/components/missing_indicator.js +++ b/app/javascript/mastodon/components/missing_indicator.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import illustration from 'mastodon/../images/elephant_ui_disappointed.svg'; diff --git a/app/javascript/mastodon/components/modal_root.js b/app/javascript/mastodon/components/modal_root.js index b894aeaf98..7a23e00055 100644 --- a/app/javascript/mastodon/components/modal_root.js +++ b/app/javascript/mastodon/components/modal_root.js @@ -1,10 +1,10 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import 'wicg-inert'; import { createBrowserHistory } from 'history'; import { multiply } from 'color-blend'; -export default class ModalRoot extends React.PureComponent { +export default class ModalRoot extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -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; diff --git a/app/javascript/mastodon/components/permalink.js b/app/javascript/mastodon/components/permalink.js index b369e98126..285bf0831f 100644 --- a/app/javascript/mastodon/components/permalink.js +++ b/app/javascript/mastodon/components/permalink.js @@ -1,7 +1,7 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; -export default class Permalink extends React.PureComponent { +export default class Permalink extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/mastodon/components/picture_in_picture_placeholder.js b/app/javascript/mastodon/components/picture_in_picture_placeholder.js index 19d15c18b1..ddb818951f 100644 --- a/app/javascript/mastodon/components/picture_in_picture_placeholder.js +++ b/app/javascript/mastodon/components/picture_in_picture_placeholder.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import Icon from 'mastodon/components/icon'; import { removePictureInPicture } from 'mastodon/actions/picture_in_picture'; @@ -7,7 +7,7 @@ import { debounce } from 'lodash'; import { FormattedMessage } from 'react-intl'; export default @connect() -class PictureInPicturePlaceholder extends React.PureComponent { +class PictureInPicturePlaceholder extends PureComponent { static propTypes = { width: PropTypes.number, diff --git a/app/javascript/mastodon/components/poll.js b/app/javascript/mastodon/components/poll.js index 85aa28816c..cb0fe71313 100644 --- a/app/javascript/mastodon/components/poll.js +++ b/app/javascript/mastodon/components/poll.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/components/radio_button.js b/app/javascript/mastodon/components/radio_button.js index 0496fa2868..00894e171c 100644 --- a/app/javascript/mastodon/components/radio_button.js +++ b/app/javascript/mastodon/components/radio_button.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -export default class RadioButton extends React.PureComponent { +export default class RadioButton extends PureComponent { static propTypes = { value: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/components/regeneration_indicator.js b/app/javascript/mastodon/components/regeneration_indicator.js index 52696a4a72..dbefc7a9b9 100644 --- a/app/javascript/mastodon/components/regeneration_indicator.js +++ b/app/javascript/mastodon/components/regeneration_indicator.js @@ -1,4 +1,3 @@ -import React from 'react'; import { FormattedMessage } from 'react-intl'; import illustration from 'mastodon/../images/elephant_ui_working.svg'; diff --git a/app/javascript/mastodon/components/relative_timestamp.js b/app/javascript/mastodon/components/relative_timestamp.js index 5124803392..5b5a998bb5 100644 --- a/app/javascript/mastodon/components/relative_timestamp.js +++ b/app/javascript/mastodon/components/relative_timestamp.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { Component } from 'react'; import { injectIntl, defineMessages } from 'react-intl'; import PropTypes from 'prop-types'; @@ -122,7 +122,7 @@ const timeRemainingString = (intl, date, now, timeGiven = true) => { }; export default @injectIntl -class RelativeTimestamp extends React.Component { +class RelativeTimestamp extends Component { static propTypes = { intl: PropTypes.object.isRequired, @@ -149,7 +149,7 @@ class RelativeTimestamp extends React.Component { this.state.now !== nextState.now; } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { if (this.props.timestamp !== nextProps.timestamp) { this.setState({ now: this.props.intl.now() }); } @@ -159,7 +159,7 @@ class RelativeTimestamp extends React.Component { this._scheduleNextUpdate(this.props, this.state); } - componentWillUpdate (nextProps, nextState) { + UNSAFE_componentWillUpdate (nextProps, nextState) { this._scheduleNextUpdate(nextProps, nextState); } diff --git a/app/javascript/mastodon/components/scrollable_list.js b/app/javascript/mastodon/components/scrollable_list.js index 91d04bf4d8..0d1ee7036c 100644 --- a/app/javascript/mastodon/components/scrollable_list.js +++ b/app/javascript/mastodon/components/scrollable_list.js @@ -1,4 +1,4 @@ -import React, { PureComponent } from 'react'; +import { Children, PureComponent, cloneElement } from 'react'; import ScrollContainer from 'mastodon/containers/scroll_container'; import PropTypes from 'prop-types'; import IntersectionObserverArticleContainer from '../containers/intersection_observer_article_container'; @@ -182,8 +182,8 @@ class ScrollableList extends PureComponent { } getSnapshotBeforeUpdate (prevProps) { - const someItemInserted = React.Children.count(prevProps.children) > 0 && - React.Children.count(prevProps.children) < React.Children.count(this.props.children) && + const someItemInserted = Children.count(prevProps.children) > 0 && + Children.count(prevProps.children) < Children.count(this.props.children) && this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props); const pendingChanged = (prevProps.numPending > 0) !== (this.props.numPending > 0); @@ -291,7 +291,7 @@ class ScrollableList extends PureComponent { render () { const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, emptyMessage, onLoadMore } = this.props; const { fullscreen } = this.state; - const childrenCount = React.Children.count(children); + const childrenCount = Children.count(children); const loadMore = (hasMore && onLoadMore) ? : null; const loadPending = (numPending > 0) ? : null; @@ -317,7 +317,7 @@ class ScrollableList extends PureComponent { {loadPending} - {React.Children.map(this.props.children, (child, index) => ( + {Children.map(this.props.children, (child, index) => ( - {React.cloneElement(child, { + {cloneElement(child, { getScrollPosition: this.getScrollPosition, updateScrollBottom: this.updateScrollBottom, cachedMediaWidth: this.state.cachedMediaWidth, diff --git a/app/javascript/mastodon/components/setting_text.js b/app/javascript/mastodon/components/setting_text.js index a6dde4c0f1..e0f3d42c36 100644 --- a/app/javascript/mastodon/components/setting_text.js +++ b/app/javascript/mastodon/components/setting_text.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -export default class SettingText extends React.PureComponent { +export default class SettingText extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/components/short_number.js b/app/javascript/mastodon/components/short_number.js index 535c17727d..b9fecda689 100644 --- a/app/javascript/mastodon/components/short_number.js +++ b/app/javascript/mastodon/components/short_number.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { memo } from 'react'; import PropTypes from 'prop-types'; import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers'; import { FormattedMessage, FormattedNumber } from 'react-intl'; @@ -114,4 +114,4 @@ ShortNumberCounter.propTypes = { value: PropTypes.arrayOf(PropTypes.number), }; -export default React.memo(ShortNumber); +export default memo(ShortNumber); diff --git a/app/javascript/mastodon/components/skeleton.js b/app/javascript/mastodon/components/skeleton.js index 09093e99c7..72174f6bbe 100644 --- a/app/javascript/mastodon/components/skeleton.js +++ b/app/javascript/mastodon/components/skeleton.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; const Skeleton = ({ width, height }) => ; diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index 4ca3928242..23ea0da186 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import Avatar from './avatar'; diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js index ab8755be04..8d6783e741 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/mastodon/components/status_action_bar.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js index 724165ada0..675a895f35 100644 --- a/app/javascript/mastodon/components/status_content.js +++ b/app/javascript/mastodon/components/status_content.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; @@ -10,7 +10,7 @@ import { autoPlayGif } from 'mastodon/initial_state'; const MAX_HEIGHT = 642; // 20px * 32 (+ 2px padding at the top) -export default class StatusContent extends React.PureComponent { +export default class StatusContent extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js index 35e5749a33..938aac8982 100644 --- a/app/javascript/mastodon/components/status_list.js +++ b/app/javascript/mastodon/components/status_list.js @@ -1,5 +1,4 @@ import { debounce } from 'lodash'; -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import StatusContainer from '../containers/status_container'; diff --git a/app/javascript/mastodon/components/timeline_hint.js b/app/javascript/mastodon/components/timeline_hint.js index fb55a62cca..fac08be054 100644 --- a/app/javascript/mastodon/components/timeline_hint.js +++ b/app/javascript/mastodon/components/timeline_hint.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/containers/account_container.js b/app/javascript/mastodon/containers/account_container.js index 5a5136dd18..f3d3e039c7 100644 --- a/app/javascript/mastodon/containers/account_container.js +++ b/app/javascript/mastodon/containers/account_container.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { makeGetAccount } from '../selectors'; diff --git a/app/javascript/mastodon/containers/admin_component.js b/app/javascript/mastodon/containers/admin_component.js index 816b44bd17..188485d40b 100644 --- a/app/javascript/mastodon/containers/admin_component.js +++ b/app/javascript/mastodon/containers/admin_component.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { IntlProvider, addLocaleData } from 'react-intl'; import { getLocale } from '../locales'; @@ -6,7 +6,7 @@ import { getLocale } from '../locales'; const { localeData, messages } = getLocale(); addLocaleData(localeData); -export default class AdminComponent extends React.PureComponent { +export default class AdminComponent extends PureComponent { static propTypes = { locale: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/containers/compose_container.js b/app/javascript/mastodon/containers/compose_container.js index 7bc7bbaa4d..b0bc1d7378 100644 --- a/app/javascript/mastodon/containers/compose_container.js +++ b/app/javascript/mastodon/containers/compose_container.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; import configureStore from '../store/configureStore'; @@ -20,7 +20,7 @@ if (initialState) { store.dispatch(fetchCustomEmojis()); -export default class TimelineContainer extends React.PureComponent { +export default class TimelineContainer extends PureComponent { static propTypes = { locale: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/containers/domain_container.js b/app/javascript/mastodon/containers/domain_container.js index 8a8ba1df12..806bb81d10 100644 --- a/app/javascript/mastodon/containers/domain_container.js +++ b/app/javascript/mastodon/containers/domain_container.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { blockDomain, unblockDomain } from '../actions/domain_blocks'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/containers/mastodon.js b/app/javascript/mastodon/containers/mastodon.js index 0c3f6afa85..dd0ab74174 100644 --- a/app/javascript/mastodon/containers/mastodon.js +++ b/app/javascript/mastodon/containers/mastodon.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; import configureStore from '../store/configureStore'; @@ -28,7 +28,7 @@ const createIdentityContext = state => ({ accessToken: state.meta.access_token, }); -export default class Mastodon extends React.PureComponent { +export default class Mastodon extends PureComponent { static propTypes = { locale: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/containers/media_container.js b/app/javascript/mastodon/containers/media_container.js index 6ee1f0bd88..393886c587 100644 --- a/app/javascript/mastodon/containers/media_container.js +++ b/app/javascript/mastodon/containers/media_container.js @@ -1,5 +1,5 @@ -import React, { PureComponent, Fragment } from 'react'; -import ReactDOM from 'react-dom'; +import { PureComponent } from 'react'; +import { createPortal } from 'react-dom'; import PropTypes from 'prop-types'; import { IntlProvider, addLocaleData } from 'react-intl'; import { fromJS } from 'immutable'; @@ -74,7 +74,7 @@ export default class MediaContainer extends PureComponent { return ( - + <> {[].map.call(components, (component, i) => { const componentName = component.getAttribute('data-component'); const Component = MEDIA_COMPONENTS[componentName]; @@ -94,7 +94,7 @@ export default class MediaContainer extends PureComponent { }), }); - return ReactDOM.createPortal( + return createPortal( , component, ); @@ -113,7 +113,7 @@ export default class MediaContainer extends PureComponent { /> )} - + ); } diff --git a/app/javascript/mastodon/containers/status_container.js b/app/javascript/mastodon/containers/status_container.js index ef0aca13a6..3a24c23ccf 100644 --- a/app/javascript/mastodon/containers/status_container.js +++ b/app/javascript/mastodon/containers/status_container.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import Status from '../components/status'; import { makeGetStatus, makeGetPictureInPicture } from '../selectors'; diff --git a/app/javascript/mastodon/containers/timeline_container.js b/app/javascript/mastodon/containers/timeline_container.js index ed8095f90e..eefb5f0f22 100644 --- a/app/javascript/mastodon/containers/timeline_container.js +++ b/app/javascript/mastodon/containers/timeline_container.js @@ -1,5 +1,5 @@ -import React, { Fragment } from 'react'; -import ReactDOM from 'react-dom'; +import { PureComponent } from 'react'; +import { createPortal } from 'react-dom'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; import configureStore from '../store/configureStore'; @@ -20,7 +20,7 @@ if (initialState) { store.dispatch(hydrateStore(initialState)); } -export default class TimelineContainer extends React.PureComponent { +export default class TimelineContainer extends PureComponent { static propTypes = { locale: PropTypes.string.isRequired, @@ -46,14 +46,14 @@ export default class TimelineContainer extends React.PureComponent { return ( - + <> {timeline} - {ReactDOM.createPortal( + {createPortal( , document.getElementById('modal-container'), )} - + ); diff --git a/app/javascript/mastodon/features/account/components/account_note.js b/app/javascript/mastodon/features/account/components/account_note.js index 1787ce1abc..81dfd50fac 100644 --- a/app/javascript/mastodon/features/account/components/account_note.js +++ b/app/javascript/mastodon/features/account/components/account_note.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; @@ -10,7 +10,7 @@ const messages = defineMessages({ placeholder: { id: 'account_note.placeholder', defaultMessage: 'Click to add a note' }, }); -class InlineAlert extends React.PureComponent { +class InlineAlert extends PureComponent { static propTypes = { show: PropTypes.bool, @@ -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) { @@ -59,11 +59,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 = {}; diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js index 8e6b9f0634..baba329111 100644 --- a/app/javascript/mastodon/features/account/components/header.js +++ b/app/javascript/mastodon/features/account/components/header.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; @@ -282,10 +281,10 @@ class Header extends ImmutablePureComponent { {!suspended && (
{!hidden && ( - + <> {actionBtn} {bellBtn} - + )} diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.js b/app/javascript/mastodon/features/account_gallery/components/media_item.js index ba7ec46a33..f4cc91970a 100644 --- a/app/javascript/mastodon/features/account_gallery/components/media_item.js +++ b/app/javascript/mastodon/features/account_gallery/components/media_item.js @@ -4,7 +4,6 @@ import Icon from 'mastodon/components/icon'; import { autoPlayGif, displayMedia, useBlurhash } from 'mastodon/initial_state'; import { isIOS } from 'mastodon/is_mobile'; import PropTypes from 'prop-types'; -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/account_gallery/index.js b/app/javascript/mastodon/features/account_gallery/index.js index cc0bfa9baa..2d31965217 100644 --- a/app/javascript/mastodon/features/account_gallery/index.js +++ b/app/javascript/mastodon/features/account_gallery/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/features/account_timeline/components/header.js b/app/javascript/mastodon/features/account_timeline/components/header.js index fab0bc597f..31312e4eee 100644 --- a/app/javascript/mastodon/features/account_timeline/components/header.js +++ b/app/javascript/mastodon/features/account_timeline/components/header.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import InnerHeader from '../../account/components/header'; diff --git a/app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js b/app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js index 6b025596ca..192333dc35 100644 --- a/app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js +++ b/app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { revealAccount } from 'mastodon/actions/accounts'; @@ -14,7 +14,7 @@ const mapDispatchToProps = (dispatch, { accountId }) => ({ }); export default @connect(() => {}, mapDispatchToProps) -class LimitedAccountHint extends React.PureComponent { +class LimitedAccountHint extends PureComponent { static propTypes = { accountId: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/account_timeline/components/moved_note.js b/app/javascript/mastodon/features/account_timeline/components/moved_note.js index 2e32d660f8..48afc9e41d 100644 --- a/app/javascript/mastodon/features/account_timeline/components/moved_note.js +++ b/app/javascript/mastodon/features/account_timeline/components/moved_note.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.js b/app/javascript/mastodon/features/account_timeline/containers/header_container.js index 371794dd75..07dc502ecd 100644 --- a/app/javascript/mastodon/features/account_timeline/containers/header_container.js +++ b/app/javascript/mastodon/features/account_timeline/containers/header_container.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { makeGetAccount, getAccountHidden } from '../../../selectors'; import Header from '../components/header'; diff --git a/app/javascript/mastodon/features/account_timeline/index.js b/app/javascript/mastodon/features/account_timeline/index.js index 5b592c5a76..11599f24f5 100644 --- a/app/javascript/mastodon/features/account_timeline/index.js +++ b/app/javascript/mastodon/features/account_timeline/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/features/audio/index.js b/app/javascript/mastodon/features/audio/index.js index c47f55dd1e..b12de2ed3b 100644 --- a/app/javascript/mastodon/features/audio/index.js +++ b/app/javascript/mastodon/features/audio/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import { formatTime } from 'mastodon/features/video'; @@ -21,7 +21,7 @@ const TICK_SIZE = 10; const PADDING = 180; export default @injectIntl -class Audio extends React.PureComponent { +class Audio extends PureComponent { static propTypes = { src: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/blocks/index.js b/app/javascript/mastodon/features/blocks/index.js index e00f2b60e0..1e87a42c6b 100644 --- a/app/javascript/mastodon/features/blocks/index.js +++ b/app/javascript/mastodon/features/blocks/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -36,7 +35,7 @@ class Blocks extends ImmutablePureComponent { multiColumn: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchBlocks()); } diff --git a/app/javascript/mastodon/features/bookmarked_statuses/index.js b/app/javascript/mastodon/features/bookmarked_statuses/index.js index 8f41b0f951..8e7f9724c7 100644 --- a/app/javascript/mastodon/features/bookmarked_statuses/index.js +++ b/app/javascript/mastodon/features/bookmarked_statuses/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -35,7 +34,7 @@ class Bookmarks extends ImmutablePureComponent { isLoading: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchBookmarkedStatuses()); } diff --git a/app/javascript/mastodon/features/community_timeline/components/column_settings.js b/app/javascript/mastodon/features/community_timeline/components/column_settings.js index 0cb6db8836..03ce451e4d 100644 --- a/app/javascript/mastodon/features/community_timeline/components/column_settings.js +++ b/app/javascript/mastodon/features/community_timeline/components/column_settings.js @@ -1,11 +1,11 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { injectIntl, FormattedMessage } from 'react-intl'; import SettingToggle from '../../notifications/components/setting_toggle'; export default @injectIntl -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/features/community_timeline/index.js b/app/javascript/mastodon/features/community_timeline/index.js index 30f7760486..aaa622d6d0 100644 --- a/app/javascript/mastodon/features/community_timeline/index.js +++ b/app/javascript/mastodon/features/community_timeline/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; @@ -29,7 +29,7 @@ const mapStateToProps = (state, { columnId }) => { export default @connect(mapStateToProps) @injectIntl -class CommunityTimeline extends React.PureComponent { +class CommunityTimeline extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/mastodon/features/compose/components/action_bar.js b/app/javascript/mastodon/features/compose/components/action_bar.js index 4ff0b7b94b..836296fe5f 100644 --- a/app/javascript/mastodon/features/compose/components/action_bar.js +++ b/app/javascript/mastodon/features/compose/components/action_bar.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; @@ -20,7 +20,7 @@ const messages = defineMessages({ }); export default @injectIntl -class ActionBar extends React.PureComponent { +class ActionBar extends PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/features/compose/components/autosuggest_account.js b/app/javascript/mastodon/features/compose/components/autosuggest_account.js index 1451be0e64..30afeb0e5e 100644 --- a/app/javascript/mastodon/features/compose/components/autosuggest_account.js +++ b/app/javascript/mastodon/features/compose/components/autosuggest_account.js @@ -1,4 +1,3 @@ -import React from 'react'; import Avatar from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import ImmutablePropTypes from 'react-immutable-proptypes'; diff --git a/app/javascript/mastodon/features/compose/components/character_counter.js b/app/javascript/mastodon/features/compose/components/character_counter.js index 0ecfc9141d..15fc77bdcd 100644 --- a/app/javascript/mastodon/features/compose/components/character_counter.js +++ b/app/javascript/mastodon/features/compose/components/character_counter.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { length } from 'stringz'; -export default class CharacterCounter extends React.PureComponent { +export default class CharacterCounter extends PureComponent { static propTypes = { text: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index cd10d0edab..96ac744fbf 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -1,4 +1,3 @@ -import React from 'react'; import CharacterCounter from './character_counter'; import Button from '../../../components/button'; import ImmutablePropTypes from 'react-immutable-proptypes'; diff --git a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js index f433e4de9f..5aa5165c19 100644 --- a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js +++ b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components'; @@ -47,7 +47,7 @@ const notFoundFn = () => (
); -class ModifierPickerMenu extends React.PureComponent { +class ModifierPickerMenu extends PureComponent { static propTypes = { active: PropTypes.bool, @@ -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 { @@ -108,7 +108,7 @@ class ModifierPickerMenu extends React.PureComponent { } -class ModifierPicker extends React.PureComponent { +class ModifierPicker extends PureComponent { static propTypes = { active: PropTypes.bool, @@ -145,7 +145,7 @@ class ModifierPicker extends React.PureComponent { } @injectIntl -class EmojiPickerMenu extends React.PureComponent { +class EmojiPickerMenu extends PureComponent { static propTypes = { custom_emojis: ImmutablePropTypes.list, @@ -309,7 +309,7 @@ class EmojiPickerMenu extends React.PureComponent { } export default @injectIntl -class EmojiPickerDropdown extends React.PureComponent { +class EmojiPickerDropdown extends PureComponent { static propTypes = { custom_emojis: ImmutablePropTypes.list, diff --git a/app/javascript/mastodon/features/compose/components/language_dropdown.js b/app/javascript/mastodon/features/compose/components/language_dropdown.js index d76490c775..084980de8c 100644 --- a/app/javascript/mastodon/features/compose/components/language_dropdown.js +++ b/app/javascript/mastodon/features/compose/components/language_dropdown.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; import TextIconButton from './text_icon_button'; @@ -34,7 +34,7 @@ const icons = { const listenerOptions = supportsPassiveEvents ? { passive: true } : false; -class LanguageDropdownMenu extends React.PureComponent { +class LanguageDropdownMenu extends PureComponent { static propTypes = { style: PropTypes.object, @@ -257,7 +257,7 @@ class LanguageDropdownMenu extends React.PureComponent { } export default @injectIntl -class LanguageDropdown extends React.PureComponent { +class LanguageDropdown extends PureComponent { static propTypes = { value: PropTypes.string, diff --git a/app/javascript/mastodon/features/compose/components/navigation_bar.js b/app/javascript/mastodon/features/compose/components/navigation_bar.js index e6ba7d8b73..684e00a340 100644 --- a/app/javascript/mastodon/features/compose/components/navigation_bar.js +++ b/app/javascript/mastodon/features/compose/components/navigation_bar.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ActionBar from './action_bar'; diff --git a/app/javascript/mastodon/features/compose/components/poll_button.js b/app/javascript/mastodon/features/compose/components/poll_button.js index 76f96bfa41..2219277844 100644 --- a/app/javascript/mastodon/features/compose/components/poll_button.js +++ b/app/javascript/mastodon/features/compose/components/poll_button.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import IconButton from '../../../components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; @@ -15,7 +15,7 @@ const iconStyle = { export default @injectIntl -class PollButton extends React.PureComponent { +class PollButton extends PureComponent { static propTypes = { disabled: PropTypes.bool, diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js index db49f90eb4..59891b7883 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.js +++ b/app/javascript/mastodon/features/compose/components/poll_form.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -21,7 +21,7 @@ const messages = defineMessages({ }); @injectIntl -class Option extends React.PureComponent { +class Option extends PureComponent { static propTypes = { title: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js index 1f0e998d36..dc7ef674d8 100644 --- a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js +++ b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; import IconButton from '../../../components/icon_button'; @@ -23,7 +23,7 @@ const messages = defineMessages({ const listenerOptions = supportsPassiveEvents ? { passive: true } : false; -class PrivacyDropdownMenu extends React.PureComponent { +class PrivacyDropdownMenu extends PureComponent { static propTypes = { style: PropTypes.object, @@ -149,7 +149,7 @@ class PrivacyDropdownMenu extends React.PureComponent { } export default @injectIntl -class PrivacyDropdown extends React.PureComponent { +class PrivacyDropdown extends PureComponent { static propTypes = { isUserTouching: PropTypes.func, @@ -231,7 +231,7 @@ class PrivacyDropdown extends React.PureComponent { this.props.onChange(value); } - componentWillMount () { + UNSAFE_componentWillMount () { const { intl: { formatMessage } } = this.props; this.options = [ diff --git a/app/javascript/mastodon/features/compose/components/reply_indicator.js b/app/javascript/mastodon/features/compose/components/reply_indicator.js index 863defb768..051de00be7 100644 --- a/app/javascript/mastodon/features/compose/components/reply_indicator.js +++ b/app/javascript/mastodon/features/compose/components/reply_indicator.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import Avatar from '../../../components/avatar'; diff --git a/app/javascript/mastodon/features/compose/components/search.js b/app/javascript/mastodon/features/compose/components/search.js index 3e36a922be..383781bf5b 100644 --- a/app/javascript/mastodon/features/compose/components/search.js +++ b/app/javascript/mastodon/features/compose/components/search.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Overlay from 'react-overlays/lib/Overlay'; @@ -11,7 +11,7 @@ const messages = defineMessages({ placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }, }); -class SearchPopout extends React.PureComponent { +class SearchPopout extends PureComponent { static propTypes = { style: PropTypes.object, @@ -45,7 +45,7 @@ class SearchPopout extends React.PureComponent { } export default @injectIntl -class Search extends React.PureComponent { +class Search extends PureComponent { static contextTypes = { router: PropTypes.object.isRequired, diff --git a/app/javascript/mastodon/features/compose/components/search_results.js b/app/javascript/mastodon/features/compose/components/search_results.js index e2493a6c6a..81289025db 100644 --- a/app/javascript/mastodon/features/compose/components/search_results.js +++ b/app/javascript/mastodon/features/compose/components/search_results.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/compose/components/text_icon_button.js b/app/javascript/mastodon/features/compose/components/text_icon_button.js index cd644b680e..6350001eee 100644 --- a/app/javascript/mastodon/features/compose/components/text_icon_button.js +++ b/app/javascript/mastodon/features/compose/components/text_icon_button.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; const iconStyle = { @@ -7,7 +7,7 @@ const iconStyle = { width: `${18 * 1.28571429}px`, }; -export default class TextIconButton extends React.PureComponent { +export default class TextIconButton extends PureComponent { static propTypes = { label: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/compose/components/upload.js b/app/javascript/mastodon/features/compose/components/upload.js index 706824dc71..c9a934398d 100644 --- a/app/javascript/mastodon/features/compose/components/upload.js +++ b/app/javascript/mastodon/features/compose/components/upload.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import Motion from '../../ui/util/optional_motion'; diff --git a/app/javascript/mastodon/features/compose/components/upload_button.js b/app/javascript/mastodon/features/compose/components/upload_button.js index 9cb36167a8..e2756fcf86 100644 --- a/app/javascript/mastodon/features/compose/components/upload_button.js +++ b/app/javascript/mastodon/features/compose/components/upload_button.js @@ -1,4 +1,3 @@ -import React from 'react'; import IconButton from '../../../components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/compose/components/upload_form.js b/app/javascript/mastodon/features/compose/components/upload_form.js index c6eac554e6..b07bdbbd64 100644 --- a/app/javascript/mastodon/features/compose/components/upload_form.js +++ b/app/javascript/mastodon/features/compose/components/upload_form.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import UploadProgressContainer from '../containers/upload_progress_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/upload_progress.js b/app/javascript/mastodon/features/compose/components/upload_progress.js index b0bfe0c9a1..5d92e6ed28 100644 --- a/app/javascript/mastodon/features/compose/components/upload_progress.js +++ b/app/javascript/mastodon/features/compose/components/upload_progress.js @@ -1,10 +1,10 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import Icon from 'mastodon/components/icon'; -export default class UploadProgress extends React.PureComponent { +export default class UploadProgress extends PureComponent { static propTypes = { active: PropTypes.bool, diff --git a/app/javascript/mastodon/features/compose/components/warning.js b/app/javascript/mastodon/features/compose/components/warning.js index 803b7f86ab..4947a4e28b 100644 --- a/app/javascript/mastodon/features/compose/components/warning.js +++ b/app/javascript/mastodon/features/compose/components/warning.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; -export default class Warning extends React.PureComponent { +export default class Warning extends PureComponent { static propTypes = { message: PropTypes.node.isRequired, diff --git a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js index 1bcce57310..2a99b2620c 100644 --- a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js +++ b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import classNames from 'classnames'; @@ -30,7 +30,7 @@ const mapDispatchToProps = dispatch => ({ }); -class SensitiveButton extends React.PureComponent { +class SensitiveButton extends PureComponent { static propTypes = { active: PropTypes.bool, diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.js b/app/javascript/mastodon/features/compose/containers/warning_container.js index 571d1d8382..76653f7abe 100644 --- a/app/javascript/mastodon/features/compose/containers/warning_container.js +++ b/app/javascript/mastodon/features/compose/containers/warning_container.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import Warning from '../components/warning'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/features/compose/index.js b/app/javascript/mastodon/features/compose/index.js index 711a559046..c11043a45d 100644 --- a/app/javascript/mastodon/features/compose/index.js +++ b/app/javascript/mastodon/features/compose/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ComposeFormContainer from './containers/compose_form_container'; import NavigationContainer from './containers/navigation_container'; import PropTypes from 'prop-types'; @@ -38,7 +38,7 @@ const mapStateToProps = (state, ownProps) => ({ export default @connect(mapStateToProps) @injectIntl -class Compose extends React.PureComponent { +class Compose extends PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversation.js b/app/javascript/mastodon/features/direct_timeline/components/conversation.js index 77ff2ce7b3..6d6d8c3c6c 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.js +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js b/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js index fd1df72568..5542682858 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js +++ b/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/direct_timeline/index.js b/app/javascript/mastodon/features/direct_timeline/index.js index debb2d721c..1686ecccd2 100644 --- a/app/javascript/mastodon/features/direct_timeline/index.js +++ b/app/javascript/mastodon/features/direct_timeline/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import Column from '../../components/column'; @@ -15,7 +15,7 @@ const messages = defineMessages({ export default @connect() @injectIntl -class DirectTimeline extends React.PureComponent { +class DirectTimeline extends PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/directory/components/account_card.js b/app/javascript/mastodon/features/directory/components/account_card.js index 27ba4e7f40..87a664d552 100644 --- a/app/javascript/mastodon/features/directory/components/account_card.js +++ b/app/javascript/mastodon/features/directory/components/account_card.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/features/directory/index.js b/app/javascript/mastodon/features/directory/index.js index 94d7d1a9c5..9e8090dfdf 100644 --- a/app/javascript/mastodon/features/directory/index.js +++ b/app/javascript/mastodon/features/directory/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; import PropTypes from 'prop-types'; @@ -30,7 +30,7 @@ const mapStateToProps = state => ({ export default @connect(mapStateToProps) @injectIntl -class Directory extends React.PureComponent { +class Directory extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/mastodon/features/domain_blocks/index.js b/app/javascript/mastodon/features/domain_blocks/index.js index edb80aef41..03c9b31b68 100644 --- a/app/javascript/mastodon/features/domain_blocks/index.js +++ b/app/javascript/mastodon/features/domain_blocks/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -35,7 +34,7 @@ class Blocks extends ImmutablePureComponent { multiColumn: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchDomainBlocks()); } diff --git a/app/javascript/mastodon/features/explore/components/story.js b/app/javascript/mastodon/features/explore/components/story.js index 5631280297..977d9eea80 100644 --- a/app/javascript/mastodon/features/explore/components/story.js +++ b/app/javascript/mastodon/features/explore/components/story.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import Blurhash from 'mastodon/components/blurhash'; import { accountsCountRenderer } from 'mastodon/components/hashtag'; @@ -6,7 +6,7 @@ import ShortNumber from 'mastodon/components/short_number'; import Skeleton from 'mastodon/components/skeleton'; import classNames from 'classnames'; -export default class Story extends React.PureComponent { +export default class Story extends PureComponent { static propTypes = { url: PropTypes.string, @@ -38,10 +38,10 @@ export default class Story extends React.PureComponent {
{thumbnail ? ( - + <>
-
+ ) : }
diff --git a/app/javascript/mastodon/features/explore/index.js b/app/javascript/mastodon/features/explore/index.js index 8082f2d99c..18275f868b 100644 --- a/app/javascript/mastodon/features/explore/index.js +++ b/app/javascript/mastodon/features/explore/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; @@ -24,7 +24,7 @@ const mapStateToProps = state => ({ export default @connect(mapStateToProps) @injectIntl -class Explore extends React.PureComponent { +class Explore extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -67,7 +67,7 @@ class Explore extends React.PureComponent { {isSearching ? ( ) : ( - + <>
@@ -81,7 +81,7 @@ class Explore extends React.PureComponent { - + )}
diff --git a/app/javascript/mastodon/features/explore/links.js b/app/javascript/mastodon/features/explore/links.js index 6649fb6e47..c7fc2c3331 100644 --- a/app/javascript/mastodon/features/explore/links.js +++ b/app/javascript/mastodon/features/explore/links.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Story from './components/story'; @@ -12,7 +12,7 @@ const mapStateToProps = state => ({ }); export default @connect(mapStateToProps) -class Links extends React.PureComponent { +class Links extends PureComponent { static propTypes = { links: ImmutablePropTypes.list, diff --git a/app/javascript/mastodon/features/explore/results.js b/app/javascript/mastodon/features/explore/results.js index 1286020f54..1a78436709 100644 --- a/app/javascript/mastodon/features/explore/results.js +++ b/app/javascript/mastodon/features/explore/results.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; @@ -37,7 +37,7 @@ const renderStatuses = (results, onLoadMore) => appendLoadMore('statuses', resul )), onLoadMore); export default @connect(mapStateToProps) -class Results extends React.PureComponent { +class Results extends PureComponent { static propTypes = { results: ImmutablePropTypes.map, @@ -95,7 +95,7 @@ class Results extends React.PureComponent { } return ( - + <>
@@ -106,7 +106,7 @@ class Results extends React.PureComponent {
{isLoading ? : filteredResults}
- + ); } diff --git a/app/javascript/mastodon/features/explore/statuses.js b/app/javascript/mastodon/features/explore/statuses.js index 33e5b41796..023f31264a 100644 --- a/app/javascript/mastodon/features/explore/statuses.js +++ b/app/javascript/mastodon/features/explore/statuses.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import StatusList from 'mastodon/components/status_list'; @@ -14,7 +14,7 @@ const mapStateToProps = state => ({ }); export default @connect(mapStateToProps) -class Statuses extends React.PureComponent { +class Statuses extends PureComponent { static propTypes = { statusIds: ImmutablePropTypes.list, diff --git a/app/javascript/mastodon/features/explore/suggestions.js b/app/javascript/mastodon/features/explore/suggestions.js index 0c6a7ef8a3..f8ea7e1f95 100644 --- a/app/javascript/mastodon/features/explore/suggestions.js +++ b/app/javascript/mastodon/features/explore/suggestions.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import AccountCard from 'mastodon/features/directory/components/account_card'; @@ -12,7 +12,7 @@ const mapStateToProps = state => ({ }); export default @connect(mapStateToProps) -class Suggestions extends React.PureComponent { +class Suggestions extends PureComponent { static propTypes = { isLoading: PropTypes.bool, diff --git a/app/javascript/mastodon/features/explore/tags.js b/app/javascript/mastodon/features/explore/tags.js index c0ad9fc6ec..50f7e7f03a 100644 --- a/app/javascript/mastodon/features/explore/tags.js +++ b/app/javascript/mastodon/features/explore/tags.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { ImmutableHashtag as Hashtag } from 'mastodon/components/hashtag'; @@ -12,7 +12,7 @@ const mapStateToProps = state => ({ }); export default @connect(mapStateToProps) -class Tags extends React.PureComponent { +class Tags extends PureComponent { static propTypes = { hashtags: ImmutablePropTypes.list, diff --git a/app/javascript/mastodon/features/favourited_statuses/index.js b/app/javascript/mastodon/features/favourited_statuses/index.js index 73631946a7..db5157a565 100644 --- a/app/javascript/mastodon/features/favourited_statuses/index.js +++ b/app/javascript/mastodon/features/favourited_statuses/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -35,7 +34,7 @@ class Favourites extends ImmutablePureComponent { isLoading: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchFavouritedStatuses()); } diff --git a/app/javascript/mastodon/features/favourites/index.js b/app/javascript/mastodon/features/favourites/index.js index f060068a49..0452e285a9 100644 --- a/app/javascript/mastodon/features/favourites/index.js +++ b/app/javascript/mastodon/features/favourites/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; @@ -32,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)); } diff --git a/app/javascript/mastodon/features/follow_recommendations/components/account.js b/app/javascript/mastodon/features/follow_recommendations/components/account.js index ffc0ab00cc..5beccef6d1 100644 --- a/app/javascript/mastodon/features/follow_recommendations/components/account.js +++ b/app/javascript/mastodon/features/follow_recommendations/components/account.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/follow_recommendations/index.js b/app/javascript/mastodon/features/follow_recommendations/index.js index b5a71aef5b..6b210dfd32 100644 --- a/app/javascript/mastodon/features/follow_recommendations/index.js +++ b/app/javascript/mastodon/features/follow_recommendations/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -84,7 +83,7 @@ class FollowRecommendations extends ImmutablePureComponent {
{!isLoading && ( - + <>
{suggestions.size > 0 ? suggestions.map(suggestion => ( @@ -99,7 +98,7 @@ class FollowRecommendations extends ImmutablePureComponent {
-
+ )}
diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js b/app/javascript/mastodon/features/follow_requests/components/account_authorize.js index 263a7ae162..bb81cfb2e2 100644 --- a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js +++ b/app/javascript/mastodon/features/follow_requests/components/account_authorize.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Permalink from '../../../components/permalink'; diff --git a/app/javascript/mastodon/features/follow_requests/index.js b/app/javascript/mastodon/features/follow_requests/index.js index 1f9b635bb7..68396645bc 100644 --- a/app/javascript/mastodon/features/follow_requests/index.js +++ b/app/javascript/mastodon/features/follow_requests/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -41,7 +40,7 @@ class FollowRequests extends ImmutablePureComponent { multiColumn: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchFollowRequests()); } diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js index 5b7f402f8d..d180b96dd6 100644 --- a/app/javascript/mastodon/features/followers/index.js +++ b/app/javascript/mastodon/features/followers/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js index 143082d760..a400d79c8e 100644 --- a/app/javascript/mastodon/features/following/index.js +++ b/app/javascript/mastodon/features/following/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/features/generic_not_found/index.js b/app/javascript/mastodon/features/generic_not_found/index.js index 41cd61a5f8..c7f82626e6 100644 --- a/app/javascript/mastodon/features/generic_not_found/index.js +++ b/app/javascript/mastodon/features/generic_not_found/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import Column from '../ui/components/column'; import MissingIndicator from '../../components/missing_indicator'; diff --git a/app/javascript/mastodon/features/getting_started/components/announcements.js b/app/javascript/mastodon/features/getting_started/components/announcements.js index 24db8cedec..567ce4ba5f 100644 --- a/app/javascript/mastodon/features/getting_started/components/announcements.js +++ b/app/javascript/mastodon/features/getting_started/components/announcements.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ReactSwipeableViews from 'react-swipeable-views'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -149,7 +149,7 @@ class Content extends ImmutablePureComponent { } -class Emoji extends React.PureComponent { +class Emoji extends PureComponent { static propTypes = { emoji: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/getting_started/components/trends.js b/app/javascript/mastodon/features/getting_started/components/trends.js index 71c7c458dc..4ea812901d 100644 --- a/app/javascript/mastodon/features/getting_started/components/trends.js +++ b/app/javascript/mastodon/features/getting_started/components/trends.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js index 65cee7498b..e58f7b63c7 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/mastodon/features/getting_started/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import Column from '../ui/components/column'; import ColumnLink from '../ui/components/column_link'; import ColumnSubheading from '../ui/components/column_subheading'; diff --git a/app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js b/app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js index ede8907e50..c375d585ed 100644 --- a/app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js +++ b/app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; @@ -13,7 +13,7 @@ const messages = defineMessages({ }); export default @injectIntl -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/features/hashtag_timeline/index.js b/app/javascript/mastodon/features/hashtag_timeline/index.js index 6a808eb306..10b3358ce2 100644 --- a/app/javascript/mastodon/features/hashtag_timeline/index.js +++ b/app/javascript/mastodon/features/hashtag_timeline/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import StatusListContainer from '../ui/containers/status_list_container'; @@ -16,7 +16,7 @@ const mapStateToProps = (state, props) => ({ }); export default @connect(mapStateToProps) -class HashtagTimeline extends React.PureComponent { +class HashtagTimeline extends PureComponent { disconnects = []; @@ -103,7 +103,7 @@ class HashtagTimeline extends React.PureComponent { dispatch(expandHashtagTimeline(id, { tags, local })); } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { const { dispatch, params } = this.props; const { id, tags, local } = nextProps.params; diff --git a/app/javascript/mastodon/features/home_timeline/components/column_settings.js b/app/javascript/mastodon/features/home_timeline/components/column_settings.js index 455e218817..490ae99b45 100644 --- a/app/javascript/mastodon/features/home_timeline/components/column_settings.js +++ b/app/javascript/mastodon/features/home_timeline/components/column_settings.js @@ -1,11 +1,11 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { injectIntl, FormattedMessage } from 'react-intl'; import SettingToggle from '../../notifications/components/setting_toggle'; export default @injectIntl -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/features/home_timeline/index.js b/app/javascript/mastodon/features/home_timeline/index.js index dc440f2fe0..ff04ddfb38 100644 --- a/app/javascript/mastodon/features/home_timeline/index.js +++ b/app/javascript/mastodon/features/home_timeline/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import { expandHomeTimeline } from '../../actions/timelines'; import PropTypes from 'prop-types'; @@ -30,7 +30,7 @@ const mapStateToProps = state => ({ export default @connect(mapStateToProps) @injectIntl -class HomeTimeline extends React.PureComponent { +class HomeTimeline extends PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/keyboard_shortcuts/index.js b/app/javascript/mastodon/features/keyboard_shortcuts/index.js index 8f1631d829..3072c5d38c 100644 --- a/app/javascript/mastodon/features/keyboard_shortcuts/index.js +++ b/app/javascript/mastodon/features/keyboard_shortcuts/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import Column from '../ui/components/column'; import ColumnBackButtonSlim from '../../components/column_back_button_slim'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/features/list_adder/components/account.js b/app/javascript/mastodon/features/list_adder/components/account.js index 1369aac074..c3468a930e 100644 --- a/app/javascript/mastodon/features/list_adder/components/account.js +++ b/app/javascript/mastodon/features/list_adder/components/account.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/list_adder/components/list.js b/app/javascript/mastodon/features/list_adder/components/list.js index 60c8958a73..88458856dc 100644 --- a/app/javascript/mastodon/features/list_adder/components/list.js +++ b/app/javascript/mastodon/features/list_adder/components/list.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/list_adder/index.js b/app/javascript/mastodon/features/list_adder/index.js index cb8a15e8c7..f3e3415900 100644 --- a/app/javascript/mastodon/features/list_adder/index.js +++ b/app/javascript/mastodon/features/list_adder/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; diff --git a/app/javascript/mastodon/features/list_editor/components/account.js b/app/javascript/mastodon/features/list_editor/components/account.js index 48085af43d..22b41ce81a 100644 --- a/app/javascript/mastodon/features/list_editor/components/account.js +++ b/app/javascript/mastodon/features/list_editor/components/account.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; diff --git a/app/javascript/mastodon/features/list_editor/components/edit_list_form.js b/app/javascript/mastodon/features/list_editor/components/edit_list_form.js index 3ccab12a80..f092a5aa26 100644 --- a/app/javascript/mastodon/features/list_editor/components/edit_list_form.js +++ b/app/javascript/mastodon/features/list_editor/components/edit_list_form.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from '../../../actions/lists'; @@ -21,7 +21,7 @@ const mapDispatchToProps = dispatch => ({ export default @connect(mapStateToProps, mapDispatchToProps) @injectIntl -class ListForm extends React.PureComponent { +class ListForm extends PureComponent { static propTypes = { value: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/list_editor/components/search.js b/app/javascript/mastodon/features/list_editor/components/search.js index e3f069bb80..721fffb021 100644 --- a/app/javascript/mastodon/features/list_editor/components/search.js +++ b/app/javascript/mastodon/features/list_editor/components/search.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; @@ -22,7 +22,7 @@ const mapDispatchToProps = dispatch => ({ export default @connect(mapStateToProps, mapDispatchToProps) @injectIntl -class Search extends React.PureComponent { +class Search extends PureComponent { static propTypes = { intl: PropTypes.object.isRequired, diff --git a/app/javascript/mastodon/features/list_editor/index.js b/app/javascript/mastodon/features/list_editor/index.js index 48466604a7..0e68637f38 100644 --- a/app/javascript/mastodon/features/list_editor/index.js +++ b/app/javascript/mastodon/features/list_editor/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; diff --git a/app/javascript/mastodon/features/list_timeline/index.js b/app/javascript/mastodon/features/list_timeline/index.js index 8010274f88..91fbfeceef 100644 --- a/app/javascript/mastodon/features/list_timeline/index.js +++ b/app/javascript/mastodon/features/list_timeline/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -32,7 +32,7 @@ const mapStateToProps = (state, props) => ({ export default @connect(mapStateToProps) @injectIntl -class ListTimeline extends React.PureComponent { +class ListTimeline extends PureComponent { static contextTypes = { router: PropTypes.object, @@ -78,7 +78,7 @@ class ListTimeline extends React.PureComponent { this.disconnect = dispatch(connectListStream(id)); } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { const { dispatch } = this.props; const { id } = nextProps.params; diff --git a/app/javascript/mastodon/features/lists/components/new_list_form.js b/app/javascript/mastodon/features/lists/components/new_list_form.js index 7faf50be81..acc2d8216e 100644 --- a/app/javascript/mastodon/features/lists/components/new_list_form.js +++ b/app/javascript/mastodon/features/lists/components/new_list_form.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from '../../../actions/lists'; @@ -22,7 +22,7 @@ const mapDispatchToProps = dispatch => ({ export default @connect(mapStateToProps, mapDispatchToProps) @injectIntl -class NewListForm extends React.PureComponent { +class NewListForm extends PureComponent { static propTypes = { value: PropTypes.string.isRequired, diff --git a/app/javascript/mastodon/features/lists/index.js b/app/javascript/mastodon/features/lists/index.js index 809d79d998..de6c8dca1a 100644 --- a/app/javascript/mastodon/features/lists/index.js +++ b/app/javascript/mastodon/features/lists/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -43,7 +42,7 @@ class Lists extends ImmutablePureComponent { multiColumn: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchLists()); } diff --git a/app/javascript/mastodon/features/mutes/index.js b/app/javascript/mastodon/features/mutes/index.js index c21433cc41..75cd1d73d2 100644 --- a/app/javascript/mastodon/features/mutes/index.js +++ b/app/javascript/mastodon/features/mutes/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -36,7 +35,7 @@ class Mutes extends ImmutablePureComponent { multiColumn: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchMutes()); } diff --git a/app/javascript/mastodon/features/notifications/components/clear_column_button.js b/app/javascript/mastodon/features/notifications/components/clear_column_button.js index b82fd092f8..3d73625fe2 100644 --- a/app/javascript/mastodon/features/notifications/components/clear_column_button.js +++ b/app/javascript/mastodon/features/notifications/components/clear_column_button.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import Icon from 'mastodon/components/icon'; -export default class ClearColumnButton extends React.PureComponent { +export default class ClearColumnButton extends PureComponent { static propTypes = { onClick: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/notifications/components/column_settings.js b/app/javascript/mastodon/features/notifications/components/column_settings.js index 61df79b464..5a05a47901 100644 --- a/app/javascript/mastodon/features/notifications/components/column_settings.js +++ b/app/javascript/mastodon/features/notifications/components/column_settings.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; @@ -7,7 +7,7 @@ import GrantPermissionButton from './grant_permission_button'; import SettingToggle from './setting_toggle'; import { isStaff } from 'mastodon/initial_state'; -export default class ColumnSettings extends React.PureComponent { +export default class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/features/notifications/components/filter_bar.js b/app/javascript/mastodon/features/notifications/components/filter_bar.js index 368eb0b7e6..9e9b154cd9 100644 --- a/app/javascript/mastodon/features/notifications/components/filter_bar.js +++ b/app/javascript/mastodon/features/notifications/components/filter_bar.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Icon from 'mastodon/components/icon'; @@ -13,7 +13,7 @@ const tooltips = defineMessages({ }); export default @injectIntl -class FilterBar extends React.PureComponent { +class FilterBar extends PureComponent { static propTypes = { selectFilter: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/notifications/components/follow_request.js b/app/javascript/mastodon/features/notifications/components/follow_request.js index 9ef3fde7eb..548871f451 100644 --- a/app/javascript/mastodon/features/notifications/components/follow_request.js +++ b/app/javascript/mastodon/features/notifications/components/follow_request.js @@ -1,4 +1,3 @@ -import React, { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import Avatar from 'mastodon/components/avatar'; @@ -32,10 +31,10 @@ class FollowRequest extends ImmutablePureComponent { if (hidden) { return ( - + <> {account.get('display_name')} {account.get('username')} - + ); } diff --git a/app/javascript/mastodon/features/notifications/components/grant_permission_button.js b/app/javascript/mastodon/features/notifications/components/grant_permission_button.js index 798e4c7872..06420c9a14 100644 --- a/app/javascript/mastodon/features/notifications/components/grant_permission_button.js +++ b/app/javascript/mastodon/features/notifications/components/grant_permission_button.js @@ -1,8 +1,8 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -export default class GrantPermissionButton extends React.PureComponent { +export default class GrantPermissionButton extends PureComponent { static propTypes = { onClick: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/notifications/components/notification.js b/app/javascript/mastodon/features/notifications/components/notification.js index 0af71418c4..8261cffbb8 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.js +++ b/app/javascript/mastodon/features/notifications/components/notification.js @@ -1,4 +1,3 @@ -import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; import { HotKeys } from 'react-hotkeys'; diff --git a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js index df9b7fb1b8..30a1e17f39 100644 --- a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js +++ b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import Icon from 'mastodon/components/icon'; import Button from 'mastodon/components/button'; import IconButton from 'mastodon/components/icon_button'; @@ -14,7 +14,7 @@ const messages = defineMessages({ export default @connect() @injectIntl -class NotificationsPermissionBanner extends React.PureComponent { +class NotificationsPermissionBanner extends PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/notifications/components/report.js b/app/javascript/mastodon/features/notifications/components/report.js index 3ce3eb9d32..75f87a4a45 100644 --- a/app/javascript/mastodon/features/notifications/components/report.js +++ b/app/javascript/mastodon/features/notifications/components/report.js @@ -1,4 +1,3 @@ -import React, { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; @@ -32,9 +31,9 @@ class Report extends ImmutablePureComponent { if (hidden) { return ( - + <> {report.get('id')} - + ); } diff --git a/app/javascript/mastodon/features/notifications/components/setting_toggle.js b/app/javascript/mastodon/features/notifications/components/setting_toggle.js index c4c8bffbe3..b054b36ff1 100644 --- a/app/javascript/mastodon/features/notifications/components/setting_toggle.js +++ b/app/javascript/mastodon/features/notifications/components/setting_toggle.js @@ -1,9 +1,9 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Toggle from 'react-toggle'; -export default class SettingToggle extends React.PureComponent { +export default class SettingToggle extends PureComponent { static propTypes = { prefix: PropTypes.string, diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js index a6a277d7ed..0f32431850 100644 --- a/app/javascript/mastodon/features/notifications/index.js +++ b/app/javascript/mastodon/features/notifications/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -67,7 +67,7 @@ const mapStateToProps = state => ({ export default @connect(mapStateToProps) @injectIntl -class Notifications extends React.PureComponent { +class Notifications extends PureComponent { static propTypes = { columnId: PropTypes.string, @@ -89,7 +89,7 @@ class Notifications extends React.PureComponent { trackScroll: true, }; - componentWillMount() { + UNSAFE_componentWillMount() { this.props.dispatch(mountNotifications()); } diff --git a/app/javascript/mastodon/features/picture_in_picture/components/footer.js b/app/javascript/mastodon/features/picture_in_picture/components/footer.js index 0cb42b25aa..74a0cf1493 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/footer.js +++ b/app/javascript/mastodon/features/picture_in_picture/components/footer.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; diff --git a/app/javascript/mastodon/features/picture_in_picture/components/header.js b/app/javascript/mastodon/features/picture_in_picture/components/header.js index e05d8c62e9..58c35df6ec 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/header.js +++ b/app/javascript/mastodon/features/picture_in_picture/components/header.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; diff --git a/app/javascript/mastodon/features/picture_in_picture/index.js b/app/javascript/mastodon/features/picture_in_picture/index.js index 1e59fbcd33..76a764c360 100644 --- a/app/javascript/mastodon/features/picture_in_picture/index.js +++ b/app/javascript/mastodon/features/picture_in_picture/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import Video from 'mastodon/features/video'; @@ -12,7 +12,7 @@ const mapStateToProps = state => ({ }); export default @connect(mapStateToProps) -class PictureInPicture extends React.Component { +class PictureInPicture extends Component { static propTypes = { statusId: PropTypes.string, diff --git a/app/javascript/mastodon/features/pinned_statuses/index.js b/app/javascript/mastodon/features/pinned_statuses/index.js index 67b13f10aa..11e90419b7 100644 --- a/app/javascript/mastodon/features/pinned_statuses/index.js +++ b/app/javascript/mastodon/features/pinned_statuses/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -30,7 +29,7 @@ class PinnedStatuses extends ImmutablePureComponent { multiColumn: PropTypes.bool, }; - componentWillMount () { + UNSAFE_componentWillMount () { this.props.dispatch(fetchPinnedStatuses()); } diff --git a/app/javascript/mastodon/features/public_timeline/components/column_settings.js b/app/javascript/mastodon/features/public_timeline/components/column_settings.js index 756b6fe06d..78af8b5e37 100644 --- a/app/javascript/mastodon/features/public_timeline/components/column_settings.js +++ b/app/javascript/mastodon/features/public_timeline/components/column_settings.js @@ -1,11 +1,11 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { injectIntl, FormattedMessage } from 'react-intl'; import SettingToggle from '../../notifications/components/setting_toggle'; export default @injectIntl -class ColumnSettings extends React.PureComponent { +class ColumnSettings extends PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/mastodon/features/public_timeline/index.js b/app/javascript/mastodon/features/public_timeline/index.js index b1d5518af5..8c7a817136 100644 --- a/app/javascript/mastodon/features/public_timeline/index.js +++ b/app/javascript/mastodon/features/public_timeline/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; @@ -31,7 +31,7 @@ const mapStateToProps = (state, { columnId }) => { export default @connect(mapStateToProps) @injectIntl -class PublicTimeline extends React.PureComponent { +class PublicTimeline extends PureComponent { static contextTypes = { router: PropTypes.object, diff --git a/app/javascript/mastodon/features/reblogs/index.js b/app/javascript/mastodon/features/reblogs/index.js index 7704a049f4..21c5a9854d 100644 --- a/app/javascript/mastodon/features/reblogs/index.js +++ b/app/javascript/mastodon/features/reblogs/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; @@ -32,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)); } diff --git a/app/javascript/mastodon/features/report/category.js b/app/javascript/mastodon/features/report/category.js index 9215b3f51e..a2592c9b5e 100644 --- a/app/javascript/mastodon/features/report/category.js +++ b/app/javascript/mastodon/features/report/category.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; @@ -25,7 +25,7 @@ const mapStateToProps = state => ({ export default @connect(mapStateToProps) @injectIntl -class Category extends React.PureComponent { +class Category extends PureComponent { static propTypes = { onNextStep: PropTypes.func.isRequired, @@ -75,7 +75,7 @@ class Category extends React.PureComponent { ]; return ( - + <>

@@ -98,7 +98,7 @@ class Category extends React.PureComponent {
-
+ ); } diff --git a/app/javascript/mastodon/features/report/comment.js b/app/javascript/mastodon/features/report/comment.js index cde1564158..250a2b3d2a 100644 --- a/app/javascript/mastodon/features/report/comment.js +++ b/app/javascript/mastodon/features/report/comment.js @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; import Button from 'mastodon/components/button'; @@ -9,7 +9,7 @@ const messages = defineMessages({ }); export default @injectIntl -class Comment extends React.PureComponent { +class Comment extends PureComponent { static propTypes = { onSubmit: PropTypes.func.isRequired, @@ -48,7 +48,7 @@ class Comment extends React.PureComponent { const { comment, isRemote, forward, domain, isSubmitting, intl } = this.props; return ( - + <>