From 2c894915dc245e192b0f57f0ae4664a915b64b11 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Sun, 7 May 2023 16:10:58 +0900 Subject: [PATCH 001/508] Rewrite VerifiedBadge component as function component (#24892) --- .../mastodon/components/account.jsx | 2 +- .../mastodon/components/verified_badge.jsx | 25 ------------------- .../mastodon/components/verified_badge.tsx | 14 +++++++++++ 3 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 app/javascript/mastodon/components/verified_badge.jsx create mode 100644 app/javascript/mastodon/components/verified_badge.tsx diff --git a/app/javascript/mastodon/components/account.jsx b/app/javascript/mastodon/components/account.jsx index 0e2295e3a9..6a0682e9c1 100644 --- a/app/javascript/mastodon/components/account.jsx +++ b/app/javascript/mastodon/components/account.jsx @@ -151,7 +151,7 @@ class Account extends ImmutablePureComponent { const firstVerifiedField = account.get('fields').find(item => !!item.get('verified_at')); if (firstVerifiedField) { - verification = <>· ; + verification = <>· ; } return ( diff --git a/app/javascript/mastodon/components/verified_badge.jsx b/app/javascript/mastodon/components/verified_badge.jsx deleted file mode 100644 index 3d878d5dd1..0000000000 --- a/app/javascript/mastodon/components/verified_badge.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; - -class VerifiedBadge extends React.PureComponent { - - static propTypes = { - link: PropTypes.string.isRequired, - verifiedAt: PropTypes.string.isRequired, - }; - - render () { - const { link } = this.props; - - return ( - - - - - ); - } - -} - -export default VerifiedBadge; \ No newline at end of file diff --git a/app/javascript/mastodon/components/verified_badge.tsx b/app/javascript/mastodon/components/verified_badge.tsx new file mode 100644 index 0000000000..78686b521b --- /dev/null +++ b/app/javascript/mastodon/components/verified_badge.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { Icon } from './icon'; + +type Props = { + link: string; +}; +export const VerifiedBadge: React.FC = ({ link }) => ( + + + + +); + +export default VerifiedBadge; From daecca565e6b64b16d63dabd54a67cc9cc227506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 15:26:02 +0900 Subject: [PATCH 002/508] Rewrite as FC (#24901) --- app/javascript/mastodon/components/{check.jsx => check.tsx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename app/javascript/mastodon/components/{check.jsx => check.tsx} (89%) diff --git a/app/javascript/mastodon/components/check.jsx b/app/javascript/mastodon/components/check.tsx similarity index 89% rename from app/javascript/mastodon/components/check.jsx rename to app/javascript/mastodon/components/check.tsx index 2fd0af7401..3a4a113205 100644 --- a/app/javascript/mastodon/components/check.jsx +++ b/app/javascript/mastodon/components/check.tsx @@ -1,6 +1,6 @@ import React from 'react'; -const Check = () => ( +export const Check: React.FC = () => ( From 23a97effdbbf95b79335bdf9c4bc83ed868fbfa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:12:13 +0900 Subject: [PATCH 003/508] Rewrite as FC (#24903) --- ...{not_signed_in_indicator.jsx => not_signed_in_indicator.tsx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename app/javascript/mastodon/components/{not_signed_in_indicator.jsx => not_signed_in_indicator.tsx} (86%) diff --git a/app/javascript/mastodon/components/not_signed_in_indicator.jsx b/app/javascript/mastodon/components/not_signed_in_indicator.tsx similarity index 86% rename from app/javascript/mastodon/components/not_signed_in_indicator.jsx rename to app/javascript/mastodon/components/not_signed_in_indicator.tsx index b440c6be2f..0df90ddbf3 100644 --- a/app/javascript/mastodon/components/not_signed_in_indicator.jsx +++ b/app/javascript/mastodon/components/not_signed_in_indicator.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; -const NotSignedInIndicator = () => ( +export const NotSignedInIndicator: React.FC = () => (
From c1ccb55a59e8a7d2618c5c2c2a1b6edb24ade7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:12:44 +0900 Subject: [PATCH 004/508] Rewrite Image component as function component (#24893) --- app/javascript/mastodon/components/image.jsx | 33 -------------------- app/javascript/mastodon/components/image.tsx | 27 ++++++++++++++++ 2 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 app/javascript/mastodon/components/image.jsx create mode 100644 app/javascript/mastodon/components/image.tsx diff --git a/app/javascript/mastodon/components/image.jsx b/app/javascript/mastodon/components/image.jsx deleted file mode 100644 index 6e81ddf082..0000000000 --- a/app/javascript/mastodon/components/image.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import Blurhash from './blurhash'; -import classNames from 'classnames'; - -export default class Image extends React.PureComponent { - - static propTypes = { - src: PropTypes.string, - srcSet: PropTypes.string, - blurhash: PropTypes.string, - className: PropTypes.string, - }; - - state = { - loaded: false, - }; - - handleLoad = () => this.setState({ loaded: true }); - - render () { - const { src, srcSet, blurhash, className } = this.props; - const { loaded } = this.state; - - return ( -
- {blurhash && } - -
- ); - } - -} diff --git a/app/javascript/mastodon/components/image.tsx b/app/javascript/mastodon/components/image.tsx new file mode 100644 index 0000000000..9b4d602255 --- /dev/null +++ b/app/javascript/mastodon/components/image.tsx @@ -0,0 +1,27 @@ +import React, { useCallback, useState } from 'react'; +import Blurhash from './blurhash'; +import classNames from 'classnames'; + +type Props = { + src: string; + srcSet?: string; + blurhash?: string; + className?: string; +} + +export const Image: React.FC = ({ src, srcSet, blurhash, className }) => { + const [loaded, setLoaded] = useState(false); + + const handleLoad = useCallback(() => { + setLoaded(true); + }, [setLoaded]); + + return ( +
+ {blurhash && } + +
+ ); +}; + +export default Image; From 13a16f30543c2207caedf0958f7cc30dfc9c706b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:12:53 +0900 Subject: [PATCH 005/508] Rewrite RadioButton component as FC (#24897) --- .../mastodon/components/radio_button.jsx | 35 ------------------- .../mastodon/components/radio_button.tsx | 30 ++++++++++++++++ 2 files changed, 30 insertions(+), 35 deletions(-) delete mode 100644 app/javascript/mastodon/components/radio_button.jsx create mode 100644 app/javascript/mastodon/components/radio_button.tsx diff --git a/app/javascript/mastodon/components/radio_button.jsx b/app/javascript/mastodon/components/radio_button.jsx deleted file mode 100644 index 0496fa2868..0000000000 --- a/app/javascript/mastodon/components/radio_button.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classNames from 'classnames'; - -export default class RadioButton extends React.PureComponent { - - static propTypes = { - value: PropTypes.string.isRequired, - checked: PropTypes.bool, - name: PropTypes.string.isRequired, - onChange: PropTypes.func.isRequired, - label: PropTypes.node.isRequired, - }; - - render () { - const { name, value, checked, onChange, label } = this.props; - - return ( - - ); - } - -} diff --git a/app/javascript/mastodon/components/radio_button.tsx b/app/javascript/mastodon/components/radio_button.tsx new file mode 100644 index 0000000000..9ba098f78d --- /dev/null +++ b/app/javascript/mastodon/components/radio_button.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import classNames from 'classnames'; + +type Props = { + value: string; + checked: boolean; + name: string; + onChange: (event: React.ChangeEvent) => void; + label: React.ReactNode; +}; + +export const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { + return ( + + ); +}; + +export default RadioButton; From 5f709b16017067b133021cae70a3ae7221dc1a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=9F=E3=81=84=E3=81=A1=20=E3=81=B2?= Date: Mon, 8 May 2023 18:28:36 +0900 Subject: [PATCH 006/508] Add TypeScript support for `mastodon` alias and image imports (#24895) --- .../mastodon/components/hashtag.jsx | 2 -- app/javascript/types/image.d.ts | 34 +++++++++++++++++++ tsconfig.json | 13 +++++-- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 app/javascript/types/image.d.ts diff --git a/app/javascript/mastodon/components/hashtag.jsx b/app/javascript/mastodon/components/hashtag.jsx index 254fae2fe0..d03b1a45a7 100644 --- a/app/javascript/mastodon/components/hashtag.jsx +++ b/app/javascript/mastodon/components/hashtag.jsx @@ -5,9 +5,7 @@ import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Link } from 'react-router-dom'; -// @ts-expect-error import ShortNumber from 'mastodon/components/short_number'; -// @ts-expect-error import Skeleton from 'mastodon/components/skeleton'; import classNames from 'classnames'; diff --git a/app/javascript/types/image.d.ts b/app/javascript/types/image.d.ts new file mode 100644 index 0000000000..8bd6ab0286 --- /dev/null +++ b/app/javascript/types/image.d.ts @@ -0,0 +1,34 @@ +declare module '*.avif' { + const path: string; + export default path; +} + +declare module '*.gif' { + const path: string; + export default path; +} + +declare module '*.jpg' { + const path: string; + export default path; +} + +declare module '*.jpg' { + const path: string; + export default path; +} + +declare module '*.png' { + const path: string; + export default path; +} + +declare module '*.svg' { + const path: string; + export default path; +} + +declare module '*.webp' { + const path: string; + export default path; +} diff --git a/tsconfig.json b/tsconfig.json index 505b19d89b..09cea2a75f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,16 @@ "noEmit": true, "strict": true, "esModuleInterop": true, - "skipLibCheck": true + "skipLibCheck": true, + "baseUrl": "./", + "paths": { + "mastodon": ["app/javascript/mastodon"], + "mastodon/*": ["app/javascript/mastodon/*"] + } }, - "include": ["app/javascript/mastodon", "app/javascript/packs"] + "include": [ + "app/javascript/mastodon", + "app/javascript/packs", + "app/javascript/types" + ] } From 01caf92d80fbaa2d922a4362433a22753ace2755 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Mon, 8 May 2023 22:10:21 +0900 Subject: [PATCH 007/508] Use LayoutType from is_mobile in actions/app (#24863) --- app/javascript/mastodon/actions/app.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/actions/app.ts b/app/javascript/mastodon/actions/app.ts index 0acfbfae7a..50fd317a65 100644 --- a/app/javascript/mastodon/actions/app.ts +++ b/app/javascript/mastodon/actions/app.ts @@ -1,10 +1,11 @@ import { createAction } from '@reduxjs/toolkit'; +import type { LayoutType } from '../is_mobile'; export const focusApp = createAction('APP_FOCUS'); export const unfocusApp = createAction('APP_UNFOCUS'); type ChangeLayoutPayload = { - layout: 'mobile' | 'single-column' | 'multi-column'; + layout: LayoutType; }; export const changeLayout = createAction('APP_LAYOUT_CHANGE'); From 4ab18dee5002208dc74f51f7e6b326edf1f6a95b Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Mon, 8 May 2023 22:12:12 +0900 Subject: [PATCH 008/508] Rewrite Domain component as function component (#24896) --- app/javascript/mastodon/components/domain.jsx | 43 ------------------- app/javascript/mastodon/components/domain.tsx | 42 ++++++++++++++++++ .../mastodon/containers/domain_container.jsx | 2 +- 3 files changed, 43 insertions(+), 44 deletions(-) delete mode 100644 app/javascript/mastodon/components/domain.jsx create mode 100644 app/javascript/mastodon/components/domain.tsx diff --git a/app/javascript/mastodon/components/domain.jsx b/app/javascript/mastodon/components/domain.jsx deleted file mode 100644 index 85ebdbde93..0000000000 --- a/app/javascript/mastodon/components/domain.jsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import IconButton from './icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -const messages = defineMessages({ - unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unblock domain {domain}' }, -}); - -class Account extends ImmutablePureComponent { - - static propTypes = { - domain: PropTypes.string, - onUnblockDomain: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - }; - - handleDomainUnblock = () => { - this.props.onUnblockDomain(this.props.domain); - }; - - render () { - const { domain, intl } = this.props; - - return ( -
-
- - {domain} - - -
- -
-
-
- ); - } - -} - -export default injectIntl(Account); diff --git a/app/javascript/mastodon/components/domain.tsx b/app/javascript/mastodon/components/domain.tsx new file mode 100644 index 0000000000..6cb8f7b8ff --- /dev/null +++ b/app/javascript/mastodon/components/domain.tsx @@ -0,0 +1,42 @@ +import React, { useCallback } from 'react'; +import IconButton from './icon_button'; +import { InjectedIntl, defineMessages, injectIntl } from 'react-intl'; + +const messages = defineMessages({ + unblockDomain: { + id: 'account.unblock_domain', + defaultMessage: 'Unblock domain {domain}', + }, +}); + +type Props = { + domain: string; + onUnblockDomain: (domain: string) => void; + intl: InjectedIntl; +}; +const _Domain: React.FC = ({ domain, onUnblockDomain, intl }) => { + const handleDomainUnblock = useCallback(() => { + onUnblockDomain(domain); + }, [domain, onUnblockDomain]); + + return ( +
+
+ + {domain} + + +
+ +
+
+
+ ); +}; + +export const Domain = injectIntl(_Domain); diff --git a/app/javascript/mastodon/containers/domain_container.jsx b/app/javascript/mastodon/containers/domain_container.jsx index 8a8ba1df12..419d5d29f5 100644 --- a/app/javascript/mastodon/containers/domain_container.jsx +++ b/app/javascript/mastodon/containers/domain_container.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { blockDomain, unblockDomain } from '../actions/domain_blocks'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Domain from '../components/domain'; +import { Domain } from '../components/domain'; import { openModal } from '../actions/modal'; const messages = defineMessages({ From b8d44c55fd9264cdacf66c32541b4343e164bbfb Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:07:13 +0200 Subject: [PATCH 009/508] Mark `wheel` events on scrollable list as passive (#24914) --- app/javascript/mastodon/components/scrollable_list.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/components/scrollable_list.jsx b/app/javascript/mastodon/components/scrollable_list.jsx index 57bc881218..3f4e4a59c6 100644 --- a/app/javascript/mastodon/components/scrollable_list.jsx +++ b/app/javascript/mastodon/components/scrollable_list.jsx @@ -8,6 +8,7 @@ import IntersectionObserverWrapper from '../features/ui/util/intersection_observ import { throttle } from 'lodash'; import { List as ImmutableList } from 'immutable'; import classNames from 'classnames'; +import { supportsPassiveEvents } from 'detect-passive-events'; import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../features/ui/util/fullscreen'; import LoadingIndicator from './loading_indicator'; import { connect } from 'react-redux'; @@ -236,10 +237,10 @@ class ScrollableList extends PureComponent { attachScrollListener () { if (this.props.bindToDocument) { document.addEventListener('scroll', this.handleScroll); - document.addEventListener('wheel', this.handleWheel); + document.addEventListener('wheel', this.handleWheel, supportsPassiveEvents ? { passive: true } : undefined); } else { this.node.addEventListener('scroll', this.handleScroll); - this.node.addEventListener('wheel', this.handleWheel); + this.node.addEventListener('wheel', this.handleWheel, supportsPassiveEvents ? { passive: true } : undefined); } } From 45146e3f3b20b80fa540cf9b9ec86eb562043c92 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:08:47 +0200 Subject: [PATCH 010/508] Dont use CommonJS (`require`, `module.exports`) anywhere (#24913) --- .eslintrc.js | 17 ++++++++++ app/javascript/mastodon/common.js | 2 +- .../features/emoji/emoji_compressed.js | 2 ++ .../features/emoji/emoji_mart_data_light.js | 8 +++-- .../features/emoji/emoji_mart_search_light.js | 2 +- .../emoji/emoji_unicode_mapping_light.js | 15 +++++---- .../mastodon/features/emoji/emoji_utils.js | 2 +- .../features/emoji/unicode_to_filename.js | 3 ++ .../features/emoji/unicode_to_unified_name.js | 3 ++ app/javascript/mastodon/main.jsx | 3 +- app/javascript/mastodon/performance.js | 4 +-- .../service_worker/web_push_locales.js | 3 ++ app/javascript/packs/admin.jsx | 5 ++- app/javascript/packs/mailer.js | 2 +- app/javascript/packs/public.jsx | 32 +++++++++++-------- app/javascript/packs/share.jsx | 15 +++++---- package.json | 2 +- 17 files changed, 79 insertions(+), 41 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8394d98b9c..c888671ceb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -102,6 +102,7 @@ module.exports = { { vars: 'all', args: 'after-used', + destructuredArrayIgnorePattern: '^_', ignoreRestSiblings: true, }, ], @@ -208,6 +209,9 @@ module.exports = { ], }, ], + 'import/no-amd': 'error', + 'import/no-commonjs': 'error', + 'import/no-import-module-exports': 'error', 'import/no-webpack-loader-syntax': 'error', 'promise/always-return': 'off', @@ -255,6 +259,7 @@ module.exports = { '*.config.js', '.*rc.js', 'ide-helper.js', + 'config/webpack/**/*', ], env: { @@ -264,6 +269,10 @@ module.exports = { parserOptions: { sourceType: 'script', }, + + rules: { + 'import/no-commonjs': 'off', + }, }, { files: [ @@ -298,5 +307,13 @@ module.exports = { jest: true, }, }, + { + files: [ + 'streaming/**/*', + ], + rules: { + 'import/no-commonjs': 'off', + }, + }, ], }; diff --git a/app/javascript/mastodon/common.js b/app/javascript/mastodon/common.js index 8f35053036..0ec8449343 100644 --- a/app/javascript/mastodon/common.js +++ b/app/javascript/mastodon/common.js @@ -1,7 +1,7 @@ import Rails from '@rails/ujs'; +import 'font-awesome/css/font-awesome.css'; export function start() { - require('font-awesome/css/font-awesome.css'); require.context('../images/', true); try { diff --git a/app/javascript/mastodon/features/emoji/emoji_compressed.js b/app/javascript/mastodon/features/emoji/emoji_compressed.js index 6a402f2d4b..e1bee1655d 100644 --- a/app/javascript/mastodon/features/emoji/emoji_compressed.js +++ b/app/javascript/mastodon/features/emoji/emoji_compressed.js @@ -1,3 +1,5 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here due to preval */ // @preval // http://www.unicode.org/Public/emoji/5.0/emoji-test.txt // This file contains the compressed version of the emoji data from diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js b/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js index 49813537d7..000aeb0de4 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js @@ -1,8 +1,10 @@ // The output of this module is designed to mimic emoji-mart's // "data" object, such that we can use it for a light version of emoji-mart's // emojiIndex.search functionality. -const { unicodeToUnifiedName } = require('./unicode_to_unified_name'); -const [ shortCodesToEmojiData, skins, categories, short_names ] = require('./emoji_compressed'); +import { unicodeToUnifiedName } from './unicode_to_unified_name'; +import emojiCompressed from './emoji_compressed'; + +const [ shortCodesToEmojiData, skins, categories, short_names ] = emojiCompressed; const emojis = {}; @@ -33,7 +35,7 @@ Object.keys(shortCodesToEmojiData).forEach((shortCode) => { }; }); -module.exports = { +export { emojis, skins, categories, diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js index 70694ab6dd..83e154b0b2 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js @@ -1,7 +1,7 @@ // This code is largely borrowed from: // https://github.com/missive/emoji-mart/blob/5f2ffcc/src/utils/emoji-index.js -import data from './emoji_mart_data_light'; +import * as data from './emoji_mart_data_light'; import { getData, getSanitizedData, uniq, intersect } from './emoji_utils'; let originalPool = {}; diff --git a/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js b/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js index 1a38fde234..30fbd9e349 100644 --- a/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js @@ -2,14 +2,17 @@ // (i.e. the svg filename) and a shortCode intended to be shown // as a "title" attribute in an HTML element (aka tooltip). +import emojiCompressed from './emoji_compressed'; + +import { unicodeToFilename } from './unicode_to_filename'; + const [ shortCodesToEmojiData, - skins, // eslint-disable-line @typescript-eslint/no-unused-vars - categories, // eslint-disable-line @typescript-eslint/no-unused-vars - short_names, // eslint-disable-line @typescript-eslint/no-unused-vars + _skins, + _categories, + _short_names, emojisWithoutShortCodes, -] = require('./emoji_compressed'); -const { unicodeToFilename } = require('./unicode_to_filename'); +] = emojiCompressed; // decompress const unicodeMapping = {}; @@ -32,4 +35,4 @@ Object.keys(shortCodesToEmojiData).forEach((shortCode) => { }); emojisWithoutShortCodes.forEach(emojiMapData => processEmojiMapData(emojiMapData)); -module.exports = unicodeMapping; +export default unicodeMapping; diff --git a/app/javascript/mastodon/features/emoji/emoji_utils.js b/app/javascript/mastodon/features/emoji/emoji_utils.js index be793526d0..83bcc9d82f 100644 --- a/app/javascript/mastodon/features/emoji/emoji_utils.js +++ b/app/javascript/mastodon/features/emoji/emoji_utils.js @@ -1,7 +1,7 @@ // This code is largely borrowed from: // https://github.com/missive/emoji-mart/blob/5f2ffcc/src/utils/index.js -import data from './emoji_mart_data_light'; +import * as data from './emoji_mart_data_light'; const buildSearch = (data) => { const search = []; diff --git a/app/javascript/mastodon/features/emoji/unicode_to_filename.js b/app/javascript/mastodon/features/emoji/unicode_to_filename.js index c75c4cd7d0..3395c77174 100644 --- a/app/javascript/mastodon/features/emoji/unicode_to_filename.js +++ b/app/javascript/mastodon/features/emoji/unicode_to_filename.js @@ -1,3 +1,6 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here as its imported into a preval file (`emoji_compressed.js`) */ + // taken from: // https://github.com/twitter/twemoji/blob/47732c7/twemoji-generator.js#L848-L866 exports.unicodeToFilename = (str) => { diff --git a/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js b/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js index d29550f122..108b911222 100644 --- a/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js +++ b/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js @@ -1,3 +1,6 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here as its imported into a preval file (`emoji_compressed.js`) */ + function padLeft(str, num) { while (str.length < num) { str = '0' + str; diff --git a/app/javascript/mastodon/main.jsx b/app/javascript/mastodon/main.jsx index 88a205dd24..d8654adedb 100644 --- a/app/javascript/mastodon/main.jsx +++ b/app/javascript/mastodon/main.jsx @@ -5,8 +5,7 @@ import Mastodon from 'mastodon/containers/mastodon'; import { store } from 'mastodon/store/configureStore'; import { me } from 'mastodon/initial_state'; import ready from 'mastodon/ready'; - -const perf = require('mastodon/performance'); +import * as perf from 'mastodon/performance'; /** * @returns {Promise} diff --git a/app/javascript/mastodon/performance.js b/app/javascript/mastodon/performance.js index 95cf962d6b..42849c82b1 100644 --- a/app/javascript/mastodon/performance.js +++ b/app/javascript/mastodon/performance.js @@ -2,9 +2,8 @@ // Tools for performance debugging, only enabled in development mode. // Open up Chrome Dev Tools, then Timeline, then User Timing to see output. // Also see config/webpack/loaders/mark.js for the webpack loader marks. -// -let marky; +import * as marky from 'marky'; if (process.env.NODE_ENV === 'development') { if (typeof performance !== 'undefined' && performance.setResourceTimingBufferSize) { @@ -13,7 +12,6 @@ if (process.env.NODE_ENV === 'development') { performance.setResourceTimingBufferSize(Infinity); } - marky = require('marky'); // allows us to easily do e.g. ReactPerf.printWasted() while debugging //window.ReactPerf = require('react-addons-perf'); //window.ReactPerf.start(); diff --git a/app/javascript/mastodon/service_worker/web_push_locales.js b/app/javascript/mastodon/service_worker/web_push_locales.js index 7d713cd378..3912f75c7d 100644 --- a/app/javascript/mastodon/service_worker/web_push_locales.js +++ b/app/javascript/mastodon/service_worker/web_push_locales.js @@ -1,3 +1,6 @@ +/* eslint-disable import/no-commonjs -- + We need to use CommonJS here as its imported into a preval file (`emoji_compressed.js`) */ + /* @preval */ const fs = require('fs'); diff --git a/app/javascript/packs/admin.jsx b/app/javascript/packs/admin.jsx index 038e9b4347..99e903eef3 100644 --- a/app/javascript/packs/admin.jsx +++ b/app/javascript/packs/admin.jsx @@ -1,6 +1,8 @@ import './public-path'; import { delegate } from '@rails/ujs'; import ready from '../mastodon/ready'; +import React from 'react'; +import ReactDOM from 'react-dom'; const setAnnouncementEndsAttributes = (target) => { const valid = target?.value && target?.validity?.valid; @@ -223,9 +225,6 @@ ready(() => { setAnnouncementEndsAttributes(announcementStartsAt); } - const React = require('react'); - const ReactDOM = require('react-dom'); - [].forEach.call(document.querySelectorAll('[data-admin-component]'), element => { const componentName = element.getAttribute('data-admin-component'); const { locale, ...componentProps } = JSON.parse(element.getAttribute('data-props')); diff --git a/app/javascript/packs/mailer.js b/app/javascript/packs/mailer.js index a4b6d54464..a2ad5e73ac 100644 --- a/app/javascript/packs/mailer.js +++ b/app/javascript/packs/mailer.js @@ -1,3 +1,3 @@ -require('../styles/mailer.scss'); +import '../styles/mailer.scss'; require.context('../icons'); diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index 3e832c509e..21c52fc12a 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -1,13 +1,24 @@ import './public-path'; -import escapeTextContentForBrowser from 'escape-html'; import loadPolyfills from '../mastodon/load_polyfills'; -import ready from '../mastodon/ready'; import { start } from '../mastodon/common'; + +import escapeTextContentForBrowser from 'escape-html'; +import ready from '../mastodon/ready'; import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions'; import 'cocoon-js-vanilla'; import axios from 'axios'; import { throttle } from 'lodash'; import { defineMessages } from 'react-intl'; +import * as IntlMessageFormat from 'intl-messageformat'; +import { timeAgoString } from '../mastodon/components/relative_timestamp'; +import { delegate } from '@rails/ujs'; +import * as emojify from '../mastodon/features/emoji/emoji'; +import { getLocale } from '../mastodon/locales'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { createBrowserHistory } from 'history'; + +start(); const messages = defineMessages({ usernameTaken: { id: 'username.taken', defaultMessage: 'That username is taken. Try another' }, @@ -15,8 +26,6 @@ const messages = defineMessages({ passwordDoesNotMatch: { id: 'password_confirmation.mismatching', defaultMessage: 'Password confirmation does not match' }, }); -start(); - window.addEventListener('message', e => { const data = e.data || {}; @@ -33,16 +42,8 @@ window.addEventListener('message', e => { }); }); -function main() { - const IntlMessageFormat = require('intl-messageformat').default; - const { timeAgoString } = require('../mastodon/components/relative_timestamp'); - const { delegate } = require('@rails/ujs'); - const emojify = require('../mastodon/features/emoji/emoji').default; - const { getLocale } = require('../mastodon/locales'); +function loaded() { const { localeData } = getLocale(); - const React = require('react'); - const ReactDOM = require('react-dom'); - const { createBrowserHistory } = require('history'); const scrollToDetailedStatus = () => { const history = createBrowserHistory(); @@ -341,6 +342,11 @@ function main() { }); } + +function main() { + ready(loaded); +} + loadPolyfills() .then(main) .then(loadKeyboardExtensions) diff --git a/app/javascript/packs/share.jsx b/app/javascript/packs/share.jsx index 1225d7b529..97c3c7b0e5 100644 --- a/app/javascript/packs/share.jsx +++ b/app/javascript/packs/share.jsx @@ -1,23 +1,26 @@ import './public-path'; import loadPolyfills from '../mastodon/load_polyfills'; import { start } from '../mastodon/common'; +import ready from '../mastodon/ready'; +import ComposeContainer from '../mastodon/containers/compose_container'; +import React from 'react'; +import ReactDOM from 'react-dom'; start(); function loaded() { - const ComposeContainer = require('../mastodon/containers/compose_container').default; - const React = require('react'); - const ReactDOM = require('react-dom'); const mountNode = document.getElementById('mastodon-compose'); - if (mountNode !== null) { - const props = JSON.parse(mountNode.getAttribute('data-props')); + if (mountNode) { + const attr = mountNode.getAttribute('data-props'); + if(!attr) return; + + const props = JSON.parse(attr); ReactDOM.render(, mountNode); } } function main() { - const ready = require('../mastodon/ready').default; ready(loaded); } diff --git a/package.json b/package.json index 199c956695..f5d7dd09f4 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "jsdom": "^21.1.2", "lodash": "^4.17.21", "mark-loader": "^0.1.6", + "marky": "^1.2.5", "mini-css-extract-plugin": "^1.6.2", "mkdirp": "^2.1.6", "npmlog": "^7.0.1", @@ -192,7 +193,6 @@ "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "lint-staged": "^13.2.2", - "marky": "^1.2.5", "prettier": "^2.8.8", "raf": "^3.4.1", "react-intl-translations-manager": "^5.0.3", From b785500809aeb138eab86ad14c75ed8b1c88badd Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:09:11 +0200 Subject: [PATCH 011/508] Enforce React Rules of Hooks with eslint (#24911) --- .eslintrc.js | 2 ++ app/javascript/mastodon/actions/streaming.js | 2 ++ .../compose/containers/emoji_picker_dropdown_container.js | 1 + .../compose/containers/language_dropdown_container.js | 1 + package.json | 1 + yarn.lock | 5 +++++ 6 files changed, 12 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index c888671ceb..b4d5efd0ee 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,7 @@ module.exports = { extends: [ 'eslint:recommended', 'plugin:react/recommended', + 'plugin:react-hooks/recommended', 'plugin:jsx-a11y/recommended', 'plugin:import/recommended', 'plugin:promise/recommended', @@ -284,6 +285,7 @@ module.exports = { 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react/recommended', + 'plugin:react-hooks/recommended', 'plugin:jsx-a11y/recommended', 'plugin:import/recommended', 'plugin:import/typescript', diff --git a/app/javascript/mastodon/actions/streaming.js b/app/javascript/mastodon/actions/streaming.js index 41cb99e2dd..7831f261e6 100644 --- a/app/javascript/mastodon/actions/streaming.js +++ b/app/javascript/mastodon/actions/streaming.js @@ -52,8 +52,10 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti /** * @param {function(Function, Function): void} fallback */ + const useFallback = fallback => { fallback(dispatch, () => { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook pollingId = setTimeout(() => useFallback(fallback), 20000 + randomUpTo(20000)); }); }; diff --git a/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js b/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js index 5ec937a393..9d9a59c414 100644 --- a/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js +++ b/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js @@ -72,6 +72,7 @@ const mapDispatchToProps = (dispatch, { onPickEmoji }) => ({ }, onPickEmoji: emoji => { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook dispatch(useEmoji(emoji)); if (onPickEmoji) { diff --git a/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js b/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js index 2a040a13f4..5560fe6093 100644 --- a/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js +++ b/app/javascript/mastodon/features/compose/containers/language_dropdown_container.js @@ -26,6 +26,7 @@ const mapDispatchToProps = dispatch => ({ }, onClose (value) { + // eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook dispatch(useLanguage(value)); }, diff --git a/package.json b/package.json index f5d7dd09f4..76deabc26b 100644 --- a/package.json +++ b/package.json @@ -189,6 +189,7 @@ "eslint-plugin-jsx-a11y": "~6.7.1", "eslint-plugin-promise": "~6.1.1", "eslint-plugin-react": "~7.32.2", + "eslint-plugin-react-hooks": "^4.6.0", "husky": "^8.0.3", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", diff --git a/yarn.lock b/yarn.lock index 00c6a64806..3114f26a3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5125,6 +5125,11 @@ eslint-plugin-promise@~6.1.1: resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz#269a3e2772f62875661220631bd4dafcb4083816" integrity sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig== +eslint-plugin-react-hooks@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" + integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== + eslint-plugin-react@~7.32.2: version "7.32.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.32.2.tgz#e71f21c7c265ebce01bcbc9d0955170c55571f10" From cabc9e59799be7effff5d190be0d2f8c576ad2a4 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:10:04 +0200 Subject: [PATCH 012/508] Make Webpack fail on failed imports (#24908) --- config/webpack/shared.js | 1 + 1 file changed, 1 insertion(+) diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 78f660cfcd..037243965f 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -64,6 +64,7 @@ module.exports = { module: { rules: Object.keys(rules).map(key => rules[key]), + strictExportPresence: true, }, plugins: [ From 85b3823e6638719511f705ecdd7e5ba09248cf2f Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 03:11:56 +0200 Subject: [PATCH 013/508] Enforce stricter rules for Typescript files (#24910) --- .eslintrc.js | 6 ++++++ app/javascript/mastodon/actions/markers.js | 2 +- app/javascript/mastodon/actions/notifications.js | 2 +- app/javascript/mastodon/actions/timelines.js | 2 +- app/javascript/mastodon/compare_id.ts | 2 +- .../mastodon/components/__tests__/avatar-test.jsx | 2 +- .../components/__tests__/avatar_overlay-test.jsx | 2 +- app/javascript/mastodon/components/account.jsx | 8 ++++---- app/javascript/mastodon/components/animated_number.tsx | 2 -- app/javascript/mastodon/components/attachment_list.jsx | 2 +- app/javascript/mastodon/components/avatar.tsx | 2 -- .../mastodon/components/avatar_composite.jsx | 2 +- app/javascript/mastodon/components/avatar_overlay.tsx | 2 -- app/javascript/mastodon/components/blurhash.tsx | 10 ++++++---- app/javascript/mastodon/components/check.tsx | 2 -- .../mastodon/components/column_back_button.jsx | 2 +- .../mastodon/components/column_back_button_slim.jsx | 2 +- app/javascript/mastodon/components/column_header.jsx | 2 +- .../mastodon/components/dismissable_banner.jsx | 2 +- app/javascript/mastodon/components/domain.tsx | 2 +- app/javascript/mastodon/components/dropdown_menu.jsx | 2 +- .../mastodon/components/edited_timestamp/index.jsx | 4 ++-- app/javascript/mastodon/components/gifv.tsx | 2 -- app/javascript/mastodon/components/icon.tsx | 2 -- app/javascript/mastodon/components/icon_button.tsx | 2 +- app/javascript/mastodon/components/icon_with_badge.tsx | 4 +--- app/javascript/mastodon/components/image.tsx | 4 +--- app/javascript/mastodon/components/inline_account.jsx | 2 +- app/javascript/mastodon/components/load_gap.jsx | 2 +- app/javascript/mastodon/components/media_gallery.jsx | 4 ++-- .../mastodon/components/not_signed_in_indicator.tsx | 2 -- .../components/picture_in_picture_placeholder.jsx | 2 +- app/javascript/mastodon/components/poll.jsx | 4 ++-- app/javascript/mastodon/components/radio_button.tsx | 2 -- .../mastodon/components/relative_timestamp.tsx | 4 +++- app/javascript/mastodon/components/server_banner.jsx | 2 +- app/javascript/mastodon/components/status.jsx | 8 ++++---- .../mastodon/components/status_action_bar.jsx | 2 +- app/javascript/mastodon/components/status_content.jsx | 2 +- app/javascript/mastodon/components/verified_badge.tsx | 2 -- app/javascript/mastodon/features/about/index.jsx | 4 ++-- .../account/components/follow_request_note.jsx | 2 +- .../mastodon/features/account/components/header.jsx | 6 +++--- .../features/account_gallery/components/media_item.jsx | 4 ++-- .../account_timeline/components/moved_note.jsx | 2 +- app/javascript/mastodon/features/audio/index.jsx | 4 ++-- .../compose/components/autosuggest_account.jsx | 2 +- .../features/compose/components/compose_form.jsx | 2 +- .../features/compose/components/navigation_bar.jsx | 4 ++-- .../features/compose/components/poll_button.jsx | 2 +- .../mastodon/features/compose/components/poll_form.jsx | 4 ++-- .../features/compose/components/privacy_dropdown.jsx | 4 ++-- .../features/compose/components/reply_indicator.jsx | 4 ++-- .../mastodon/features/compose/components/search.jsx | 2 +- .../features/compose/components/search_results.jsx | 2 +- .../mastodon/features/compose/components/upload.jsx | 2 +- .../features/compose/components/upload_button.jsx | 2 +- .../features/compose/components/upload_progress.jsx | 2 +- app/javascript/mastodon/features/compose/index.jsx | 2 +- .../direct_timeline/components/conversation.jsx | 4 ++-- .../features/directory/components/account_card.jsx | 2 +- app/javascript/mastodon/features/directory/index.jsx | 2 +- .../mastodon/features/explore/components/story.jsx | 2 +- app/javascript/mastodon/features/favourites/index.jsx | 2 +- .../mastodon/features/filters/select_filter.jsx | 2 +- .../follow_requests/components/account_authorize.jsx | 4 ++-- .../getting_started/components/announcements.jsx | 6 +++--- .../mastodon/features/hashtag_timeline/index.jsx | 2 +- .../mastodon/features/home_timeline/index.jsx | 4 ++-- .../mastodon/features/interaction_modal/index.jsx | 2 +- .../features/list_adder/components/account.jsx | 2 +- .../mastodon/features/list_adder/components/list.jsx | 4 ++-- .../features/list_editor/components/account.jsx | 4 ++-- .../features/list_editor/components/edit_list_form.jsx | 2 +- .../features/list_editor/components/search.jsx | 2 +- .../mastodon/features/list_timeline/index.jsx | 4 ++-- .../notifications/components/clear_column_button.jsx | 2 +- .../features/notifications/components/filter_bar.jsx | 2 +- .../notifications/components/follow_request.jsx | 4 ++-- .../features/notifications/components/notification.jsx | 2 +- .../components/notifications_permission_banner.jsx | 4 ++-- .../features/notifications/components/report.jsx | 4 ++-- .../mastodon/features/notifications/index.jsx | 6 +++--- .../onboarding/components/progress_indicator.jsx | 4 ++-- .../mastodon/features/onboarding/components/step.jsx | 6 +++--- app/javascript/mastodon/features/onboarding/share.jsx | 4 ++-- .../features/picture_in_picture/components/footer.jsx | 2 +- .../features/picture_in_picture/components/header.jsx | 4 ++-- app/javascript/mastodon/features/reblogs/index.jsx | 2 +- .../mastodon/features/report/components/option.jsx | 2 +- .../features/report/components/status_check_box.jsx | 6 +++--- .../mastodon/features/status/components/action_bar.jsx | 2 +- .../mastodon/features/status/components/card.jsx | 4 ++-- .../features/status/components/detailed_status.jsx | 6 +++--- app/javascript/mastodon/features/status/index.jsx | 2 +- .../features/subscribed_languages_modal/index.jsx | 2 +- .../mastodon/features/ui/components/actions_modal.jsx | 2 +- .../mastodon/features/ui/components/boost_modal.jsx | 6 +++--- .../features/ui/components/bundle_modal_error.jsx | 2 +- .../mastodon/features/ui/components/column_header.jsx | 2 +- .../mastodon/features/ui/components/column_link.jsx | 2 +- .../features/ui/components/compare_history_modal.jsx | 4 ++-- .../mastodon/features/ui/components/embed_modal.jsx | 2 +- .../mastodon/features/ui/components/filter_modal.jsx | 2 +- .../features/ui/components/focal_point_modal.jsx | 4 ++-- .../ui/components/follow_requests_column_link.jsx | 2 +- .../mastodon/features/ui/components/header.jsx | 2 +- .../mastodon/features/ui/components/image_modal.jsx | 2 +- .../mastodon/features/ui/components/media_modal.jsx | 6 +++--- .../ui/components/notifications_counter_icon.js | 2 +- .../mastodon/features/ui/components/report_modal.jsx | 2 +- .../mastodon/features/ui/components/zoomable_image.jsx | 2 +- app/javascript/mastodon/features/video/index.jsx | 4 ++-- app/javascript/mastodon/reducers/compose.js | 2 +- app/javascript/mastodon/reducers/contexts.js | 2 +- app/javascript/mastodon/reducers/conversations.js | 2 +- app/javascript/mastodon/reducers/index.js | 4 ++-- app/javascript/mastodon/reducers/missed_updates.ts | 2 +- app/javascript/mastodon/reducers/notifications.js | 2 +- app/javascript/mastodon/reducers/settings.js | 2 +- app/javascript/mastodon/reducers/timelines.js | 2 +- app/javascript/mastodon/uuid.ts | 2 +- app/javascript/types/image.d.ts | 1 + 123 files changed, 175 insertions(+), 186 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index b4d5efd0ee..2bbe301f04 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -297,6 +297,12 @@ module.exports = { '@typescript-eslint/no-explicit-any': 'off', 'jsdoc/require-jsdoc': 'off', + + // Those rules set stricter rules for TS files + // to enforce better practices when converting from JS + 'import/no-default-export': 'warn', + 'react/prefer-stateless-function': 'warn', + 'react/function-component-definition': ['error', { namedComponents: 'arrow-function' }], }, }, { diff --git a/app/javascript/mastodon/actions/markers.js b/app/javascript/mastodon/actions/markers.js index ca246dce78..b23ecccc39 100644 --- a/app/javascript/mastodon/actions/markers.js +++ b/app/javascript/mastodon/actions/markers.js @@ -1,6 +1,6 @@ import api from '../api'; import { debounce } from 'lodash'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; import { List as ImmutableList } from 'immutable'; export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 93588d3c0c..0c58f8d159 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -13,7 +13,7 @@ import { defineMessages } from 'react-intl'; import { List as ImmutableList } from 'immutable'; import { unescapeHTML } from '../utils/html'; import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; -import compareId from 'mastodon/compare_id'; +import { compareId } from 'mastodon/compare_id'; import { requestNotificationPermission } from '../utils/notifications'; export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index 4f772a55f0..e9e3a8e240 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -2,7 +2,7 @@ import { importFetchedStatus, importFetchedStatuses } from './importer'; import { submitMarkers } from './markers'; import api, { getLinks } from 'mastodon/api'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from 'mastodon/compare_id'; +import { compareId } from 'mastodon/compare_id'; import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; diff --git a/app/javascript/mastodon/compare_id.ts b/app/javascript/mastodon/compare_id.ts index ae4ac6f897..3ddfb76351 100644 --- a/app/javascript/mastodon/compare_id.ts +++ b/app/javascript/mastodon/compare_id.ts @@ -1,4 +1,4 @@ -export default function compareId (id1: string, id2: string) { +export function compareId (id1: string, id2: string) { if (id1 === id2) { return 0; } diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.jsx b/app/javascript/mastodon/components/__tests__/avatar-test.jsx index dd3f7b7d21..5a72fc19a1 100644 --- a/app/javascript/mastodon/components/__tests__/avatar-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar-test.jsx @@ -1,7 +1,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; -import Avatar from '../avatar'; +import { Avatar } from '../avatar'; describe('', () => { const account = fromJS({ diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx index 44addea832..ea75dab574 100644 --- a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx @@ -1,7 +1,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; -import AvatarOverlay from '../avatar_overlay'; +import { AvatarOverlay } from '../avatar_overlay'; describe(' { const account = fromJS({ diff --git a/app/javascript/mastodon/components/account.jsx b/app/javascript/mastodon/components/account.jsx index 6a0682e9c1..b0bbea7ce4 100644 --- a/app/javascript/mastodon/components/account.jsx +++ b/app/javascript/mastodon/components/account.jsx @@ -1,19 +1,19 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from './avatar'; +import { Avatar } from './avatar'; import DisplayName from './display_name'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { me } from '../initial_state'; -import RelativeTimestamp from './relative_timestamp'; +import { RelativeTimestamp } from './relative_timestamp'; import Skeleton from 'mastodon/components/skeleton'; import { Link } from 'react-router-dom'; import { counterRenderer } from 'mastodon/components/common_counter'; import ShortNumber from 'mastodon/components/short_number'; import classNames from 'classnames'; -import VerifiedBadge from 'mastodon/components/verified_badge'; +import { VerifiedBadge } from 'mastodon/components/verified_badge'; const messages = defineMessages({ follow: { id: 'account.follow', defaultMessage: 'Follow' }, diff --git a/app/javascript/mastodon/components/animated_number.tsx b/app/javascript/mastodon/components/animated_number.tsx index 1673ff41bb..20ffa1a4d0 100644 --- a/app/javascript/mastodon/components/animated_number.tsx +++ b/app/javascript/mastodon/components/animated_number.tsx @@ -54,5 +54,3 @@ export const AnimatedNumber: React.FC = ({ ); }; - -export default AnimatedNumber; diff --git a/app/javascript/mastodon/components/attachment_list.jsx b/app/javascript/mastodon/components/attachment_list.jsx index 0e23889ded..3354025c4a 100644 --- a/app/javascript/mastodon/components/attachment_list.jsx +++ b/app/javascript/mastodon/components/attachment_list.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const filename = url => url.split('/').pop().split('#')[0].split('?')[0]; diff --git a/app/javascript/mastodon/components/avatar.tsx b/app/javascript/mastodon/components/avatar.tsx index e64a8af742..8be94d3f53 100644 --- a/app/javascript/mastodon/components/avatar.tsx +++ b/app/javascript/mastodon/components/avatar.tsx @@ -45,5 +45,3 @@ export const Avatar: React.FC = ({
); }; - -export default Avatar; diff --git a/app/javascript/mastodon/components/avatar_composite.jsx b/app/javascript/mastodon/components/avatar_composite.jsx index 220bf5b4f8..e1fae95dc0 100644 --- a/app/javascript/mastodon/components/avatar_composite.jsx +++ b/app/javascript/mastodon/components/avatar_composite.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { autoPlayGif } from '../initial_state'; -import Avatar from './avatar'; +import { Avatar } from './avatar'; export default class AvatarComposite extends React.PureComponent { diff --git a/app/javascript/mastodon/components/avatar_overlay.tsx b/app/javascript/mastodon/components/avatar_overlay.tsx index 5c65a928c5..e8dc88896f 100644 --- a/app/javascript/mastodon/components/avatar_overlay.tsx +++ b/app/javascript/mastodon/components/avatar_overlay.tsx @@ -47,5 +47,3 @@ export const AvatarOverlay: React.FC = ({
); }; - -export default AvatarOverlay; diff --git a/app/javascript/mastodon/components/blurhash.tsx b/app/javascript/mastodon/components/blurhash.tsx index 6fec6e1ef7..181e2183d0 100644 --- a/app/javascript/mastodon/components/blurhash.tsx +++ b/app/javascript/mastodon/components/blurhash.tsx @@ -9,13 +9,13 @@ type Props = { children?: never; [key: string]: any; } -function Blurhash({ +const Blurhash: React.FC = ({ hash, width = 32, height = width, dummy = false, ...canvasProps -}: Props) { +}) => { const canvasRef = useRef(null); useEffect(() => { @@ -40,6 +40,8 @@ function Blurhash({ return ( ); -} +}; -export default React.memo(Blurhash); +const MemoizedBlurhash = React.memo(Blurhash); + +export { MemoizedBlurhash as Blurhash }; diff --git a/app/javascript/mastodon/components/check.tsx b/app/javascript/mastodon/components/check.tsx index 3a4a113205..57b810a0e5 100644 --- a/app/javascript/mastodon/components/check.tsx +++ b/app/javascript/mastodon/components/check.tsx @@ -5,5 +5,3 @@ export const Check: React.FC = () => ( ); - -export default Check; diff --git a/app/javascript/mastodon/components/column_back_button.jsx b/app/javascript/mastodon/components/column_back_button.jsx index faa800b2ad..19e2cb3637 100644 --- a/app/javascript/mastodon/components/column_back_button.jsx +++ b/app/javascript/mastodon/components/column_back_button.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { createPortal } from 'react-dom'; export default class ColumnBackButton extends React.PureComponent { diff --git a/app/javascript/mastodon/components/column_back_button_slim.jsx b/app/javascript/mastodon/components/column_back_button_slim.jsx index 46ac23736b..f2c8642eae 100644 --- a/app/javascript/mastodon/components/column_back_button_slim.jsx +++ b/app/javascript/mastodon/components/column_back_button_slim.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import ColumnBackButton from './column_back_button'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class ColumnBackButtonSlim extends ColumnBackButton { diff --git a/app/javascript/mastodon/components/column_header.jsx b/app/javascript/mastodon/components/column_header.jsx index afc526f27f..794ea9738a 100644 --- a/app/javascript/mastodon/components/column_header.jsx +++ b/app/javascript/mastodon/components/column_header.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { createPortal } from 'react-dom'; import classNames from 'classnames'; import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ show: { id: 'column_header.show_settings', defaultMessage: 'Show settings' }, diff --git a/app/javascript/mastodon/components/dismissable_banner.jsx b/app/javascript/mastodon/components/dismissable_banner.jsx index 242021e764..c433d95324 100644 --- a/app/javascript/mastodon/components/dismissable_banner.jsx +++ b/app/javascript/mastodon/components/dismissable_banner.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; import { bannerSettings } from 'mastodon/settings'; diff --git a/app/javascript/mastodon/components/domain.tsx b/app/javascript/mastodon/components/domain.tsx index 6cb8f7b8ff..af0fec35af 100644 --- a/app/javascript/mastodon/components/domain.tsx +++ b/app/javascript/mastodon/components/domain.tsx @@ -1,5 +1,5 @@ import React, { useCallback } from 'react'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import { InjectedIntl, defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/components/dropdown_menu.jsx b/app/javascript/mastodon/components/dropdown_menu.jsx index eaaa72fd83..0ed3e904f5 100644 --- a/app/javascript/mastodon/components/dropdown_menu.jsx +++ b/app/javascript/mastodon/components/dropdown_menu.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import Overlay from 'react-overlays/Overlay'; import { supportsPassiveEvents } from 'detect-passive-events'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/components/edited_timestamp/index.jsx b/app/javascript/mastodon/components/edited_timestamp/index.jsx index 8a5417a7d9..745d8a4b6f 100644 --- a/app/javascript/mastodon/components/edited_timestamp/index.jsx +++ b/app/javascript/mastodon/components/edited_timestamp/index.jsx @@ -1,11 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, injectIntl } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import DropdownMenu from './containers/dropdown_menu_container'; import { connect } from 'react-redux'; import { openModal } from 'mastodon/actions/modal'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import InlineAccount from 'mastodon/components/inline_account'; const mapDispatchToProps = (dispatch, { statusId }) => ({ diff --git a/app/javascript/mastodon/components/gifv.tsx b/app/javascript/mastodon/components/gifv.tsx index 8968170c5f..5d9f235e11 100644 --- a/app/javascript/mastodon/components/gifv.tsx +++ b/app/javascript/mastodon/components/gifv.tsx @@ -64,5 +64,3 @@ export const GIFV: React.FC = ({ ); }; - -export default GIFV; diff --git a/app/javascript/mastodon/components/icon.tsx b/app/javascript/mastodon/components/icon.tsx index d85fff6ef6..f74437b555 100644 --- a/app/javascript/mastodon/components/icon.tsx +++ b/app/javascript/mastodon/components/icon.tsx @@ -10,5 +10,3 @@ type Props = { } export const Icon: React.FC = ({ id, className, fixedWidth, ...other }) => ; - -export default Icon; diff --git a/app/javascript/mastodon/components/icon_button.tsx b/app/javascript/mastodon/components/icon_button.tsx index ec11ab7011..f9db287bb9 100644 --- a/app/javascript/mastodon/components/icon_button.tsx +++ b/app/javascript/mastodon/components/icon_button.tsx @@ -30,7 +30,7 @@ type States = { activate: boolean, deactivate: boolean, } -export default class IconButton extends React.PureComponent { +export class IconButton extends React.PureComponent { static defaultProps = { size: 18, diff --git a/app/javascript/mastodon/components/icon_with_badge.tsx b/app/javascript/mastodon/components/icon_with_badge.tsx index 487bf326ad..a4af86ca9b 100644 --- a/app/javascript/mastodon/components/icon_with_badge.tsx +++ b/app/javascript/mastodon/components/icon_with_badge.tsx @@ -9,12 +9,10 @@ type Props = { issueBadge: boolean; className: string; } -const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( +export const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( {count > 0 && {formatNumber(count)}} {issueBadge && } ); - -export default IconWithBadge; diff --git a/app/javascript/mastodon/components/image.tsx b/app/javascript/mastodon/components/image.tsx index 9b4d602255..b332d4115b 100644 --- a/app/javascript/mastodon/components/image.tsx +++ b/app/javascript/mastodon/components/image.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useState } from 'react'; -import Blurhash from './blurhash'; +import { Blurhash } from './blurhash'; import classNames from 'classnames'; type Props = { @@ -23,5 +23,3 @@ export const Image: React.FC = ({ src, srcSet, blurhash, className }) => ); }; - -export default Image; diff --git a/app/javascript/mastodon/components/inline_account.jsx b/app/javascript/mastodon/components/inline_account.jsx index 31dc63f93f..ca11f8b1bc 100644 --- a/app/javascript/mastodon/components/inline_account.jsx +++ b/app/javascript/mastodon/components/inline_account.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import { makeGetAccount } from 'mastodon/selectors'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; const makeMapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/mastodon/components/load_gap.jsx b/app/javascript/mastodon/components/load_gap.jsx index 2c91d37be7..2637bdbbc4 100644 --- a/app/javascript/mastodon/components/load_gap.jsx +++ b/app/javascript/mastodon/components/load_gap.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ load_more: { id: 'status.load_more', defaultMessage: 'Load more' }, diff --git a/app/javascript/mastodon/components/media_gallery.jsx b/app/javascript/mastodon/components/media_gallery.jsx index 54470f9402..54b414de20 100644 --- a/app/javascript/mastodon/components/media_gallery.jsx +++ b/app/javascript/mastodon/components/media_gallery.jsx @@ -2,12 +2,12 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { is } from 'immutable'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import { autoPlayGif, cropImages, displayMedia, useBlurhash } from '../initial_state'; import { debounce } from 'lodash'; -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; const messages = defineMessages({ toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: '{number, plural, one {Hide image} other {Hide images}}' }, diff --git a/app/javascript/mastodon/components/not_signed_in_indicator.tsx b/app/javascript/mastodon/components/not_signed_in_indicator.tsx index 0df90ddbf3..3bfee6ae91 100644 --- a/app/javascript/mastodon/components/not_signed_in_indicator.tsx +++ b/app/javascript/mastodon/components/not_signed_in_indicator.tsx @@ -8,5 +8,3 @@ export const NotSignedInIndicator: React.FC = () => ( ); - -export default NotSignedInIndicator; diff --git a/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx b/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx index a51c974017..4763a28d10 100644 --- a/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx +++ b/app/javascript/mastodon/components/picture_in_picture_placeholder.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { removePictureInPicture } from 'mastodon/actions/picture_in_picture'; import { connect } from 'react-redux'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/components/poll.jsx b/app/javascript/mastodon/components/poll.jsx index b9b96a7005..0ccdf472eb 100644 --- a/app/javascript/mastodon/components/poll.jsx +++ b/app/javascript/mastodon/components/poll.jsx @@ -8,8 +8,8 @@ import Motion from 'mastodon/features/ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import escapeTextContentForBrowser from 'escape-html'; import emojify from 'mastodon/features/emoji/emoji'; -import RelativeTimestamp from './relative_timestamp'; -import Icon from 'mastodon/components/icon'; +import { RelativeTimestamp } from './relative_timestamp'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ closed: { diff --git a/app/javascript/mastodon/components/radio_button.tsx b/app/javascript/mastodon/components/radio_button.tsx index 9ba098f78d..194b67afe1 100644 --- a/app/javascript/mastodon/components/radio_button.tsx +++ b/app/javascript/mastodon/components/radio_button.tsx @@ -26,5 +26,3 @@ export const RadioButton: React.FC = ({ name, value, checked, onChange, l ); }; - -export default RadioButton; diff --git a/app/javascript/mastodon/components/relative_timestamp.tsx b/app/javascript/mastodon/components/relative_timestamp.tsx index 89cad06658..4f1a76e54b 100644 --- a/app/javascript/mastodon/components/relative_timestamp.tsx +++ b/app/javascript/mastodon/components/relative_timestamp.tsx @@ -200,4 +200,6 @@ class RelativeTimestamp extends React.Component { } -export default injectIntl(RelativeTimestamp); +const RelativeTimestampWithIntl = injectIntl(RelativeTimestamp); + +export { RelativeTimestampWithIntl as RelativeTimestamp }; diff --git a/app/javascript/mastodon/components/server_banner.jsx b/app/javascript/mastodon/components/server_banner.jsx index e5f5aa8ee2..991907a3f0 100644 --- a/app/javascript/mastodon/components/server_banner.jsx +++ b/app/javascript/mastodon/components/server_banner.jsx @@ -7,7 +7,7 @@ import ShortNumber from 'mastodon/components/short_number'; import Skeleton from 'mastodon/components/skeleton'; import Account from 'mastodon/containers/account_container'; import { domain } from 'mastodon/initial_state'; -import Image from 'mastodon/components/image'; +import { Image } from 'mastodon/components/image'; import { Link } from 'react-router-dom'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx index b5242e7691..3ca840b720 100644 --- a/app/javascript/mastodon/components/status.jsx +++ b/app/javascript/mastodon/components/status.jsx @@ -1,9 +1,9 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from './avatar'; -import AvatarOverlay from './avatar_overlay'; -import RelativeTimestamp from './relative_timestamp'; +import { Avatar } from './avatar'; +import { AvatarOverlay } from './avatar_overlay'; +import { RelativeTimestamp } from './relative_timestamp'; import DisplayName from './display_name'; import StatusContent from './status_content'; import StatusActionBar from './status_action_bar'; @@ -14,7 +14,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import { MediaGallery, Video, Audio } from '../features/ui/util/async-components'; import { HotKeys } from 'react-hotkeys'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { displayMedia } from '../initial_state'; import PictureInPicturePlaceholder from 'mastodon/components/picture_in_picture_placeholder'; diff --git a/app/javascript/mastodon/components/status_action_bar.jsx b/app/javascript/mastodon/components/status_action_bar.jsx index 7b4031b68e..aee9cc19e8 100644 --- a/app/javascript/mastodon/components/status_action_bar.jsx +++ b/app/javascript/mastodon/components/status_action_bar.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import DropdownMenuContainer from '../containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/components/status_content.jsx b/app/javascript/mastodon/components/status_content.jsx index dd589dac6d..cece3ffc25 100644 --- a/app/javascript/mastodon/components/status_content.jsx +++ b/app/javascript/mastodon/components/status_content.jsx @@ -6,7 +6,7 @@ import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import classnames from 'classnames'; import PollContainer from 'mastodon/containers/poll_container'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { autoPlayGif, languages as preloadedLanguages } from 'mastodon/initial_state'; const MAX_HEIGHT = 706; // 22px * 32 (+ 2px padding at the top) diff --git a/app/javascript/mastodon/components/verified_badge.tsx b/app/javascript/mastodon/components/verified_badge.tsx index 78686b521b..da3cab9fe5 100644 --- a/app/javascript/mastodon/components/verified_badge.tsx +++ b/app/javascript/mastodon/components/verified_badge.tsx @@ -10,5 +10,3 @@ export const VerifiedBadge: React.FC = ({ link }) => ( ); - -export default VerifiedBadge; diff --git a/app/javascript/mastodon/features/about/index.jsx b/app/javascript/mastodon/features/about/index.jsx index bb35f3203b..11aff67c67 100644 --- a/app/javascript/mastodon/features/about/index.jsx +++ b/app/javascript/mastodon/features/about/index.jsx @@ -9,9 +9,9 @@ import { Helmet } from 'react-helmet'; import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'mastodon/actions/server'; import Account from 'mastodon/containers/account_container'; import Skeleton from 'mastodon/components/skeleton'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; -import Image from 'mastodon/components/image'; +import { Image } from 'mastodon/components/image'; const messages = defineMessages({ title: { id: 'column.about', defaultMessage: 'About' }, diff --git a/app/javascript/mastodon/features/account/components/follow_request_note.jsx b/app/javascript/mastodon/features/account/components/follow_request_note.jsx index 300ae42660..7972515af5 100644 --- a/app/javascript/mastodon/features/account/components/follow_request_note.jsx +++ b/app/javascript/mastodon/features/account/components/follow_request_note.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class FollowRequestNote extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/account/components/header.jsx b/app/javascript/mastodon/features/account/components/header.jsx index ff8dc5fa9f..bb0982b5e4 100644 --- a/app/javascript/mastodon/features/account/components/header.jsx +++ b/app/javascript/mastodon/features/account/components/header.jsx @@ -6,9 +6,9 @@ import Button from 'mastodon/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { autoPlayGif, me, domain } from 'mastodon/initial_state'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; -import IconButton from 'mastodon/components/icon_button'; -import Avatar from 'mastodon/components/avatar'; +import { Icon } from 'mastodon/components/icon'; +import { IconButton } from 'mastodon/components/icon_button'; +import { Avatar } from 'mastodon/components/avatar'; import { counterRenderer } from 'mastodon/components/common_counter'; import ShortNumber from 'mastodon/components/short_number'; import { NavLink } from 'react-router-dom'; diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.jsx b/app/javascript/mastodon/features/account_gallery/components/media_item.jsx index 00526016d7..9e9b9e6e16 100644 --- a/app/javascript/mastodon/features/account_gallery/components/media_item.jsx +++ b/app/javascript/mastodon/features/account_gallery/components/media_item.jsx @@ -1,6 +1,6 @@ -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { autoPlayGif, displayMedia, useBlurhash } from 'mastodon/initial_state'; import PropTypes from 'prop-types'; import React from 'react'; diff --git a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx b/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx index daff47a9d6..273583c0ad 100644 --- a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx +++ b/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import AvatarOverlay from '../../../components/avatar_overlay'; +import { AvatarOverlay } from '../../../components/avatar_overlay'; import DisplayName from '../../../components/display_name'; import { Link } from 'react-router-dom'; diff --git a/app/javascript/mastodon/features/audio/index.jsx b/app/javascript/mastodon/features/audio/index.jsx index e8fe2c4d9a..56e913ae3a 100644 --- a/app/javascript/mastodon/features/audio/index.jsx +++ b/app/javascript/mastodon/features/audio/index.jsx @@ -2,12 +2,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { formatTime, getPointerPosition, fileNameFromURL } from 'mastodon/features/video'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { throttle, debounce } from 'lodash'; import Visualizer from './visualizer'; import { displayMedia, useBlurhash } from '../../initial_state'; -import Blurhash from '../../components/blurhash'; +import { Blurhash } from '../../components/blurhash'; import { is } from 'immutable'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx b/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx index 1451be0e64..2c92016e86 100644 --- a/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx +++ b/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/compose_form.jsx b/app/javascript/mastodon/features/compose/components/compose_form.jsx index ffcef83c48..3f42cb885e 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.jsx +++ b/app/javascript/mastodon/features/compose/components/compose_form.jsx @@ -19,7 +19,7 @@ import LanguageDropdown from '../containers/language_dropdown_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { length } from 'stringz'; import { countableText } from '../util/counter'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; diff --git a/app/javascript/mastodon/features/compose/components/navigation_bar.jsx b/app/javascript/mastodon/features/compose/components/navigation_bar.jsx index be979af505..b5a7b6bda2 100644 --- a/app/javascript/mastodon/features/compose/components/navigation_bar.jsx +++ b/app/javascript/mastodon/features/compose/components/navigation_bar.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ActionBar from './action_bar'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import { Link } from 'react-router-dom'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/poll_button.jsx b/app/javascript/mastodon/features/compose/components/poll_button.jsx index 6ad689ccc8..5d90564bd1 100644 --- a/app/javascript/mastodon/features/compose/components/poll_button.jsx +++ b/app/javascript/mastodon/features/compose/components/poll_button.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import IconButton from '../../../components/icon_button'; +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/poll_form.jsx b/app/javascript/mastodon/features/compose/components/poll_form.jsx index c0acd7eeb9..33afa3ad48 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.jsx +++ b/app/javascript/mastodon/features/compose/components/poll_form.jsx @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; -import Icon from 'mastodon/components/icon'; +import { IconButton } from 'mastodon/components/icon_button'; +import { Icon } from 'mastodon/components/icon'; import AutosuggestInput from 'mastodon/components/autosuggest_input'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx b/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx index e65c9cb726..ecb7accad9 100644 --- a/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx +++ b/app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx @@ -1,11 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import Overlay from 'react-overlays/Overlay'; import { supportsPassiveEvents } from 'detect-passive-events'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, diff --git a/app/javascript/mastodon/features/compose/components/reply_indicator.jsx b/app/javascript/mastodon/features/compose/components/reply_indicator.jsx index 81de4ea765..68cd7b0804 100644 --- a/app/javascript/mastodon/features/compose/components/reply_indicator.jsx +++ b/app/javascript/mastodon/features/compose/components/reply_indicator.jsx @@ -1,8 +1,8 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from '../../../components/avatar'; -import IconButton from '../../../components/icon_button'; +import { Avatar } from '../../../components/avatar'; +import { IconButton } from '../../../components/icon_button'; import DisplayName from '../../../components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/search.jsx b/app/javascript/mastodon/features/compose/components/search.jsx index 7fff587d68..d20908b9df 100644 --- a/app/javascript/mastodon/features/compose/components/search.jsx +++ b/app/javascript/mastodon/features/compose/components/search.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { searchEnabled } from 'mastodon/initial_state'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { HASHTAG_REGEX } from 'mastodon/utils/hashtags'; diff --git a/app/javascript/mastodon/features/compose/components/search_results.jsx b/app/javascript/mastodon/features/compose/components/search_results.jsx index 8fafd88b07..9a44e2eaf7 100644 --- a/app/javascript/mastodon/features/compose/components/search_results.jsx +++ b/app/javascript/mastodon/features/compose/components/search_results.jsx @@ -6,7 +6,7 @@ import AccountContainer from '../../../containers/account_container'; import StatusContainer from '../../../containers/status_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { ImmutableHashtag as Hashtag } from '../../../components/hashtag'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { searchEnabled } from '../../../initial_state'; import LoadMore from 'mastodon/components/load_more'; diff --git a/app/javascript/mastodon/features/compose/components/upload.jsx b/app/javascript/mastodon/features/compose/components/upload.jsx index e3651c2290..d667f5ef71 100644 --- a/app/javascript/mastodon/features/compose/components/upload.jsx +++ b/app/javascript/mastodon/features/compose/components/upload.jsx @@ -5,7 +5,7 @@ import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class Upload extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/compose/components/upload_button.jsx b/app/javascript/mastodon/features/compose/components/upload_button.jsx index f2e6ff85c3..3870997c3d 100644 --- a/app/javascript/mastodon/features/compose/components/upload_button.jsx +++ b/app/javascript/mastodon/features/compose/components/upload_button.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; diff --git a/app/javascript/mastodon/features/compose/components/upload_progress.jsx b/app/javascript/mastodon/features/compose/components/upload_progress.jsx index cabf520fd9..c5740d9bf5 100644 --- a/app/javascript/mastodon/features/compose/components/upload_progress.jsx +++ b/app/javascript/mastodon/features/compose/components/upload_progress.jsx @@ -2,7 +2,7 @@ import React 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'; +import { Icon } from 'mastodon/components/icon'; import { FormattedMessage } from 'react-intl'; export default class UploadProgress extends React.PureComponent { diff --git a/app/javascript/mastodon/features/compose/index.jsx b/app/javascript/mastodon/features/compose/index.jsx index 6cba1e9ad8..df60d4347e 100644 --- a/app/javascript/mastodon/features/compose/index.jsx +++ b/app/javascript/mastodon/features/compose/index.jsx @@ -14,7 +14,7 @@ import SearchResultsContainer from './containers/search_results_container'; import { openModal } from 'mastodon/actions/modal'; import elephantUIPlane from '../../../images/elephant_ui_plane.svg'; import { mascot } from '../../initial_state'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { logOut } from 'mastodon/utils/log_out'; import Column from 'mastodon/components/column'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx index 11f2790bff..452de11619 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx @@ -8,8 +8,8 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import DropdownMenuContainer from 'mastodon/containers/dropdown_menu_container'; import AvatarComposite from 'mastodon/components/avatar_composite'; import { Link } from 'react-router-dom'; -import IconButton from 'mastodon/components/icon_button'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { IconButton } from 'mastodon/components/icon_button'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import { HotKeys } from 'react-hotkeys'; import { autoPlayGif } from 'mastodon/initial_state'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/directory/components/account_card.jsx b/app/javascript/mastodon/features/directory/components/account_card.jsx index 1cee3a4e4e..4951427151 100644 --- a/app/javascript/mastodon/features/directory/components/account_card.jsx +++ b/app/javascript/mastodon/features/directory/components/account_card.jsx @@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from 'mastodon/selectors'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; import { Link } from 'react-router-dom'; import Button from 'mastodon/components/button'; diff --git a/app/javascript/mastodon/features/directory/index.jsx b/app/javascript/mastodon/features/directory/index.jsx index afaf39b773..d98a0665ac 100644 --- a/app/javascript/mastodon/features/directory/index.jsx +++ b/app/javascript/mastodon/features/directory/index.jsx @@ -9,7 +9,7 @@ import { addColumn, removeColumn, moveColumn, changeColumnParams } from 'mastodo import { fetchDirectory, expandDirectory } from 'mastodon/actions/directory'; import { List as ImmutableList } from 'immutable'; import AccountCard from './components/account_card'; -import RadioButton from 'mastodon/components/radio_button'; +import { RadioButton } from 'mastodon/components/radio_button'; import LoadMore from 'mastodon/components/load_more'; import ScrollContainer from 'mastodon/containers/scroll_container'; import LoadingIndicator from 'mastodon/components/loading_indicator'; diff --git a/app/javascript/mastodon/features/explore/components/story.jsx b/app/javascript/mastodon/features/explore/components/story.jsx index 5631280297..c7320c886d 100644 --- a/app/javascript/mastodon/features/explore/components/story.jsx +++ b/app/javascript/mastodon/features/explore/components/story.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; import { accountsCountRenderer } from 'mastodon/components/hashtag'; import ShortNumber from 'mastodon/components/short_number'; import Skeleton from 'mastodon/components/skeleton'; diff --git a/app/javascript/mastodon/features/favourites/index.jsx b/app/javascript/mastodon/features/favourites/index.jsx index b1e81debd5..4a8c1deb6f 100644 --- a/app/javascript/mastodon/features/favourites/index.jsx +++ b/app/javascript/mastodon/features/favourites/index.jsx @@ -5,7 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import ColumnHeader from 'mastodon/components/column_header'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { fetchFavourites } from 'mastodon/actions/interactions'; import LoadingIndicator from 'mastodon/components/loading_indicator'; import ScrollableList from 'mastodon/components/scrollable_list'; diff --git a/app/javascript/mastodon/features/filters/select_filter.jsx b/app/javascript/mastodon/features/filters/select_filter.jsx index 5778eec8e9..618f875dbe 100644 --- a/app/javascript/mastodon/features/filters/select_filter.jsx +++ b/app/javascript/mastodon/features/filters/select_filter.jsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { toServerSideType } from 'mastodon/utils/filters'; import { loupeIcon, deleteIcon } from 'mastodon/utils/icons'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import fuzzysort from 'fuzzysort'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx b/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx index 0bd45592c9..b370b33ecb 100644 --- a/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx +++ b/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Link } from 'react-router-dom'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/getting_started/components/announcements.jsx b/app/javascript/mastodon/features/getting_started/components/announcements.jsx index 5f993d2c55..ab29e3dc86 100644 --- a/app/javascript/mastodon/features/getting_started/components/announcements.jsx +++ b/app/javascript/mastodon/features/getting_started/components/announcements.jsx @@ -3,15 +3,15 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import ReactSwipeableViews from 'react-swipeable-views'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; -import Icon from 'mastodon/components/icon'; +import { IconButton } from 'mastodon/components/icon_button'; +import { Icon } from 'mastodon/components/icon'; import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from 'react-intl'; import { autoPlayGif, reduceMotion, disableSwiping, mascot } from 'mastodon/initial_state'; import elephantUIPlane from 'mastodon/../images/elephant_ui_plane.svg'; import unicodeMapping from 'mastodon/features/emoji/emoji_unicode_mapping_light'; import classNames from 'classnames'; import EmojiPickerDropdown from 'mastodon/features/compose/containers/emoji_picker_dropdown_container'; -import AnimatedNumber from 'mastodon/components/animated_number'; +import { AnimatedNumber } from 'mastodon/components/animated_number'; import TransitionMotion from 'react-motion/lib/TransitionMotion'; import spring from 'react-motion/lib/spring'; import { assetHost } from 'mastodon/utils/config'; diff --git a/app/javascript/mastodon/features/hashtag_timeline/index.jsx b/app/javascript/mastodon/features/hashtag_timeline/index.jsx index a244dbdb22..116a5921c1 100644 --- a/app/javascript/mastodon/features/hashtag_timeline/index.jsx +++ b/app/javascript/mastodon/features/hashtag_timeline/index.jsx @@ -12,7 +12,7 @@ import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; import { connectHashtagStream } from 'mastodon/actions/streaming'; import { isEqual } from 'lodash'; import { fetchHashtag, followHashtag, unfollowHashtag } from 'mastodon/actions/tags'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/mastodon/features/home_timeline/index.jsx b/app/javascript/mastodon/features/home_timeline/index.jsx index 9aa4c6d821..26166b254c 100644 --- a/app/javascript/mastodon/features/home_timeline/index.jsx +++ b/app/javascript/mastodon/features/home_timeline/index.jsx @@ -12,8 +12,8 @@ import { Link } from 'react-router-dom'; import { fetchAnnouncements, toggleShowAnnouncements } from 'mastodon/actions/announcements'; import AnnouncementsContainer from 'mastodon/features/getting_started/containers/announcements_container'; import classNames from 'classnames'; -import IconWithBadge from 'mastodon/components/icon_with_badge'; -import NotSignedInIndicator from 'mastodon/components/not_signed_in_indicator'; +import { IconWithBadge } from 'mastodon/components/icon_with_badge'; +import { NotSignedInIndicator } from 'mastodon/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/interaction_modal/index.jsx b/app/javascript/mastodon/features/interaction_modal/index.jsx index 5742f11042..f3db2c78d5 100644 --- a/app/javascript/mastodon/features/interaction_modal/index.jsx +++ b/app/javascript/mastodon/features/interaction_modal/index.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen } from 'mastodon/initial_state'; import { connect } from 'react-redux'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; import { openModal, closeModal } from 'mastodon/actions/modal'; diff --git a/app/javascript/mastodon/features/list_adder/components/account.jsx b/app/javascript/mastodon/features/list_adder/components/account.jsx index 786af3bb1c..410f1537a5 100644 --- a/app/javascript/mastodon/features/list_adder/components/account.jsx +++ b/app/javascript/mastodon/features/list_adder/components/account.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import { injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/list_adder/components/list.jsx b/app/javascript/mastodon/features/list_adder/components/list.jsx index 34ccf8451d..954a4a5cfe 100644 --- a/app/javascript/mastodon/features/list_adder/components/list.jsx +++ b/app/javascript/mastodon/features/list_adder/components/list.jsx @@ -3,10 +3,10 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListAdder, addToListAdder } from '../../../actions/lists'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, diff --git a/app/javascript/mastodon/features/list_editor/components/account.jsx b/app/javascript/mastodon/features/list_editor/components/account.jsx index 86209bb3cb..b46d0504a4 100644 --- a/app/javascript/mastodon/features/list_editor/components/account.jsx +++ b/app/javascript/mastodon/features/list_editor/components/account.jsx @@ -4,9 +4,9 @@ import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListEditor, addToListEditor } from '../../../actions/lists'; diff --git a/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx b/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx index 9c1c244cbc..65bfe7f94a 100644 --- a/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx +++ b/app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from '../../../actions/lists'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/list_editor/components/search.jsx b/app/javascript/mastodon/features/list_editor/components/search.jsx index f70e272f79..59e4c7d939 100644 --- a/app/javascript/mastodon/features/list_editor/components/search.jsx +++ b/app/javascript/mastodon/features/list_editor/components/search.jsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; import { fetchListSuggestions, clearListSuggestions, changeListSuggestions } from '../../../actions/lists'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ search: { id: 'lists.search', defaultMessage: 'Search among people you follow' }, diff --git a/app/javascript/mastodon/features/list_timeline/index.jsx b/app/javascript/mastodon/features/list_timeline/index.jsx index 8297c2748d..c93305341a 100644 --- a/app/javascript/mastodon/features/list_timeline/index.jsx +++ b/app/javascript/mastodon/features/list_timeline/index.jsx @@ -11,9 +11,9 @@ import { connectListStream } from 'mastodon/actions/streaming'; import { expandListTimeline } from 'mastodon/actions/timelines'; import Column from 'mastodon/components/column'; import ColumnHeader from 'mastodon/components/column_header'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import LoadingIndicator from 'mastodon/components/loading_indicator'; -import RadioButton from 'mastodon/components/radio_button'; +import { RadioButton } from 'mastodon/components/radio_button'; import StatusListContainer from 'mastodon/features/ui/containers/status_list_container'; import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; diff --git a/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx b/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx index 9a076ce5ed..e043f5ee1e 100644 --- a/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx +++ b/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class ClearColumnButton extends React.PureComponent { diff --git a/app/javascript/mastodon/features/notifications/components/filter_bar.jsx b/app/javascript/mastodon/features/notifications/components/filter_bar.jsx index 88e95cf48f..f16c84f97a 100644 --- a/app/javascript/mastodon/features/notifications/components/filter_bar.jsx +++ b/app/javascript/mastodon/features/notifications/components/filter_bar.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const tooltips = defineMessages({ mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' }, diff --git a/app/javascript/mastodon/features/notifications/components/follow_request.jsx b/app/javascript/mastodon/features/notifications/components/follow_request.jsx index 01bf670650..0d930f0b1f 100644 --- a/app/javascript/mastodon/features/notifications/components/follow_request.jsx +++ b/app/javascript/mastodon/features/notifications/components/follow_request.jsx @@ -1,10 +1,10 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; import { Link } from 'react-router-dom'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/notifications/components/notification.jsx b/app/javascript/mastodon/features/notifications/components/notification.jsx index f3104cee05..0f1aef8db1 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.jsx +++ b/app/javascript/mastodon/features/notifications/components/notification.jsx @@ -9,7 +9,7 @@ import StatusContainer from 'mastodon/containers/status_container'; import AccountContainer from 'mastodon/containers/account_container'; import Report from './report'; import FollowRequestContainer from '../containers/follow_request_container'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { Link } from 'react-router-dom'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx index c54137e60c..a1b4248e7c 100644 --- a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx +++ b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import Button from 'mastodon/components/button'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { requestBrowserPermission } from 'mastodon/actions/notifications'; import { changeSetting } from 'mastodon/actions/settings'; import { connect } from 'react-redux'; diff --git a/app/javascript/mastodon/features/notifications/components/report.jsx b/app/javascript/mastodon/features/notifications/components/report.jsx index a9decdc8e9..1c0e1a7750 100644 --- a/app/javascript/mastodon/features/notifications/components/report.jsx +++ b/app/javascript/mastodon/features/notifications/components/report.jsx @@ -3,8 +3,8 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import AvatarOverlay from 'mastodon/components/avatar_overlay'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { AvatarOverlay } from 'mastodon/components/avatar_overlay'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; const messages = defineMessages({ openReport: { id: 'report_notification.open', defaultMessage: 'Open report' }, diff --git a/app/javascript/mastodon/features/notifications/index.jsx b/app/javascript/mastodon/features/notifications/index.jsx index bb8852abf1..8a31c5db6c 100644 --- a/app/javascript/mastodon/features/notifications/index.jsx +++ b/app/javascript/mastodon/features/notifications/index.jsx @@ -23,10 +23,10 @@ import { List as ImmutableList } from 'immutable'; import { debounce } from 'lodash'; import ScrollableList from '../../components/scrollable_list'; import LoadGap from '../../components/load_gap'; -import Icon from 'mastodon/components/icon'; -import compareId from 'mastodon/compare_id'; +import { Icon } from 'mastodon/components/icon'; +import { compareId } from 'mastodon/compare_id'; import NotificationsPermissionBanner from './components/notifications_permission_banner'; -import NotSignedInIndicator from 'mastodon/components/not_signed_in_indicator'; +import { NotSignedInIndicator } from 'mastodon/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx b/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx index 97134c0c9c..7d75e50edb 100644 --- a/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx +++ b/app/javascript/mastodon/features/onboarding/components/progress_indicator.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Check from 'mastodon/components/check'; +import { Check } from 'mastodon/components/check'; import classNames from 'classnames'; const ProgressIndicator = ({ steps, completed }) => ( @@ -22,4 +22,4 @@ ProgressIndicator.propTypes = { completed: PropTypes.number, }; -export default ProgressIndicator; \ No newline at end of file +export default ProgressIndicator; diff --git a/app/javascript/mastodon/features/onboarding/components/step.jsx b/app/javascript/mastodon/features/onboarding/components/step.jsx index 6f376e5d55..38e4b564a8 100644 --- a/app/javascript/mastodon/features/onboarding/components/step.jsx +++ b/app/javascript/mastodon/features/onboarding/components/step.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; -import Check from 'mastodon/components/check'; +import { Icon } from 'mastodon/components/icon'; +import { Check } from 'mastodon/components/check'; const Step = ({ label, description, icon, completed, onClick, href }) => { const content = ( @@ -47,4 +47,4 @@ Step.propTypes = { onClick: PropTypes.func, }; -export default Step; \ No newline at end of file +export default Step; diff --git a/app/javascript/mastodon/features/onboarding/share.jsx b/app/javascript/mastodon/features/onboarding/share.jsx index 9555a3a43a..5f7cfb8a6b 100644 --- a/app/javascript/mastodon/features/onboarding/share.jsx +++ b/app/javascript/mastodon/features/onboarding/share.jsx @@ -7,7 +7,7 @@ import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage, FormattedHTMLMessage } from 'react-intl'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import ArrowSmallRight from './components/arrow_small_right'; import { Link } from 'react-router-dom'; import SwipeableViews from 'react-swipeable-views'; @@ -190,4 +190,4 @@ class Share extends React.PureComponent { } -export default connect(mapStateToProps)(injectIntl(Share)); \ No newline at end of file +export default connect(mapStateToProps)(injectIntl(Share)); diff --git a/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx b/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx index 66124f3311..5c60284d65 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx +++ b/app/javascript/mastodon/features/picture_in_picture/components/footer.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import classNames from 'classnames'; import { me, boostModal } from 'mastodon/initial_state'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/picture_in_picture/components/header.jsx b/app/javascript/mastodon/features/picture_in_picture/components/header.jsx index 100f9db7ac..c6d2a103dc 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/header.jsx +++ b/app/javascript/mastodon/features/picture_in_picture/components/header.jsx @@ -3,9 +3,9 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { Link } from 'react-router-dom'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/reblogs/index.jsx b/app/javascript/mastodon/features/reblogs/index.jsx index 35edb0d6af..fb503f40f1 100644 --- a/app/javascript/mastodon/features/reblogs/index.jsx +++ b/app/javascript/mastodon/features/reblogs/index.jsx @@ -9,7 +9,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import AccountContainer from '../../containers/account_container'; import Column from '../ui/components/column'; import ScrollableList from '../../components/scrollable_list'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import ColumnHeader from '../../components/column_header'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/mastodon/features/report/components/option.jsx b/app/javascript/mastodon/features/report/components/option.jsx index 342204e22f..34df4d73b3 100644 --- a/app/javascript/mastodon/features/report/components/option.jsx +++ b/app/javascript/mastodon/features/report/components/option.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Check from 'mastodon/components/check'; +import { Check } from 'mastodon/components/check'; export default class Option extends React.PureComponent { diff --git a/app/javascript/mastodon/features/report/components/status_check_box.jsx b/app/javascript/mastodon/features/report/components/status_check_box.jsx index 28d572e898..003cdc8e3a 100644 --- a/app/javascript/mastodon/features/report/components/status_check_box.jsx +++ b/app/javascript/mastodon/features/report/components/status_check_box.jsx @@ -2,13 +2,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import StatusContent from 'mastodon/components/status_content'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import DisplayName from 'mastodon/components/display_name'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import Option from './option'; import MediaAttachments from 'mastodon/components/media_attachments'; import { injectIntl, defineMessages } from 'react-intl'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; const messages = defineMessages({ public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, diff --git a/app/javascript/mastodon/features/status/components/action_bar.jsx b/app/javascript/mastodon/features/status/components/action_bar.jsx index 0c74c4cc4d..e5b08ff285 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.jsx +++ b/app/javascript/mastodon/features/status/components/action_bar.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import ImmutablePropTypes from 'react-immutable-proptypes'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/status/components/card.jsx b/app/javascript/mastodon/features/status/components/card.jsx index 88b38c65ad..1d5edfc173 100644 --- a/app/javascript/mastodon/features/status/components/card.jsx +++ b/app/javascript/mastodon/features/status/components/card.jsx @@ -5,9 +5,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import punycode from 'punycode'; import classnames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { useBlurhash } from 'mastodon/initial_state'; -import Blurhash from 'mastodon/components/blurhash'; +import { Blurhash } from 'mastodon/components/blurhash'; const IDNA_PREFIX = 'xn--'; diff --git a/app/javascript/mastodon/features/status/components/detailed_status.jsx b/app/javascript/mastodon/features/status/components/detailed_status.jsx index e4e5720268..72c9021242 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.jsx +++ b/app/javascript/mastodon/features/status/components/detailed_status.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import StatusContent from '../../../components/status_content'; import MediaGallery from '../../../components/media_gallery'; @@ -13,8 +13,8 @@ import Video from '../../video'; import Audio from '../../audio'; import scheduleIdleTask from '../../ui/util/schedule_idle_task'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; -import AnimatedNumber from 'mastodon/components/animated_number'; +import { Icon } from 'mastodon/components/icon'; +import { AnimatedNumber } from 'mastodon/components/animated_number'; import PictureInPicturePlaceholder from 'mastodon/components/picture_in_picture_placeholder'; import EditedTimestamp from 'mastodon/components/edited_timestamp'; diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index 7f1896aedb..0c0b557487 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -58,7 +58,7 @@ import { HotKeys } from 'react-hotkeys'; import { boostModal, deleteModal } from '../../initial_state'; import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; import { textForScreenReader, defaultMediaVisibility } from '../../components/status'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import { Helmet } from 'react-helmet'; import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error'; diff --git a/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx b/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx index 04fe31b5c1..a9dd1e0720 100644 --- a/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx +++ b/app/javascript/mastodon/features/subscribed_languages_modal/index.jsx @@ -8,7 +8,7 @@ import { is, List as ImmutableList, Set as ImmutableSet } from 'immutable'; import { languages as preloadedLanguages } from 'mastodon/initial_state'; import Option from 'mastodon/features/report/components/option'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import Button from 'mastodon/components/button'; import { followAccount } from 'mastodon/actions/accounts'; diff --git a/app/javascript/mastodon/features/ui/components/actions_modal.jsx b/app/javascript/mastodon/features/ui/components/actions_modal.jsx index 35090e2426..9d11da6085 100644 --- a/app/javascript/mastodon/features/ui/components/actions_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/actions_modal.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import classNames from 'classnames'; export default class ActionsModal extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.jsx b/app/javascript/mastodon/features/ui/components/boost_modal.jsx index fe55c963a8..1f28927d60 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/boost_modal.jsx @@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from '../../../components/button'; import StatusContent from '../../../components/status_content'; -import Avatar from '../../../components/avatar'; -import RelativeTimestamp from '../../../components/relative_timestamp'; +import { Avatar } from '../../../components/avatar'; +import { RelativeTimestamp } from '../../../components/relative_timestamp'; import DisplayName from '../../../components/display_name'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import AttachmentList from 'mastodon/components/attachment_list'; import PrivacyDropdown from 'mastodon/features/compose/components/privacy_dropdown'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx b/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx index d79d0ca4a0..6ddf2ae7ac 100644 --- a/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx +++ b/app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; const messages = defineMessages({ error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' }, diff --git a/app/javascript/mastodon/features/ui/components/column_header.jsx b/app/javascript/mastodon/features/ui/components/column_header.jsx index 4ceef59570..a2d3a38710 100644 --- a/app/javascript/mastodon/features/ui/components/column_header.jsx +++ b/app/javascript/mastodon/features/ui/components/column_header.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; export default class ColumnHeader extends React.PureComponent { diff --git a/app/javascript/mastodon/features/ui/components/column_link.jsx b/app/javascript/mastodon/features/ui/components/column_link.jsx index 8eebbf5260..4e9164afb7 100644 --- a/app/javascript/mastodon/features/ui/components/column_link.jsx +++ b/app/javascript/mastodon/features/ui/components/column_link.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; -import Icon from 'mastodon/components/icon'; +import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; const ColumnLink = ({ icon, text, to, href, method, badge, transparent, ...other }) => { diff --git a/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx b/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx index 1802c167c1..8e4c4d1368 100644 --- a/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/compare_history_modal.jsx @@ -7,8 +7,8 @@ import { closeModal } from 'mastodon/actions/modal'; import emojify from 'mastodon/features/emoji/emoji'; import escapeTextContentForBrowser from 'escape-html'; import InlineAccount from 'mastodon/components/inline_account'; -import IconButton from 'mastodon/components/icon_button'; -import RelativeTimestamp from 'mastodon/components/relative_timestamp'; +import { IconButton } from 'mastodon/components/icon_button'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import MediaAttachments from 'mastodon/components/media_attachments'; const mapStateToProps = (state, { statusId }) => ({ diff --git a/app/javascript/mastodon/features/ui/components/embed_modal.jsx b/app/javascript/mastodon/features/ui/components/embed_modal.jsx index baf6be411f..3e0bcc93cb 100644 --- a/app/javascript/mastodon/features/ui/components/embed_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/embed_modal.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import api from 'mastodon/api'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, diff --git a/app/javascript/mastodon/features/ui/components/filter_modal.jsx b/app/javascript/mastodon/features/ui/components/filter_modal.jsx index 8d77fb3dfe..473fe4b360 100644 --- a/app/javascript/mastodon/features/ui/components/filter_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/filter_modal.jsx @@ -5,7 +5,7 @@ import { fetchFilters, createFilter, createFilterStatus } from 'mastodon/actions import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import SelectFilter from 'mastodon/features/filters/select_filter'; import AddedToFilter from 'mastodon/features/filters/added_to_filter'; diff --git a/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx b/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx index 2a1e4c8bbc..eda550b04d 100644 --- a/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx @@ -7,7 +7,7 @@ import classNames from 'classnames'; import { changeUploadCompose, uploadThumbnail, onChangeMediaDescription, onChangeMediaFocus } from '../../../actions/compose'; import { getPointerPosition } from '../../video'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import Button from 'mastodon/components/button'; import Video from 'mastodon/features/video'; import Audio from 'mastodon/features/audio'; @@ -16,7 +16,7 @@ import UploadProgress from 'mastodon/features/compose/components/upload_progress import CharacterCounter from 'mastodon/features/compose/components/character_counter'; import { length } from 'stringz'; import { Tesseract as fetchTesseract } from 'mastodon/features/ui/util/async-components'; -import GIFV from 'mastodon/components/gifv'; +import { GIFV } from 'mastodon/components/gifv'; import { me } from 'mastodon/initial_state'; // eslint-disable-next-line import/no-extraneous-dependencies import tesseractCorePath from 'tesseract.js-core/tesseract-core.wasm.js'; diff --git a/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx b/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx index 1cd1b79bce..9c8ebd13cd 100644 --- a/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx +++ b/app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { fetchFollowRequests } from 'mastodon/actions/accounts'; import { connect } from 'react-redux'; import ColumnLink from 'mastodon/features/ui/components/column_link'; -import IconWithBadge from 'mastodon/components/icon_with_badge'; +import { IconWithBadge } from 'mastodon/components/icon_with_badge'; import { List as ImmutableList } from 'immutable'; import { injectIntl, defineMessages } from 'react-intl'; diff --git a/app/javascript/mastodon/features/ui/components/header.jsx b/app/javascript/mastodon/features/ui/components/header.jsx index a4def456b4..af18ac3310 100644 --- a/app/javascript/mastodon/features/ui/components/header.jsx +++ b/app/javascript/mastodon/features/ui/components/header.jsx @@ -3,7 +3,7 @@ import { WordmarkLogo, SymbolLogo } from 'mastodon/components/logo'; import { Link, withRouter } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen, me } from 'mastodon/initial_state'; -import Avatar from 'mastodon/components/avatar'; +import { Avatar } from 'mastodon/components/avatar'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { openModal } from 'mastodon/actions/modal'; diff --git a/app/javascript/mastodon/features/ui/components/image_modal.jsx b/app/javascript/mastodon/features/ui/components/image_modal.jsx index ca93d7b4ed..31c5ab37ad 100644 --- a/app/javascript/mastodon/features/ui/components/image_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/image_modal.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import ImageLoader from './image_loader'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/ui/components/media_modal.jsx b/app/javascript/mastodon/features/ui/components/media_modal.jsx index ec6ddc0e11..e8293c2e78 100644 --- a/app/javascript/mastodon/features/ui/components/media_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/media_modal.jsx @@ -6,11 +6,11 @@ import Video from 'mastodon/features/video'; import { connect } from 'react-redux'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImageLoader from './image_loader'; -import Icon from 'mastodon/components/icon'; -import GIFV from 'mastodon/components/gifv'; +import { Icon } from 'mastodon/components/icon'; +import { GIFV } from 'mastodon/components/gifv'; import { disableSwiping } from 'mastodon/initial_state'; import Footer from 'mastodon/features/picture_in_picture/components/footer'; import { getAverageFromBlurhash } from 'mastodon/blurhash'; diff --git a/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js b/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js index da553cd9f0..7ef251603c 100644 --- a/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js +++ b/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import IconWithBadge from 'mastodon/components/icon_with_badge'; +import { IconWithBadge } from 'mastodon/components/icon_with_badge'; const mapStateToProps = state => ({ count: state.getIn(['notifications', 'unread']), diff --git a/app/javascript/mastodon/features/ui/components/report_modal.jsx b/app/javascript/mastodon/features/ui/components/report_modal.jsx index 8b505b8bd8..f3ada9c07b 100644 --- a/app/javascript/mastodon/features/ui/components/report_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/report_modal.jsx @@ -9,7 +9,7 @@ import { makeGetAccount } from 'mastodon/selectors'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { OrderedSet } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import Category from 'mastodon/features/report/category'; import Statuses from 'mastodon/features/report/statuses'; import Rules from 'mastodon/features/report/rules'; diff --git a/app/javascript/mastodon/features/ui/components/zoomable_image.jsx b/app/javascript/mastodon/features/ui/components/zoomable_image.jsx index b41d0fe316..49be6d5c3b 100644 --- a/app/javascript/mastodon/features/ui/components/zoomable_image.jsx +++ b/app/javascript/mastodon/features/ui/components/zoomable_image.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import IconButton from 'mastodon/components/icon_button'; +import { IconButton } from 'mastodon/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/video/index.jsx b/app/javascript/mastodon/features/video/index.jsx index d76d34546b..8b57cf3d10 100644 --- a/app/javascript/mastodon/features/video/index.jsx +++ b/app/javascript/mastodon/features/video/index.jsx @@ -6,8 +6,8 @@ import { throttle } from 'lodash'; import classNames from 'classnames'; import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen'; import { displayMedia, useBlurhash } from '../../initial_state'; -import Icon from 'mastodon/components/icon'; -import Blurhash from 'mastodon/components/blurhash'; +import { Icon } from 'mastodon/components/icon'; +import { Blurhash } from 'mastodon/components/blurhash'; const messages = defineMessages({ play: { id: 'video.play', defaultMessage: 'Play' }, diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 65f439e03c..3e750c4cfa 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -52,7 +52,7 @@ import { TIMELINE_DELETE } from '../actions/timelines'; import { STORE_HYDRATE } from '../actions/store'; import { REDRAFT } from '../actions/statuses'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; import { me } from '../initial_state'; import { unescapeHTML } from '../utils/html'; diff --git a/app/javascript/mastodon/reducers/contexts.js b/app/javascript/mastodon/reducers/contexts.js index 7aa95b5d50..8772e175ea 100644 --- a/app/javascript/mastodon/reducers/contexts.js +++ b/app/javascript/mastodon/reducers/contexts.js @@ -5,7 +5,7 @@ import { import { CONTEXT_FETCH_SUCCESS } from '../actions/statuses'; import { TIMELINE_DELETE, TIMELINE_UPDATE } from '../actions/timelines'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ inReplyTos: ImmutableMap(), diff --git a/app/javascript/mastodon/reducers/conversations.js b/app/javascript/mastodon/reducers/conversations.js index feccf18f03..942c6941b6 100644 --- a/app/javascript/mastodon/reducers/conversations.js +++ b/app/javascript/mastodon/reducers/conversations.js @@ -11,7 +11,7 @@ import { } from '../actions/conversations'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'mastodon/actions/accounts'; import { DOMAIN_BLOCK_SUCCESS } from 'mastodon/actions/domain_blocks'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ items: ImmutableList(), diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js index 69771ad1b3..4d705f0412 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.js @@ -33,7 +33,7 @@ import conversations from './conversations'; import suggestions from './suggestions'; import polls from './polls'; import trends from './trends'; -import missed_updates from './missed_updates'; +import { missedUpdatesReducer } from './missed_updates'; import announcements from './announcements'; import markers from './markers'; import picture_in_picture from './picture_in_picture'; @@ -79,7 +79,7 @@ const reducers = { suggestions, polls, trends, - missed_updates, + missed_updates: missedUpdatesReducer, markers, picture_in_picture, history, diff --git a/app/javascript/mastodon/reducers/missed_updates.ts b/app/javascript/mastodon/reducers/missed_updates.ts index 043fe93faf..628fed2a99 100644 --- a/app/javascript/mastodon/reducers/missed_updates.ts +++ b/app/javascript/mastodon/reducers/missed_updates.ts @@ -12,7 +12,7 @@ const initialState = Record({ unread: 0, })(); -export default function missed_updates( +export function missedUpdatesReducer( state = initialState, action: Action, ) { diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index 0530a52b4c..77e64284b1 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -29,7 +29,7 @@ import { import { DOMAIN_BLOCK_SUCCESS } from 'mastodon/actions/domain_blocks'; import { TIMELINE_DELETE, TIMELINE_DISCONNECT } from '../actions/timelines'; import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ pendingItems: ImmutableList(), diff --git a/app/javascript/mastodon/reducers/settings.js b/app/javascript/mastodon/reducers/settings.js index f48d58bdc5..c8fdf1bc86 100644 --- a/app/javascript/mastodon/reducers/settings.js +++ b/app/javascript/mastodon/reducers/settings.js @@ -6,7 +6,7 @@ import { EMOJI_USE } from '../actions/emojis'; import { LANGUAGE_USE } from '../actions/languages'; import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists'; import { Map as ImmutableMap, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; const initialState = ImmutableMap({ saved: true, diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js index 973e3cf184..41892ae462 100644 --- a/app/javascript/mastodon/reducers/timelines.js +++ b/app/javascript/mastodon/reducers/timelines.js @@ -17,7 +17,7 @@ import { ACCOUNT_UNFOLLOW_SUCCESS, } from '../actions/accounts'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap(); diff --git a/app/javascript/mastodon/uuid.ts b/app/javascript/mastodon/uuid.ts index 01b57ee996..cabbc0f4ed 100644 --- a/app/javascript/mastodon/uuid.ts +++ b/app/javascript/mastodon/uuid.ts @@ -1,4 +1,4 @@ -export default function uuid(a?: string): string { +export function uuid(a?: string): string { return a ? ( (a as any as number) ^ diff --git a/app/javascript/types/image.d.ts b/app/javascript/types/image.d.ts index 8bd6ab0286..fae2ed7014 100644 --- a/app/javascript/types/image.d.ts +++ b/app/javascript/types/image.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/no-default-export */ declare module '*.avif' { const path: string; export default path; From a2e9b9d87db4753bd6a6d182b903c4b485ed8ff9 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Tue, 9 May 2023 19:09:32 +0900 Subject: [PATCH 014/508] Add more detailed type annotation for Account (#24815) --- app/javascript/types/resources.ts | 52 ++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/app/javascript/types/resources.ts b/app/javascript/types/resources.ts index 28fad2719a..0906504150 100644 --- a/app/javascript/types/resources.ts +++ b/app/javascript/types/resources.ts @@ -1,10 +1,54 @@ import type { Record } from 'immutable'; -type AccountValues = { - id: number; +type CustomEmoji = Record<{ + shortcode: string; + static_url: string; + url: string; +}>; + +type AccountField = Record<{ + name: string; + value: string; + verified_at: string | null; +}>; + +type AccountApiResponseValues = { + acct: string; avatar: string; avatar_static: string; - [key: string]: any; + bot: boolean; + created_at: string; + discoverable: boolean; + display_name: string; + emojis: CustomEmoji[]; + fields: AccountField[]; + followers_count: number; + following_count: number; + group: boolean; + header: string; + header_static: string; + id: string; + last_status_at: string; + locked: boolean; + note: string; + statuses_count: number; + url: string; + username: string; }; -export type Account = Record; +type NormalizedAccountField = Record<{ + name_emojified: string; + value_emojified: string; + value_plain: string; +}>; + +type NormalizedAccountValues = { + display_name_html: string; + fields: NormalizedAccountField[]; + note_emojified: string; + note_plain: string; +}; + +export type Account = Record< + AccountApiResponseValues & NormalizedAccountValues +>; From 33fff17ebbc6d02d6b14806caa36d74f0619bbea Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 14:43:07 +0200 Subject: [PATCH 015/508] Upgrade `uuid` to 9.0.0 (#24917) --- .github/dependabot.yml | 4 ---- package.json | 4 ++-- yarn.lock | 16 ++++++++-------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ef16f1d482..af7efbe6cf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,10 +17,6 @@ updates: - dependency-name: '@rails/ujs' versions: - '>= 7' - # TODO: This was ignored in https://github.com/mastodon/mastodon/pull/19120 - - dependency-name: 'uuid' - versions: - - '>= 9' # TODO: This requires code changes for migration - dependency-name: 'tesseract.js' versions: diff --git a/package.json b/package.json index 76deabc26b..b56b79d9fa 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "tesseract.js": "^2.1.5", "tiny-queue": "^0.2.1", "twitter-text": "3.1.0", - "uuid": "^8.3.1", + "uuid": "^9.0.0", "webpack": "^4.46.0", "webpack-assets-manifest": "^4.0.6", "webpack-bundle-analyzer": "^4.8.0", @@ -176,7 +176,7 @@ "@types/react-toggle": "^4.0.3", "@types/redux-immutable": "^4.0.3", "@types/requestidlecallback": "^0.3.5", - "@types/uuid": "^8.3.4", + "@types/uuid": "^9.0.0", "@types/webpack": "^4.41.33", "@types/yargs": "^17.0.24", "@typescript-eslint/eslint-plugin": "^5.59.2", diff --git a/yarn.lock b/yarn.lock index 3114f26a3e..be8ef990fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2425,10 +2425,10 @@ dependencies: source-map "^0.6.1" -"@types/uuid@^8.3.4": - version "8.3.4" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" - integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== +"@types/uuid@^9.0.0": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.1.tgz#98586dc36aee8dacc98cc396dbca8d0429647aa6" + integrity sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA== "@types/warning@^3.0.0": version "3.0.0" @@ -11654,10 +11654,10 @@ uuid@^3.3.2, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.1: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +uuid@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" + integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== v8-compile-cache@^2.1.1, v8-compile-cache@^2.3.0: version "2.3.0" From 1b1b940202ce0550c482d081eb158b4df167b82d Mon Sep 17 00:00:00 2001 From: Daniel M Brasil Date: Tue, 9 May 2023 09:45:47 -0300 Subject: [PATCH 016/508] Fix uncaught `ActiveRecord::StatementInvalid` in Mastodon::IpBlocksCLI (#24861) --- lib/mastodon/ip_blocks_cli.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/mastodon/ip_blocks_cli.rb b/lib/mastodon/ip_blocks_cli.rb index 3b99595857..8a8685fe5a 100644 --- a/lib/mastodon/ip_blocks_cli.rb +++ b/lib/mastodon/ip_blocks_cli.rb @@ -36,6 +36,12 @@ module Mastodon failed = 0 addresses.each do |address| + unless valid_ip_address?(address) + say("#{address} is invalid", :red) + failed += 1 + next + end + ip_block = IpBlock.find_by(ip: address) if ip_block.present? && !options[:force] @@ -79,6 +85,12 @@ module Mastodon skipped = 0 addresses.each do |address| + unless valid_ip_address?(address) + say("#{address} is invalid", :yellow) + skipped += 1 + next + end + ip_blocks = if options[:force] IpBlock.where('ip >>= ?', address) else @@ -126,5 +138,12 @@ module Mastodon :red end end + + def valid_ip_address?(ip_address) + IPAddr.new(ip_address) + true + rescue IPAddr::InvalidAddressError + false + end end end From f7b92ed93da238eb2bd7364c62eeb1a54ed0d12a Mon Sep 17 00:00:00 2001 From: Daniel M Brasil Date: Tue, 9 May 2023 09:46:00 -0300 Subject: [PATCH 017/508] Add ability to block sign-ups from IP using the CLI (#24870) --- lib/mastodon/ip_blocks_cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mastodon/ip_blocks_cli.rb b/lib/mastodon/ip_blocks_cli.rb index 8a8685fe5a..82a08753bc 100644 --- a/lib/mastodon/ip_blocks_cli.rb +++ b/lib/mastodon/ip_blocks_cli.rb @@ -11,7 +11,7 @@ module Mastodon true end - option :severity, required: true, enum: %w(no_access sign_up_requires_approval), desc: 'Severity of the block' + option :severity, required: true, enum: %w(no_access sign_up_requires_approval sign_up_block), desc: 'Severity of the block' option :comment, aliases: [:c], desc: 'Optional comment' option :duration, aliases: [:d], type: :numeric, desc: 'Duration of the block in seconds' option :force, type: :boolean, aliases: [:f], desc: 'Overwrite existing blocks' From b640f897776fd0ff4048fd3e15009749c7de4178 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 14:55:35 +0200 Subject: [PATCH 018/508] Rework polyfills loading (#24907) --- .../base_polyfills.ts} | 22 ++---- .../extra_polyfills.ts} | 0 .../{load_polyfills.js => polyfills/index.ts} | 16 ++--- app/javascript/packs/application.js | 2 +- app/javascript/packs/public.jsx | 6 +- app/javascript/packs/share.jsx | 2 +- package.json | 5 +- tsconfig.json | 1 + yarn.lock | 70 ++----------------- 9 files changed, 25 insertions(+), 99 deletions(-) rename app/javascript/mastodon/{base_polyfills.js => polyfills/base_polyfills.ts} (58%) rename app/javascript/mastodon/{extra_polyfills.js => polyfills/extra_polyfills.ts} (100%) rename app/javascript/mastodon/{load_polyfills.js => polyfills/index.ts} (82%) diff --git a/app/javascript/mastodon/base_polyfills.js b/app/javascript/mastodon/polyfills/base_polyfills.ts similarity index 58% rename from app/javascript/mastodon/base_polyfills.js rename to app/javascript/mastodon/polyfills/base_polyfills.ts index 91bc5d6dc8..2e583f580d 100644 --- a/app/javascript/mastodon/base_polyfills.js +++ b/app/javascript/mastodon/polyfills/base_polyfills.ts @@ -1,26 +1,16 @@ import 'intl'; import 'intl/locale-data/jsonp/en'; -import 'es6-symbol/implement'; -import assign from 'object-assign'; -import values from 'object.values'; -import { decode as decodeBase64 } from './utils/base64'; -import promiseFinally from 'promise.prototype.finally'; - -if (!Object.assign) { - Object.assign = assign; -} - -if (!Object.values) { - values.shim(); -} - -promiseFinally.shim(); +import 'core-js/features/object/assign'; +import 'core-js/features/object/values'; +import 'core-js/features/symbol'; +import 'core-js/features/promise/finally'; +import { decode as decodeBase64 } from '../utils/base64'; if (!HTMLCanvasElement.prototype.toBlob) { const BASE64_MARKER = ';base64,'; Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { - value(callback, type = 'image/png', quality) { + value(callback: BlobCallback, type = 'image/png', quality: any) { const dataURL = this.toDataURL(type, quality); let data; diff --git a/app/javascript/mastodon/extra_polyfills.js b/app/javascript/mastodon/polyfills/extra_polyfills.ts similarity index 100% rename from app/javascript/mastodon/extra_polyfills.js rename to app/javascript/mastodon/polyfills/extra_polyfills.ts diff --git a/app/javascript/mastodon/load_polyfills.js b/app/javascript/mastodon/polyfills/index.ts similarity index 82% rename from app/javascript/mastodon/load_polyfills.js rename to app/javascript/mastodon/polyfills/index.ts index 7909dc4ea3..6d2e5426e4 100644 --- a/app/javascript/mastodon/load_polyfills.js +++ b/app/javascript/mastodon/polyfills/index.ts @@ -10,14 +10,14 @@ function importExtraPolyfills() { return import(/* webpackChunkName: "extra_polyfills" */ './extra_polyfills'); } -function loadPolyfills() { +export function loadPolyfills() { const needsBasePolyfills = !( - HTMLCanvasElement.prototype.toBlob && - window.Intl && - Object.assign && - Object.values && - window.Symbol && - Promise.prototype.finally + 'toBlob' in HTMLCanvasElement.prototype && + 'Intl' in window && + 'assign' in Object && + 'values' in Object && + 'Symbol' in window && + 'finally' in Promise.prototype ); // Latest version of Firefox and Safari do not have IntersectionObserver. @@ -36,5 +36,3 @@ function loadPolyfills() { needsExtraPolyfills && importExtraPolyfills(), ]); } - -export default loadPolyfills; diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 020f2b4a0e..ab87083659 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,5 +1,5 @@ import './public-path'; -import loadPolyfills from '../mastodon/load_polyfills'; +import { loadPolyfills } from '../mastodon/polyfills'; import { start } from '../mastodon/common'; start(); diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index 21c52fc12a..3c6fd36300 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -1,9 +1,9 @@ import './public-path'; -import loadPolyfills from '../mastodon/load_polyfills'; +import escapeTextContentForBrowser from 'escape-html'; +import { loadPolyfills } from '../mastodon/polyfills'; +import ready from '../mastodon/ready'; import { start } from '../mastodon/common'; -import escapeTextContentForBrowser from 'escape-html'; -import ready from '../mastodon/ready'; import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions'; import 'cocoon-js-vanilla'; import axios from 'axios'; diff --git a/app/javascript/packs/share.jsx b/app/javascript/packs/share.jsx index 97c3c7b0e5..542a2f3ae8 100644 --- a/app/javascript/packs/share.jsx +++ b/app/javascript/packs/share.jsx @@ -1,5 +1,5 @@ import './public-path'; -import loadPolyfills from '../mastodon/load_polyfills'; +import { loadPolyfills } from '../mastodon/polyfills'; import { start } from '../mastodon/common'; import ready from '../mastodon/ready'; import ComposeContainer from '../mastodon/containers/compose_container'; diff --git a/package.json b/package.json index b56b79d9fa..8ca7727225 100644 --- a/package.json +++ b/package.json @@ -52,13 +52,13 @@ "cocoon-js-vanilla": "^1.3.0", "color-blend": "^4.0.0", "compression-webpack-plugin": "^6.1.1", + "core-js": "^3.30.2", "cross-env": "^7.0.3", "css-loader": "^5.2.7", "cssnano": "^6.0.1", "detect-passive-events": "^2.0.3", "dotenv": "^16.0.3", "emoji-mart": "npm:emoji-mart-lazyload@latest", - "es6-symbol": "^3.1.3", "escape-html": "^1.0.3", "express": "^4.18.2", "file-loader": "^6.2.0", @@ -80,14 +80,11 @@ "mini-css-extract-plugin": "^1.6.2", "mkdirp": "^2.1.6", "npmlog": "^7.0.1", - "object-assign": "^4.1.1", - "object.values": "^1.1.6", "path-complete-extname": "^1.0.0", "pg": "^8.5.0", "pg-connection-string": "^2.5.0", "postcss": "^8.4.23", "postcss-loader": "^4.3.0", - "promise.prototype.finally": "^3.1.4", "prop-types": "^15.8.1", "punycode": "^2.3.0", "react": "^16.14.0", diff --git a/tsconfig.json b/tsconfig.json index 09cea2a75f..2c2193d55f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "jsx": "react", "target": "esnext", + "module": "CommonJS", "moduleResolution": "node", "allowJs": true, "noEmit": true, diff --git a/yarn.lock b/yarn.lock index be8ef990fd..380fc480a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4135,6 +4135,11 @@ core-js@^2.5.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== +core-js@^3.30.2: + version "3.30.2" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.30.2.tgz#6528abfda65e5ad728143ea23f7a14f0dcf503fc" + integrity sha512-uBJiDmwqsbJCWHAwjrx3cvjbMXP7xD72Dmsn5LOJpiRmE3WbBbN5rCqQ2Qh6Ek6/eOrjlWngEynBWo4VxerQhg== + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -4409,14 +4414,6 @@ csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.6.tgz#865d0b5833d7d8d40f4e5b8a6d76aea3de4725ef" integrity sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw== -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - damerau-levenshtein@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" @@ -4967,32 +4964,6 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.53" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" - integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== - dependencies: - es6-iterator "~2.0.3" - es6-symbol "~3.1.3" - next-tick "~1.0.0" - -es6-iterator@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@^3.1.3, es6-symbol@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -5425,13 +5396,6 @@ express@^4.17.1, express@^4.18.2: utils-merge "1.0.1" vary "~1.1.2" -ext@^1.1.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" - integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== - dependencies: - type "^2.0.0" - extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -8234,11 +8198,6 @@ neo-async@^2.5.0, neo-async@^2.6.1, neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next-tick@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" - integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -9284,15 +9243,6 @@ promise-inflight@^1.0.1: resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= -promise.prototype.finally@^3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/promise.prototype.finally/-/promise.prototype.finally-3.1.4.tgz#4e756a154e4db27fae24c6b18703495c31da3927" - integrity sha512-nNc3YbgMfLzqtqvO/q5DP6RR0SiHI9pUPGzyDf1q+usTwCN2kjvAnJkBb7bHe3o+fFSBPpsGMoYtaSi+LTNqng== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" - prompts@^2.0.1: version "2.3.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.3.2.tgz#480572d89ecf39566d2bd3fe2c9fccb7c4c0b068" @@ -11426,16 +11376,6 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" - integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== - "typescript@^4.7 || 5", typescript@^5.0.4: version "5.0.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" From cf74d04f17248da17d3abcd11fb08d68da8058ce Mon Sep 17 00:00:00 2001 From: eggplants Date: Tue, 9 May 2023 21:56:02 +0900 Subject: [PATCH 019/508] Fix wrong documentation link (#24924) --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 966a2a43db..ceade6e582 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -157,7 +157,7 @@ Metrics/MethodLength: - 'lib/mastodon/*_cli.rb' # Reason: -# https://docs.rubocop.org/rubocop/cops_style.html#stylerescuestandarderror +# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmodulelength Metrics/ModuleLength: CountAsOne: [array, heredoc] From 908c5598e01c2d7e73a1d179586212c9a1e0f9ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 15:25:49 +0200 Subject: [PATCH 020/508] Bump @typescript-eslint/parser from 5.59.2 to 5.59.5 (#24921) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 48 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8ca7727225..9e14c16898 100644 --- a/package.json +++ b/package.json @@ -177,7 +177,7 @@ "@types/webpack": "^4.41.33", "@types/yargs": "^17.0.24", "@typescript-eslint/eslint-plugin": "^5.59.2", - "@typescript-eslint/parser": "^5.59.2", + "@typescript-eslint/parser": "^5.59.5", "babel-jest": "^29.5.0", "eslint": "^8.39.0", "eslint-plugin-formatjs": "^4.10.1", diff --git a/yarn.lock b/yarn.lock index 380fc480a7..7551e9fa7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2491,14 +2491,14 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@^5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.2.tgz#c2c443247901d95865b9f77332d9eee7c55655e8" - integrity sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ== +"@typescript-eslint/parser@^5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.5.tgz#63064f5eafbdbfb5f9dfbf5c4503cdf949852981" + integrity sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw== dependencies: - "@typescript-eslint/scope-manager" "5.59.2" - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/typescript-estree" "5.59.2" + "@typescript-eslint/scope-manager" "5.59.5" + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/typescript-estree" "5.59.5" debug "^4.3.4" "@typescript-eslint/scope-manager@5.59.2": @@ -2509,6 +2509,14 @@ "@typescript-eslint/types" "5.59.2" "@typescript-eslint/visitor-keys" "5.59.2" +"@typescript-eslint/scope-manager@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz#33ffc7e8663f42cfaac873de65ebf65d2bce674d" + integrity sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A== + dependencies: + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/visitor-keys" "5.59.5" + "@typescript-eslint/type-utils@5.59.2": version "5.59.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.2.tgz#0729c237503604cd9a7084b5af04c496c9a4cdcf" @@ -2529,6 +2537,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.2.tgz#b511d2b9847fe277c5cb002a2318bd329ef4f655" integrity sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w== +"@typescript-eslint/types@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.5.tgz#e63c5952532306d97c6ea432cee0981f6d2258c7" + integrity sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w== + "@typescript-eslint/typescript-estree@5.59.0": version "5.59.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz#8869156ee1dcfc5a95be3ed0e2809969ea28e965" @@ -2555,6 +2568,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz#9b252ce55dd765e972a7a2f99233c439c5101e42" + integrity sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg== + dependencies: + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/visitor-keys" "5.59.5" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/utils@5.59.2": version "5.59.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.2.tgz#0c45178124d10cc986115885688db6abc37939f4" @@ -2585,6 +2611,14 @@ "@typescript-eslint/types" "5.59.2" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz#ba5b8d6791a13cf9fea6716af1e7626434b29b9b" + integrity sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA== + dependencies: + "@typescript-eslint/types" "5.59.5" + eslint-visitor-keys "^3.3.0" + "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" From c6d818d02f501e613b42eb8c07d8ad1757a864ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 15:42:21 +0200 Subject: [PATCH 021/508] Bump @typescript-eslint/eslint-plugin from 5.59.2 to 5.59.5 (#24922) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 74 ++++++++++++++-------------------------------------- 2 files changed, 21 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index 9e14c16898..9129c8b0a3 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "@types/uuid": "^9.0.0", "@types/webpack": "^4.41.33", "@types/yargs": "^17.0.24", - "@typescript-eslint/eslint-plugin": "^5.59.2", + "@typescript-eslint/eslint-plugin": "^5.59.5", "@typescript-eslint/parser": "^5.59.5", "babel-jest": "^29.5.0", "eslint": "^8.39.0", diff --git a/yarn.lock b/yarn.lock index 7551e9fa7f..72fb0a3335 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2475,15 +2475,15 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.2.tgz#684a2ce7182f3b4dac342eef7caa1c2bae476abd" - integrity sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A== +"@typescript-eslint/eslint-plugin@^5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz#f156827610a3f8cefc56baeaa93cd4a5f32966b4" + integrity sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg== dependencies: "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.59.2" - "@typescript-eslint/type-utils" "5.59.2" - "@typescript-eslint/utils" "5.59.2" + "@typescript-eslint/scope-manager" "5.59.5" + "@typescript-eslint/type-utils" "5.59.5" + "@typescript-eslint/utils" "5.59.5" debug "^4.3.4" grapheme-splitter "^1.0.4" ignore "^5.2.0" @@ -2501,14 +2501,6 @@ "@typescript-eslint/typescript-estree" "5.59.5" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.2.tgz#f699fe936ee4e2c996d14f0fdd3a7da5ba7b9a4c" - integrity sha512-dB1v7ROySwQWKqQ8rEWcdbTsFjh2G0vn8KUyvTXdPoyzSL6lLGkiXEV5CvpJsEe9xIdKV+8Zqb7wif2issoOFA== - dependencies: - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/visitor-keys" "5.59.2" - "@typescript-eslint/scope-manager@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz#33ffc7e8663f42cfaac873de65ebf65d2bce674d" @@ -2517,13 +2509,13 @@ "@typescript-eslint/types" "5.59.5" "@typescript-eslint/visitor-keys" "5.59.5" -"@typescript-eslint/type-utils@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.2.tgz#0729c237503604cd9a7084b5af04c496c9a4cdcf" - integrity sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ== +"@typescript-eslint/type-utils@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.5.tgz#485b0e2c5b923460bc2ea6b338c595343f06fc9b" + integrity sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg== dependencies: - "@typescript-eslint/typescript-estree" "5.59.2" - "@typescript-eslint/utils" "5.59.2" + "@typescript-eslint/typescript-estree" "5.59.5" + "@typescript-eslint/utils" "5.59.5" debug "^4.3.4" tsutils "^3.21.0" @@ -2532,11 +2524,6 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.0.tgz#3fcdac7dbf923ec5251545acdd9f1d42d7c4fe32" integrity sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA== -"@typescript-eslint/types@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.2.tgz#b511d2b9847fe277c5cb002a2318bd329ef4f655" - integrity sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w== - "@typescript-eslint/types@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.5.tgz#e63c5952532306d97c6ea432cee0981f6d2258c7" @@ -2555,19 +2542,6 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.2.tgz#6e2fabd3ba01db5d69df44e0b654c0b051fe9936" - integrity sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q== - dependencies: - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/visitor-keys" "5.59.2" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - "@typescript-eslint/typescript-estree@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz#9b252ce55dd765e972a7a2f99233c439c5101e42" @@ -2581,17 +2555,17 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.2.tgz#0c45178124d10cc986115885688db6abc37939f4" - integrity sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ== +"@typescript-eslint/utils@5.59.5": + version "5.59.5" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.5.tgz#15b3eb619bb223302e60413adb0accd29c32bcae" + integrity sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.59.2" - "@typescript-eslint/types" "5.59.2" - "@typescript-eslint/typescript-estree" "5.59.2" + "@typescript-eslint/scope-manager" "5.59.5" + "@typescript-eslint/types" "5.59.5" + "@typescript-eslint/typescript-estree" "5.59.5" eslint-scope "^5.1.1" semver "^7.3.7" @@ -2603,14 +2577,6 @@ "@typescript-eslint/types" "5.59.0" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@5.59.2": - version "5.59.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.2.tgz#37a419dc2723a3eacbf722512b86d6caf7d3b750" - integrity sha512-EEpsO8m3RASrKAHI9jpavNv9NlEUebV4qmF1OWxSTtKSFBpC1NCmWazDQHFivRf0O1DV11BA645yrLEVQ0/Lig== - dependencies: - "@typescript-eslint/types" "5.59.2" - eslint-visitor-keys "^3.3.0" - "@typescript-eslint/visitor-keys@5.59.5": version "5.59.5" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz#ba5b8d6791a13cf9fea6716af1e7626434b29b9b" From d57be2731c24bba01a2137a22e3b8b916f5be8ab Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 15:48:53 +0200 Subject: [PATCH 022/508] Remove unused iOS agent sniffing function (#24931) --- app/javascript/mastodon/is_mobile.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/javascript/mastodon/is_mobile.ts b/app/javascript/mastodon/is_mobile.ts index 43819f85db..b2918eb4bf 100644 --- a/app/javascript/mastodon/is_mobile.ts +++ b/app/javascript/mastodon/is_mobile.ts @@ -16,10 +16,6 @@ export const layoutFromWindow = (): LayoutType => { } }; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-expect-error -const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && window.MSStream != null; - const listenerOptions = supportsPassiveEvents ? { passive: true } : false; let userTouching = false; @@ -33,5 +29,3 @@ const touchListener = () => { window.addEventListener('touchstart', touchListener, listenerOptions); export const isUserTouching = () => userTouching; - -export const isIOS = () => iOS; From da803512c9671d976da0806e7fdaa8ddd3a4aeaf Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 9 May 2023 16:42:02 +0200 Subject: [PATCH 023/508] Fix javascript on moderation interface (#24933) --- app/javascript/packs/public.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index 3c6fd36300..1ea39e05a6 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -12,7 +12,7 @@ import { defineMessages } from 'react-intl'; import * as IntlMessageFormat from 'intl-messageformat'; import { timeAgoString } from '../mastodon/components/relative_timestamp'; import { delegate } from '@rails/ujs'; -import * as emojify from '../mastodon/features/emoji/emoji'; +import emojify from '../mastodon/features/emoji/emoji'; import { getLocale } from '../mastodon/locales'; import React from 'react'; import ReactDOM from 'react-dom'; From d67de22458e599447c0d5c85ecbd6fb5aef9b4f4 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 16:56:26 +0200 Subject: [PATCH 024/508] Type Redux store and middleware (#24843) --- .../mastodon/containers/compose_container.jsx | 2 +- .../mastodon/containers/mastodon.jsx | 2 +- app/javascript/mastodon/main.jsx | 2 +- .../mastodon/reducers/{index.js => index.ts} | 4 ++- .../mastodon/store/configureStore.js | 16 ------------ app/javascript/mastodon/store/index.ts | 23 ++++++++++++++++ .../errors.js => store/middlewares/errors.ts} | 9 ++++--- .../middlewares/loading_bar.ts} | 12 ++++++--- .../sounds.js => store/middlewares/sounds.ts} | 26 +++++++++++++------ 9 files changed, 61 insertions(+), 35 deletions(-) rename app/javascript/mastodon/reducers/{index.js => index.ts} (97%) delete mode 100644 app/javascript/mastodon/store/configureStore.js create mode 100644 app/javascript/mastodon/store/index.ts rename app/javascript/mastodon/{middleware/errors.js => store/middlewares/errors.ts} (55%) rename app/javascript/mastodon/{middleware/loading_bar.js => store/middlewares/loading_bar.ts} (68%) rename app/javascript/mastodon/{middleware/sounds.js => store/middlewares/sounds.ts} (54%) diff --git a/app/javascript/mastodon/containers/compose_container.jsx b/app/javascript/mastodon/containers/compose_container.jsx index a4c5f3cb49..9213c5614e 100644 --- a/app/javascript/mastodon/containers/compose_container.jsx +++ b/app/javascript/mastodon/containers/compose_container.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import { store } from '../store/configureStore'; +import { store } from '../store'; import { hydrateStore } from '../actions/store'; import { IntlProvider, addLocaleData } from 'react-intl'; import { getLocale } from '../locales'; diff --git a/app/javascript/mastodon/containers/mastodon.jsx b/app/javascript/mastodon/containers/mastodon.jsx index 256ea8e2d9..9c6c9e5920 100644 --- a/app/javascript/mastodon/containers/mastodon.jsx +++ b/app/javascript/mastodon/containers/mastodon.jsx @@ -5,7 +5,7 @@ import { IntlProvider, addLocaleData } from 'react-intl'; import { Provider as ReduxProvider } from 'react-redux'; import { BrowserRouter, Route } from 'react-router-dom'; import { ScrollContext } from 'react-router-scroll-4'; -import { store } from 'mastodon/store/configureStore'; +import { store } from 'mastodon/store'; import UI from 'mastodon/features/ui'; import { fetchCustomEmojis } from 'mastodon/actions/custom_emojis'; import { hydrateStore } from 'mastodon/actions/store'; diff --git a/app/javascript/mastodon/main.jsx b/app/javascript/mastodon/main.jsx index d8654adedb..c5960477db 100644 --- a/app/javascript/mastodon/main.jsx +++ b/app/javascript/mastodon/main.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { setupBrowserNotifications } from 'mastodon/actions/notifications'; import Mastodon from 'mastodon/containers/mastodon'; -import { store } from 'mastodon/store/configureStore'; +import { store } from 'mastodon/store'; import { me } from 'mastodon/initial_state'; import ready from 'mastodon/ready'; import * as perf from 'mastodon/performance'; diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.ts similarity index 97% rename from app/javascript/mastodon/reducers/index.js rename to app/javascript/mastodon/reducers/index.ts index 4d705f0412..518d8cd792 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.ts @@ -87,4 +87,6 @@ const reducers = { followed_tags, }; -export default combineReducers(reducers); +const rootReducer = combineReducers(reducers); + +export { rootReducer }; diff --git a/app/javascript/mastodon/store/configureStore.js b/app/javascript/mastodon/store/configureStore.js deleted file mode 100644 index cb17dd9ce8..0000000000 --- a/app/javascript/mastodon/store/configureStore.js +++ /dev/null @@ -1,16 +0,0 @@ -import { configureStore } from '@reduxjs/toolkit'; -import thunk from 'redux-thunk'; -import appReducer from '../reducers'; -import loadingBarMiddleware from '../middleware/loading_bar'; -import errorsMiddleware from '../middleware/errors'; -import soundsMiddleware from '../middleware/sounds'; - -export const store = configureStore({ - reducer: appReducer, - middleware: [ - thunk, - loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), - errorsMiddleware(), - soundsMiddleware(), - ], -}); diff --git a/app/javascript/mastodon/store/index.ts b/app/javascript/mastodon/store/index.ts new file mode 100644 index 0000000000..822c01aa90 --- /dev/null +++ b/app/javascript/mastodon/store/index.ts @@ -0,0 +1,23 @@ +import { configureStore } from '@reduxjs/toolkit'; +import { rootReducer } from '../reducers'; +import { loadingBarMiddleware } from './middlewares/loading_bar'; +import { errorsMiddleware } from './middlewares/errors'; +import { soundsMiddleware } from './middlewares/sounds'; +import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; + +export const store = configureStore({ + reducer: rootReducer, + middleware: getDefaultMiddleware => + getDefaultMiddleware().concat( + loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] })) + .concat(errorsMiddleware) + .concat(soundsMiddleware()), +}); + +// Infer the `RootState` and `AppDispatch` types from the store itself +export type RootState = ReturnType +// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState} +export type AppDispatch = typeof store.dispatch + +export const useAppDispatch: () => AppDispatch = useDispatch; +export const useAppSelector: TypedUseSelectorHook = useSelector; diff --git a/app/javascript/mastodon/middleware/errors.js b/app/javascript/mastodon/store/middlewares/errors.ts similarity index 55% rename from app/javascript/mastodon/middleware/errors.js rename to app/javascript/mastodon/store/middlewares/errors.ts index 708df6bb8d..b135fa2ee8 100644 --- a/app/javascript/mastodon/middleware/errors.js +++ b/app/javascript/mastodon/store/middlewares/errors.ts @@ -1,9 +1,11 @@ -import { showAlertForError } from '../actions/alerts'; +import { Middleware } from 'redux'; +import { showAlertForError } from '../../actions/alerts'; +import { RootState } from '..'; const defaultFailSuffix = 'FAIL'; -export default function errorsMiddleware() { - return ({ dispatch }) => next => action => { +export const errorsMiddleware: Middleware, RootState> = + ({ dispatch }) => next => action => { if (action.type && !action.skipAlert) { const isFail = new RegExp(`${defaultFailSuffix}$`, 'g'); @@ -14,4 +16,3 @@ export default function errorsMiddleware() { return next(action); }; -} diff --git a/app/javascript/mastodon/middleware/loading_bar.js b/app/javascript/mastodon/store/middlewares/loading_bar.ts similarity index 68% rename from app/javascript/mastodon/middleware/loading_bar.js rename to app/javascript/mastodon/store/middlewares/loading_bar.ts index da8cc4c7d3..e860b31b6f 100644 --- a/app/javascript/mastodon/middleware/loading_bar.js +++ b/app/javascript/mastodon/store/middlewares/loading_bar.ts @@ -1,8 +1,14 @@ import { showLoading, hideLoading } from 'react-redux-loading-bar'; +import { Middleware } from 'redux'; +import { RootState } from '..'; -const defaultTypeSuffixes = ['PENDING', 'FULFILLED', 'REJECTED']; +interface Config { + promiseTypeSuffixes?: string[] +} -export default function loadingBarMiddleware(config = {}) { +const defaultTypeSuffixes: Config['promiseTypeSuffixes'] = ['PENDING', 'FULFILLED', 'REJECTED']; + +export const loadingBarMiddleware = (config: Config = {}): Middleware, RootState> => { const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypeSuffixes; return ({ dispatch }) => next => (action) => { @@ -22,4 +28,4 @@ export default function loadingBarMiddleware(config = {}) { return next(action); }; -} +}; diff --git a/app/javascript/mastodon/middleware/sounds.js b/app/javascript/mastodon/store/middlewares/sounds.ts similarity index 54% rename from app/javascript/mastodon/middleware/sounds.js rename to app/javascript/mastodon/store/middlewares/sounds.ts index 7f23889836..c9d51f857f 100644 --- a/app/javascript/mastodon/middleware/sounds.js +++ b/app/javascript/mastodon/store/middlewares/sounds.ts @@ -1,4 +1,12 @@ -const createAudio = sources => { +import { Middleware, AnyAction } from 'redux'; +import { RootState } from '..'; + +interface AudioSource { + src: string + type: string +} + +const createAudio = (sources: AudioSource[]) => { const audio = new Audio(); sources.forEach(({ type, src }) => { const source = document.createElement('source'); @@ -9,7 +17,7 @@ const createAudio = sources => { return audio; }; -const play = audio => { +const play = (audio: HTMLAudioElement) => { if (!audio.paused) { audio.pause(); if (typeof audio.fastSeek === 'function') { @@ -22,8 +30,8 @@ const play = audio => { audio.play(); }; -export default function soundsMiddleware() { - const soundCache = { +export const soundsMiddleware = (): Middleware, RootState> => { + const soundCache: {[key: string]: HTMLAudioElement} = { boop: createAudio([ { src: '/sounds/boop.ogg', @@ -36,11 +44,13 @@ export default function soundsMiddleware() { ]), }; - return () => next => action => { - if (action.meta && action.meta.sound && soundCache[action.meta.sound]) { - play(soundCache[action.meta.sound]); + return () => next => (action: AnyAction) => { + const sound = action?.meta?.sound; + + if (sound && soundCache[sound]) { + play(soundCache[sound]); } return next(action); }; -} +}; From 0886856bd2adecedcad6fad9dcb86ed8069c46c0 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 9 May 2023 13:02:12 -0400 Subject: [PATCH 025/508] Use Prettier for ESLint formatting TypeScript (#23631) --- .eslintrc.js | 29 +-- .prettierignore | 2 - .prettierrc.js | 3 +- app/javascript/mastodon/blurhash.ts | 4 +- app/javascript/mastodon/compare_id.ts | 2 +- .../mastodon/components/animated_number.tsx | 50 +++-- .../mastodon/components/avatar_overlay.tsx | 14 +- .../mastodon/components/blurhash.tsx | 2 +- app/javascript/mastodon/components/check.tsx | 12 +- app/javascript/mastodon/components/gifv.tsx | 26 ++- app/javascript/mastodon/components/icon.tsx | 15 +- .../mastodon/components/icon_button.tsx | 28 +-- .../mastodon/components/icon_with_badge.tsx | 15 +- app/javascript/mastodon/components/image.tsx | 14 +- .../components/not_signed_in_indicator.tsx | 5 +- .../mastodon/components/radio_button.tsx | 8 +- .../components/relative_timestamp.tsx | 189 ++++++++++++------ app/javascript/mastodon/permissions.ts | 6 +- .../mastodon/polyfills/base_polyfills.ts | 2 +- .../mastodon/reducers/missed_updates.ts | 22 +- app/javascript/mastodon/scroll.ts | 37 +++- app/javascript/mastodon/store/index.ts | 14 +- .../mastodon/store/middlewares/errors.ts | 4 +- .../mastodon/store/middlewares/loading_bar.ts | 43 ++-- .../mastodon/store/middlewares/sounds.ts | 13 +- app/javascript/mastodon/utils/filters.ts | 24 +-- app/javascript/mastodon/utils/hashtags.ts | 26 +-- app/javascript/mastodon/utils/numbers.ts | 13 +- app/javascript/mastodon/uuid.ts | 4 +- package.json | 2 + yarn.lock | 24 +++ 31 files changed, 407 insertions(+), 245 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2bbe301f04..9e965791b0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,6 +9,7 @@ module.exports = { 'plugin:import/recommended', 'plugin:promise/recommended', 'plugin:jsdoc/recommended', + 'plugin:prettier/recommended', ], env: { @@ -62,20 +63,9 @@ module.exports = { }, rules: { - 'brace-style': 'warn', - 'comma-dangle': ['error', 'always-multiline'], - 'comma-spacing': [ - 'warn', - { - before: false, - after: true, - }, - ], - 'comma-style': ['warn', 'last'], 'consistent-return': 'error', 'dot-notation': 'error', eqeqeq: ['error', 'always', { 'null': 'ignore' }], - indent: ['warn', 2], 'jsx-quotes': ['error', 'prefer-single'], 'no-case-declarations': 'off', 'no-catch-shadow': 'error', @@ -95,7 +85,6 @@ module.exports = { { property: 'substr', message: 'Use .slice instead of .substr.' }, ], 'no-self-assign': 'off', - 'no-trailing-spaces': 'warn', 'no-unused-expressions': 'error', 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': [ @@ -107,29 +96,14 @@ module.exports = { ignoreRestSiblings: true, }, ], - 'object-curly-spacing': ['error', 'always'], - 'padded-blocks': [ - 'error', - { - classes: 'always', - }, - ], - quotes: ['error', 'single'], - semi: 'error', 'valid-typeof': 'error', 'react/jsx-filename-extension': ['error', { extensions: ['.jsx', 'tsx'] }], 'react/jsx-boolean-value': 'error', - 'react/jsx-closing-bracket-location': ['error', 'line-aligned'], - 'react/jsx-curly-spacing': 'error', 'react/display-name': 'off', 'react/jsx-equals-spacing': 'error', - 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'], - 'react/jsx-indent': ['error', 2], 'react/jsx-no-bind': 'error', 'react/jsx-no-target-blank': 'off', - 'react/jsx-tag-spacing': 'error', - 'react/jsx-wrap-multilines': 'error', 'react/no-deprecated': 'off', 'react/no-unknown-property': 'off', 'react/self-closing-comp': 'error', @@ -291,6 +265,7 @@ module.exports = { 'plugin:import/typescript', 'plugin:promise/recommended', 'plugin:jsdoc/recommended', + 'plugin:prettier/recommended', ], rules: { diff --git a/.prettierignore b/.prettierignore index 9bdf769112..2ea4075333 100644 --- a/.prettierignore +++ b/.prettierignore @@ -70,8 +70,6 @@ app/javascript/styles/mastodon/reset.scss # Ignore Javascript pending https://github.com/mastodon/mastodon/pull/23631 *.js *.jsx -*.ts -*.tsx # Ignore HTML till cleaned and included in CI *.html diff --git a/.prettierrc.js b/.prettierrc.js index 1d70813d51..af39b253f6 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,3 +1,4 @@ module.exports = { - singleQuote: true + singleQuote: true, + jsxSingleQuote: true } diff --git a/app/javascript/mastodon/blurhash.ts b/app/javascript/mastodon/blurhash.ts index cb1c3b2c82..dadf2b7f2c 100644 --- a/app/javascript/mastodon/blurhash.ts +++ b/app/javascript/mastodon/blurhash.ts @@ -98,9 +98,9 @@ export const decode83 = (str: string) => { }; export const intToRGB = (int: number) => ({ - r: Math.max(0, (int >> 16)), + r: Math.max(0, int >> 16), g: Math.max(0, (int >> 8) & 255), - b: Math.max(0, (int & 255)), + b: Math.max(0, int & 255), }); export const getAverageFromBlurhash = (blurhash: string) => { diff --git a/app/javascript/mastodon/compare_id.ts b/app/javascript/mastodon/compare_id.ts index 3ddfb76351..30b0572481 100644 --- a/app/javascript/mastodon/compare_id.ts +++ b/app/javascript/mastodon/compare_id.ts @@ -1,4 +1,4 @@ -export function compareId (id1: string, id2: string) { +export function compareId(id1: string, id2: string) { if (id1 === id2) { return 0; } diff --git a/app/javascript/mastodon/components/animated_number.tsx b/app/javascript/mastodon/components/animated_number.tsx index 20ffa1a4d0..f6c77d35ff 100644 --- a/app/javascript/mastodon/components/animated_number.tsx +++ b/app/javascript/mastodon/components/animated_number.tsx @@ -16,13 +16,10 @@ const obfuscatedCount = (count: number) => { type Props = { value: number; obfuscate?: boolean; -} -export const AnimatedNumber: React.FC = ({ - value, - obfuscate, -})=> { +}; +export const AnimatedNumber: React.FC = ({ value, obfuscate }) => { const [previousValue, setPreviousValue] = useState(value); - const [direction, setDirection] = useState<1|-1>(1); + const [direction, setDirection] = useState<1 | -1>(1); if (previousValue !== value) { setPreviousValue(value); @@ -30,24 +27,45 @@ export const AnimatedNumber: React.FC = ({ } const willEnter = useCallback(() => ({ y: -1 * direction }), [direction]); - const willLeave = useCallback(() => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), [direction]); + const willLeave = useCallback( + () => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), + [direction] + ); if (reduceMotion) { - return obfuscate ? <>{obfuscatedCount(value)} : ; + return obfuscate ? ( + <>{obfuscatedCount(value)} + ) : ( + + ); } - const styles = [{ - key: `${value}`, - data: value, - style: { y: spring(0, { damping: 35, stiffness: 400 }) }, - }]; + const styles = [ + { + key: `${value}`, + data: value, + style: { y: spring(0, { damping: 35, stiffness: 400 }) }, + }, + ]; return ( - - {items => ( + + {(items) => ( {items.map(({ key, data, style }) => ( - 0 ? 'absolute' : 'static', transform: `translateY(${style.y * 100}%)` }}>{obfuscate ? obfuscatedCount(data) : } + 0 ? 'absolute' : 'static', + transform: `translateY(${style.y * 100}%)`, + }} + > + {obfuscate ? obfuscatedCount(data) : } + ))} )} diff --git a/app/javascript/mastodon/components/avatar_overlay.tsx b/app/javascript/mastodon/components/avatar_overlay.tsx index e8dc88896f..1dbd533230 100644 --- a/app/javascript/mastodon/components/avatar_overlay.tsx +++ b/app/javascript/mastodon/components/avatar_overlay.tsx @@ -18,13 +18,19 @@ export const AvatarOverlay: React.FC = ({ baseSize = 36, overlaySize = 24, }) => { - const { hovering, handleMouseEnter, handleMouseLeave } = useHovering(autoPlayGif); - const accountSrc = hovering ? account?.get('avatar') : account?.get('avatar_static'); - const friendSrc = hovering ? friend?.get('avatar') : friend?.get('avatar_static'); + const { hovering, handleMouseEnter, handleMouseLeave } = + useHovering(autoPlayGif); + const accountSrc = hovering + ? account?.get('avatar') + : account?.get('avatar_static'); + const friendSrc = hovering + ? friend?.get('avatar') + : friend?.get('avatar_static'); return (
diff --git a/app/javascript/mastodon/components/blurhash.tsx b/app/javascript/mastodon/components/blurhash.tsx index 181e2183d0..7005136765 100644 --- a/app/javascript/mastodon/components/blurhash.tsx +++ b/app/javascript/mastodon/components/blurhash.tsx @@ -8,7 +8,7 @@ type Props = { dummy?: boolean; // Whether dummy mode is enabled. If enabled, nothing is rendered and canvas left untouched children?: never; [key: string]: any; -} +}; const Blurhash: React.FC = ({ hash, width = 32, diff --git a/app/javascript/mastodon/components/check.tsx b/app/javascript/mastodon/components/check.tsx index 57b810a0e5..73d65595ea 100644 --- a/app/javascript/mastodon/components/check.tsx +++ b/app/javascript/mastodon/components/check.tsx @@ -1,7 +1,15 @@ import React from 'react'; export const Check: React.FC = () => ( - - + + ); diff --git a/app/javascript/mastodon/components/gifv.tsx b/app/javascript/mastodon/components/gifv.tsx index 5d9f235e11..72914ba741 100644 --- a/app/javascript/mastodon/components/gifv.tsx +++ b/app/javascript/mastodon/components/gifv.tsx @@ -8,7 +8,7 @@ type Props = { width: number; height: number; onClick?: () => void; -} +}; export const GIFV: React.FC = ({ src, @@ -17,19 +17,23 @@ export const GIFV: React.FC = ({ width, height, onClick, -})=> { +}) => { const [loading, setLoading] = useState(true); - const handleLoadedData: React.ReactEventHandler = useCallback(() => { - setLoading(false); - }, [setLoading]); + const handleLoadedData: React.ReactEventHandler = + useCallback(() => { + setLoading(false); + }, [setLoading]); - const handleClick: React.MouseEventHandler = useCallback((e) => { - if (onClick) { - e.stopPropagation(); - onClick(); - } - }, [onClick]); + const handleClick: React.MouseEventHandler = useCallback( + (e) => { + if (onClick) { + e.stopPropagation(); + onClick(); + } + }, + [onClick] + ); return (
diff --git a/app/javascript/mastodon/components/icon.tsx b/app/javascript/mastodon/components/icon.tsx index f74437b555..4eb948dc76 100644 --- a/app/javascript/mastodon/components/icon.tsx +++ b/app/javascript/mastodon/components/icon.tsx @@ -7,6 +7,15 @@ type Props = { fixedWidth?: boolean; children?: never; [key: string]: any; -} -export const Icon: React.FC = ({ id, className, fixedWidth, ...other }) => - ; +}; +export const Icon: React.FC = ({ + id, + className, + fixedWidth, + ...other +}) => ( + +); diff --git a/app/javascript/mastodon/components/icon_button.tsx b/app/javascript/mastodon/components/icon_button.tsx index f9db287bb9..1786414009 100644 --- a/app/javascript/mastodon/components/icon_button.tsx +++ b/app/javascript/mastodon/components/icon_button.tsx @@ -25,13 +25,12 @@ type Props = { obfuscateCount?: boolean; href?: string; ariaHidden: boolean; -} +}; type States = { - activate: boolean, - deactivate: boolean, -} + activate: boolean; + deactivate: boolean; +}; export class IconButton extends React.PureComponent { - static defaultProps = { size: 18, active: false, @@ -47,7 +46,7 @@ export class IconButton extends React.PureComponent { deactivate: false, }; - UNSAFE_componentWillReceiveProps (nextProps: Props) { + UNSAFE_componentWillReceiveProps(nextProps: Props) { if (!nextProps.animate) return; if (this.props.active && !nextProps.active) { @@ -57,7 +56,7 @@ export class IconButton extends React.PureComponent { } } - handleClick: React.MouseEventHandler = (e) => { + handleClick: React.MouseEventHandler = (e) => { e.preventDefault(); if (!this.props.disabled && this.props.onClick != null) { @@ -83,7 +82,7 @@ export class IconButton extends React.PureComponent { } }; - render () { + render() { const style = { fontSize: `${this.props.size}px`, width: `${this.props.size * 1.28571429}px`, @@ -109,10 +108,7 @@ export class IconButton extends React.PureComponent { ariaHidden, } = this.props; - const { - activate, - deactivate, - } = this.state; + const { activate, deactivate } = this.state; const classes = classNames(className, 'icon-button', { active, @@ -130,7 +126,12 @@ export class IconButton extends React.PureComponent { let contents = ( - ); @@ -162,5 +163,4 @@ export class IconButton extends React.PureComponent { ); } - } diff --git a/app/javascript/mastodon/components/icon_with_badge.tsx b/app/javascript/mastodon/components/icon_with_badge.tsx index a4af86ca9b..bf86814c03 100644 --- a/app/javascript/mastodon/components/icon_with_badge.tsx +++ b/app/javascript/mastodon/components/icon_with_badge.tsx @@ -1,18 +1,25 @@ import React from 'react'; import { Icon } from './icon'; -const formatNumber = (num: number): number | string => num > 40 ? '40+' : num; +const formatNumber = (num: number): number | string => (num > 40 ? '40+' : num); type Props = { id: string; count: number; issueBadge: boolean; className: string; -} -export const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( +}; +export const IconWithBadge: React.FC = ({ + id, + count, + issueBadge, + className, +}) => ( - {count > 0 && {formatNumber(count)}} + {count > 0 && ( + {formatNumber(count)} + )} {issueBadge && } ); diff --git a/app/javascript/mastodon/components/image.tsx b/app/javascript/mastodon/components/image.tsx index b332d4115b..490543424a 100644 --- a/app/javascript/mastodon/components/image.tsx +++ b/app/javascript/mastodon/components/image.tsx @@ -7,9 +7,14 @@ type Props = { srcSet?: string; blurhash?: string; className?: string; -} +}; -export const Image: React.FC = ({ src, srcSet, blurhash, className }) => { +export const Image: React.FC = ({ + src, + srcSet, + blurhash, + className, +}) => { const [loaded, setLoaded] = useState(false); const handleLoad = useCallback(() => { @@ -17,7 +22,10 @@ export const Image: React.FC = ({ src, srcSet, blurhash, className }) => }, [setLoaded]); return ( -
+
{blurhash && }
diff --git a/app/javascript/mastodon/components/not_signed_in_indicator.tsx b/app/javascript/mastodon/components/not_signed_in_indicator.tsx index 3bfee6ae91..53945d6a7a 100644 --- a/app/javascript/mastodon/components/not_signed_in_indicator.tsx +++ b/app/javascript/mastodon/components/not_signed_in_indicator.tsx @@ -4,7 +4,10 @@ import { FormattedMessage } from 'react-intl'; export const NotSignedInIndicator: React.FC = () => (
- +
); diff --git a/app/javascript/mastodon/components/radio_button.tsx b/app/javascript/mastodon/components/radio_button.tsx index 194b67afe1..829f471747 100644 --- a/app/javascript/mastodon/components/radio_button.tsx +++ b/app/javascript/mastodon/components/radio_button.tsx @@ -9,7 +9,13 @@ type Props = { label: React.ReactNode; }; -export const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { +export const RadioButton: React.FC = ({ + name, + value, + checked, + onChange, + label, +}) => { return (
); - -export default NotSignedInIndicator; diff --git a/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx b/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx index 9d1139a051..532eb4358c 100644 --- a/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx +++ b/app/javascript/flavours/glitch/components/notification_purge_buttons.jsx @@ -10,7 +10,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx b/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx index 7e02556749..e8c9611a34 100644 --- a/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx +++ b/app/javascript/flavours/glitch/components/picture_in_picture_placeholder.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { removePictureInPicture } from 'flavours/glitch/actions/picture_in_picture'; import { connect } from 'react-redux'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/components/poll.jsx b/app/javascript/flavours/glitch/components/poll.jsx index fb37612d9c..df23919563 100644 --- a/app/javascript/flavours/glitch/components/poll.jsx +++ b/app/javascript/flavours/glitch/components/poll.jsx @@ -8,8 +8,8 @@ import Motion from 'flavours/glitch/features/ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import escapeTextContentForBrowser from 'escape-html'; import emojify from 'flavours/glitch/features/emoji/emoji'; -import RelativeTimestamp from './relative_timestamp'; -import Icon from 'flavours/glitch/components/icon'; +import { RelativeTimestamp } from './relative_timestamp'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ closed: { diff --git a/app/javascript/flavours/glitch/components/radio_button.tsx b/app/javascript/flavours/glitch/components/radio_button.tsx index 9ba098f78d..194b67afe1 100644 --- a/app/javascript/flavours/glitch/components/radio_button.tsx +++ b/app/javascript/flavours/glitch/components/radio_button.tsx @@ -26,5 +26,3 @@ export const RadioButton: React.FC = ({ name, value, checked, onChange, l ); }; - -export default RadioButton; diff --git a/app/javascript/flavours/glitch/components/relative_timestamp.tsx b/app/javascript/flavours/glitch/components/relative_timestamp.tsx index 89cad06658..4f1a76e54b 100644 --- a/app/javascript/flavours/glitch/components/relative_timestamp.tsx +++ b/app/javascript/flavours/glitch/components/relative_timestamp.tsx @@ -200,4 +200,6 @@ class RelativeTimestamp extends React.Component { } -export default injectIntl(RelativeTimestamp); +const RelativeTimestampWithIntl = injectIntl(RelativeTimestamp); + +export { RelativeTimestampWithIntl as RelativeTimestamp }; diff --git a/app/javascript/flavours/glitch/components/server_banner.jsx b/app/javascript/flavours/glitch/components/server_banner.jsx index ba84064a8b..8b9c501538 100644 --- a/app/javascript/flavours/glitch/components/server_banner.jsx +++ b/app/javascript/flavours/glitch/components/server_banner.jsx @@ -7,7 +7,7 @@ import ShortNumber from 'flavours/glitch/components/short_number'; import Skeleton from 'flavours/glitch/components/skeleton'; import Account from 'flavours/glitch/containers/account_container'; import { domain } from 'flavours/glitch/initial_state'; -import Image from 'flavours/glitch/components/image'; +import { Image } from 'flavours/glitch/components/image'; import { Link } from 'react-router-dom'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/components/status_action_bar.jsx b/app/javascript/flavours/glitch/components/status_action_bar.jsx index 091d0b24be..5b87cd4390 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.jsx +++ b/app/javascript/flavours/glitch/components/status_action_bar.jsx @@ -1,12 +1,12 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { me } from 'flavours/glitch/initial_state'; -import RelativeTimestamp from './relative_timestamp'; +import { RelativeTimestamp } from './relative_timestamp'; import { accountAdminLink, statusAdminLink } from 'flavours/glitch/utils/backend_links'; import classNames from 'classnames'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions'; diff --git a/app/javascript/flavours/glitch/components/status_content.jsx b/app/javascript/flavours/glitch/components/status_content.jsx index e66df588a3..3fefef2c93 100644 --- a/app/javascript/flavours/glitch/components/status_content.jsx +++ b/app/javascript/flavours/glitch/components/status_content.jsx @@ -5,7 +5,7 @@ import { FormattedMessage, injectIntl } from 'react-intl'; import Permalink from './permalink'; import { connect } from 'react-redux'; import classnames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { autoPlayGif, languages as preloadedLanguages } from 'flavours/glitch/initial_state'; import { decode as decodeIDNA } from 'flavours/glitch/utils/idna'; diff --git a/app/javascript/flavours/glitch/components/status_header.jsx b/app/javascript/flavours/glitch/components/status_header.jsx index 94c403f169..8813d19b9c 100644 --- a/app/javascript/flavours/glitch/components/status_header.jsx +++ b/app/javascript/flavours/glitch/components/status_header.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; // Mastodon imports. -import Avatar from './avatar'; +import { Avatar } from './avatar'; import AvatarOverlay from './avatar_overlay'; import DisplayName from './display_name'; diff --git a/app/javascript/flavours/glitch/components/status_icons.jsx b/app/javascript/flavours/glitch/components/status_icons.jsx index dd63cbd21c..59912d4391 100644 --- a/app/javascript/flavours/glitch/components/status_icons.jsx +++ b/app/javascript/flavours/glitch/components/status_icons.jsx @@ -5,9 +5,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl } from 'react-intl'; // Mastodon imports. -import IconButton from './icon_button'; +import { IconButton } from './icon_button'; import VisibilityIcon from './status_visibility_icon'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { languages } from 'flavours/glitch/initial_state'; // Messages for use with internationalization stuff. diff --git a/app/javascript/flavours/glitch/components/status_prepend.jsx b/app/javascript/flavours/glitch/components/status_prepend.jsx index 8c4343b040..127636c51d 100644 --- a/app/javascript/flavours/glitch/components/status_prepend.jsx +++ b/app/javascript/flavours/glitch/components/status_prepend.jsx @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { me } from 'flavours/glitch/initial_state'; export default class StatusPrepend extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/components/status_visibility_icon.jsx b/app/javascript/flavours/glitch/components/status_visibility_icon.jsx index fcedfbfd6b..cee56a2391 100644 --- a/app/javascript/flavours/glitch/components/status_visibility_icon.jsx +++ b/app/javascript/flavours/glitch/components/status_visibility_icon.jsx @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ public: { id: 'privacy.public.short', defaultMessage: 'Public' }, diff --git a/app/javascript/flavours/glitch/features/about/index.jsx b/app/javascript/flavours/glitch/features/about/index.jsx index 67d5afbdd1..e2556ec340 100644 --- a/app/javascript/flavours/glitch/features/about/index.jsx +++ b/app/javascript/flavours/glitch/features/about/index.jsx @@ -9,9 +9,9 @@ import { Helmet } from 'react-helmet'; import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'flavours/glitch/actions/server'; import Account from 'flavours/glitch/containers/account_container'; import Skeleton from 'flavours/glitch/components/skeleton'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; -import Image from 'flavours/glitch/components/image'; +import { Image } from 'flavours/glitch/components/image'; const messages = defineMessages({ title: { id: 'column.about', defaultMessage: 'About' }, diff --git a/app/javascript/flavours/glitch/features/account/components/account_note.jsx b/app/javascript/flavours/glitch/features/account/components/account_note.jsx index 8ab00f6d48..a548db2699 100644 --- a/app/javascript/flavours/glitch/features/account/components/account_note.jsx +++ b/app/javascript/flavours/glitch/features/account/components/account_note.jsx @@ -3,7 +3,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import Textarea from 'react-textarea-autosize'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/account/components/action_bar.jsx b/app/javascript/flavours/glitch/features/account/components/action_bar.jsx index 7026c9278d..60ac06f910 100644 --- a/app/javascript/flavours/glitch/features/account/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/features/account/components/action_bar.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { NavLink } from 'react-router-dom'; import { FormattedMessage, FormattedNumber } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; class ActionBar extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx b/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx index 73c1737a65..5c2940b749 100644 --- a/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx +++ b/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class FollowRequestNote extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/account/components/header.jsx b/app/javascript/flavours/glitch/features/account/components/header.jsx index 9fcdb82e70..a447750c2d 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -6,9 +6,9 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import { autoPlayGif, me, domain } from 'flavours/glitch/initial_state'; import { preferencesLink, profileLink, accountAdminLink } from 'flavours/glitch/utils/backend_links'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; -import IconButton from 'flavours/glitch/components/icon_button'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Icon } from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { Avatar } from 'flavours/glitch/components/avatar'; import Button from 'flavours/glitch/components/button'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import AccountNoteContainer from '../containers/account_note_container'; diff --git a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx index 5fd84996b2..0dfbec30c0 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx +++ b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx @@ -1,6 +1,6 @@ -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; import PropTypes from 'prop-types'; import React from 'react'; diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx index 40bdc4034e..8f9693f643 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.jsx @@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import AvatarOverlay from '../../../components/avatar_overlay'; import DisplayName from '../../../components/display_name'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class MovedNote extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/audio/index.jsx b/app/javascript/flavours/glitch/features/audio/index.jsx index c3e4ed5d4f..8c13f6797e 100644 --- a/app/javascript/flavours/glitch/features/audio/index.jsx +++ b/app/javascript/flavours/glitch/features/audio/index.jsx @@ -2,12 +2,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { formatTime, getPointerPosition, fileNameFromURL } from 'flavours/glitch/features/video'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; import { throttle, debounce } from 'lodash'; import Visualizer from './visualizer'; import { displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; import { is } from 'immutable'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx b/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx index fb9bb50358..8b79692502 100644 --- a/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/autosuggest_account.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx index d32f3572a5..e791faa6bc 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown.jsx @@ -5,7 +5,7 @@ import React from 'react'; import Overlay from 'react-overlays/Overlay'; // Components. -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import DropdownMenu from './dropdown_menu'; // The component. diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx index de50f566d9..786f593070 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown_menu.jsx @@ -4,7 +4,7 @@ import React from 'react'; import classNames from 'classnames'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { withPassive } from 'flavours/glitch/utils/dom_helpers'; diff --git a/app/javascript/flavours/glitch/features/compose/components/header.jsx b/app/javascript/flavours/glitch/features/compose/components/header.jsx index ad58f7ad4c..0a94ca5fc7 100644 --- a/app/javascript/flavours/glitch/features/compose/components/header.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/header.jsx @@ -7,7 +7,7 @@ import { Link } from 'react-router-dom'; import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { conditionalRender } from 'flavours/glitch/utils/react_helpers'; diff --git a/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx b/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx index 1a68f1e129..371ad6d245 100644 --- a/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/navigation_bar.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ActionBar from './action_bar'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import Permalink from 'flavours/glitch/components/permalink'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/compose/components/options.jsx b/app/javascript/flavours/glitch/features/compose/components/options.jsx index cedb906ca0..079065f8c6 100644 --- a/app/javascript/flavours/glitch/features/compose/components/options.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/options.jsx @@ -7,7 +7,7 @@ import Toggle from 'react-toggle'; import { connect } from 'react-redux'; // Components. -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import TextIconButton from './text_icon_button'; import DropdownContainer from '../containers/dropdown_container'; import PrivacyDropdownContainer from '../containers/privacy_dropdown_container'; diff --git a/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx b/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx index 694ee3a04f..8b0f01a9ec 100644 --- a/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/poll_form.jsx @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; -import Icon from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { Icon } from 'flavours/glitch/components/icon'; import AutosuggestInput from 'flavours/glitch/components/autosuggest_input'; import classNames from 'classnames'; import { pollLimits } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.jsx b/app/javascript/flavours/glitch/features/compose/components/publisher.jsx index a935e82e8e..04c3926abf 100644 --- a/app/javascript/flavours/glitch/features/compose/components/publisher.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/publisher.jsx @@ -8,7 +8,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. import Button from 'flavours/glitch/components/button'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { maxChars } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx b/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx index 179d85ac3b..4077a29644 100644 --- a/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx @@ -7,7 +7,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. import AccountContainer from 'flavours/glitch/containers/account_container'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import AttachmentList from 'flavours/glitch/components/attachment_list'; // Messages. diff --git a/app/javascript/flavours/glitch/features/compose/components/search.jsx b/app/javascript/flavours/glitch/features/compose/components/search.jsx index cd1bd08085..3d1aaf2646 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search.jsx @@ -9,7 +9,7 @@ import { import Overlay from 'react-overlays/Overlay'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Utils. import { focusRoot } from 'flavours/glitch/utils/dom_helpers'; diff --git a/app/javascript/flavours/glitch/features/compose/components/search_results.jsx b/app/javascript/flavours/glitch/features/compose/components/search_results.jsx index 6c1dee454c..8533d4b234 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search_results.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search_results.jsx @@ -6,7 +6,7 @@ import AccountContainer from 'flavours/glitch/containers/account_container'; import StatusContainer from 'flavours/glitch/containers/status_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { searchEnabled } from 'flavours/glitch/initial_state'; import LoadMore from 'flavours/glitch/components/load_more'; diff --git a/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx b/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx index 73281fc746..33e29797dc 100644 --- a/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/textarea_icons.jsx @@ -6,7 +6,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; // Components. -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // Messages. const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/compose/components/upload.jsx b/app/javascript/flavours/glitch/features/compose/components/upload.jsx index 2c74d91f36..4a2c5176b4 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload.jsx @@ -5,7 +5,7 @@ import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class Upload extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx b/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx index 39ac310532..61047762d1 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { FormattedMessage } from 'react-intl'; export default class UploadProgress extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx index 06984f3ad1..485f2d022e 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx +++ b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx @@ -8,8 +8,8 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import AvatarComposite from 'flavours/glitch/components/avatar_composite'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import { HotKeys } from 'react-hotkeys'; import { autoPlayGif } from 'flavours/glitch/initial_state'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/features/directory/components/account_card.jsx b/app/javascript/flavours/glitch/features/directory/components/account_card.jsx index 663710b063..79543389c6 100644 --- a/app/javascript/flavours/glitch/features/directory/components/account_card.jsx +++ b/app/javascript/flavours/glitch/features/directory/components/account_card.jsx @@ -4,10 +4,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from 'flavours/glitch/selectors'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import Button from 'flavours/glitch/components/button'; import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; import { autoPlayGif, me, unfollowModal } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/directory/index.jsx b/app/javascript/flavours/glitch/features/directory/index.jsx index 4278a4e719..22280bbfdb 100644 --- a/app/javascript/flavours/glitch/features/directory/index.jsx +++ b/app/javascript/flavours/glitch/features/directory/index.jsx @@ -9,7 +9,7 @@ import { addColumn, removeColumn, moveColumn, changeColumnParams } from 'flavour import { fetchDirectory, expandDirectory } from 'flavours/glitch/actions/directory'; import { List as ImmutableList } from 'immutable'; import AccountCard from './components/account_card'; -import RadioButton from 'flavours/glitch/components/radio_button'; +import { RadioButton } from 'flavours/glitch/components/radio_button'; import LoadMore from 'flavours/glitch/components/load_more'; import ScrollContainer from 'flavours/glitch/containers/scroll_container'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; diff --git a/app/javascript/flavours/glitch/features/explore/components/story.jsx b/app/javascript/flavours/glitch/features/explore/components/story.jsx index 8270d3ccbb..d70914d41a 100644 --- a/app/javascript/flavours/glitch/features/explore/components/story.jsx +++ b/app/javascript/flavours/glitch/features/explore/components/story.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; import { accountsCountRenderer } from 'flavours/glitch/components/hashtag'; import ShortNumber from 'flavours/glitch/components/short_number'; import Skeleton from 'flavours/glitch/components/skeleton'; diff --git a/app/javascript/flavours/glitch/features/favourites/index.jsx b/app/javascript/flavours/glitch/features/favourites/index.jsx index 21ce7fcc7e..8755811d94 100644 --- a/app/javascript/flavours/glitch/features/favourites/index.jsx +++ b/app/javascript/flavours/glitch/features/favourites/index.jsx @@ -5,7 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { fetchFavourites } from 'flavours/glitch/actions/interactions'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; diff --git a/app/javascript/flavours/glitch/features/filters/select_filter.jsx b/app/javascript/flavours/glitch/features/filters/select_filter.jsx index a33892f83f..e7cdd4e197 100644 --- a/app/javascript/flavours/glitch/features/filters/select_filter.jsx +++ b/app/javascript/flavours/glitch/features/filters/select_filter.jsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { toServerSideType } from 'flavours/glitch/utils/filters'; import { loupeIcon, deleteIcon } from 'flavours/glitch/utils/icons'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import fuzzysort from 'fuzzysort'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx b/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx index e56af7364b..e15bc14222 100644 --- a/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx +++ b/app/javascript/flavours/glitch/features/follow_recommendations/components/account.jsx @@ -4,10 +4,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { connect } from 'react-redux'; import { makeGetAccount } from 'flavours/glitch/selectors'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { injectIntl, defineMessages } from 'react-intl'; import { followAccount, unfollowAccount } from 'flavours/glitch/actions/accounts'; diff --git a/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx b/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx index af8a534fa4..b2dfc5dbb3 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx +++ b/app/javascript/flavours/glitch/features/follow_requests/components/account_authorize.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Permalink from 'flavours/glitch/components/permalink'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx b/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx index 29288076b7..fd76f9773d 100644 --- a/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx +++ b/app/javascript/flavours/glitch/features/getting_started/components/announcements.jsx @@ -3,15 +3,15 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import ReactSwipeableViews from 'react-swipeable-views'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; -import Icon from 'flavours/glitch/components/icon'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { Icon } from 'flavours/glitch/components/icon'; import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from 'react-intl'; import { autoPlayGif, reduceMotion, disableSwiping, mascot } from 'flavours/glitch/initial_state'; import elephantUIPlane from 'mastodon/../images/elephant_ui_plane.svg'; import unicodeMapping from 'flavours/glitch/features/emoji/emoji_unicode_mapping_light'; import classNames from 'classnames'; import EmojiPickerDropdown from 'flavours/glitch/features/compose/containers/emoji_picker_dropdown_container'; -import AnimatedNumber from 'flavours/glitch/components/animated_number'; +import { AnimatedNumber } from 'flavours/glitch/components/animated_number'; import TransitionMotion from 'react-motion/lib/TransitionMotion'; import spring from 'react-motion/lib/spring'; import { assetHost } from 'flavours/glitch/utils/config'; diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx index fe5afa2406..cd3639d968 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx @@ -12,7 +12,7 @@ import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'; import { isEqual } from 'lodash'; import { fetchHashtag, followHashtag, unfollowHashtag } from 'flavours/glitch/actions/tags'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; import { Helmet } from 'react-helmet'; diff --git a/app/javascript/flavours/glitch/features/home_timeline/index.jsx b/app/javascript/flavours/glitch/features/home_timeline/index.jsx index 71619394b6..a8dfa1d08f 100644 --- a/app/javascript/flavours/glitch/features/home_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/home_timeline/index.jsx @@ -12,8 +12,8 @@ import { Link } from 'react-router-dom'; import { fetchAnnouncements, toggleShowAnnouncements } from 'flavours/glitch/actions/announcements'; import AnnouncementsContainer from 'flavours/glitch/features/getting_started/containers/announcements_container'; import classNames from 'classnames'; -import IconWithBadge from 'flavours/glitch/components/icon_with_badge'; -import NotSignedInIndicator from 'flavours/glitch/components/not_signed_in_indicator'; +import { IconWithBadge } from 'flavours/glitch/components/icon_with_badge'; +import { NotSignedInIndicator } from 'flavours/glitch/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx index 20e4959e6f..380edee659 100644 --- a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx +++ b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen } from 'flavours/glitch/initial_state'; import { connect } from 'react-redux'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; import { openModal, closeModal } from 'flavours/glitch/actions/modal'; diff --git a/app/javascript/flavours/glitch/features/list_adder/components/account.jsx b/app/javascript/flavours/glitch/features/list_adder/components/account.jsx index 034ed0edc9..64522a3a86 100644 --- a/app/javascript/flavours/glitch/features/list_adder/components/account.jsx +++ b/app/javascript/flavours/glitch/features/list_adder/components/account.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; +import { Avatar } from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import { injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/list_adder/components/list.jsx b/app/javascript/flavours/glitch/features/list_adder/components/list.jsx index 1957bbe420..587a953b01 100644 --- a/app/javascript/flavours/glitch/features/list_adder/components/list.jsx +++ b/app/javascript/flavours/glitch/features/list_adder/components/list.jsx @@ -3,10 +3,10 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListAdder, addToListAdder } from '../../../actions/lists'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, diff --git a/app/javascript/flavours/glitch/features/list_editor/components/account.jsx b/app/javascript/flavours/glitch/features/list_editor/components/account.jsx index 71a8b76736..69fbaf5042 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/account.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/account.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx b/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx index b4886ef0ed..3f4e9ded60 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/edit_list_form.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from 'flavours/glitch/actions/lists'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/list_editor/components/search.jsx b/app/javascript/flavours/glitch/features/list_editor/components/search.jsx index 3b66bc325d..3a51a7b4e5 100644 --- a/app/javascript/flavours/glitch/features/list_editor/components/search.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/components/search.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages } from 'react-intl'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ search: { id: 'lists.search', defaultMessage: 'Search among people you follow' }, diff --git a/app/javascript/flavours/glitch/features/list_timeline/index.jsx b/app/javascript/flavours/glitch/features/list_timeline/index.jsx index ef1dbaae78..f7abe248d4 100644 --- a/app/javascript/flavours/glitch/features/list_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/list_timeline/index.jsx @@ -11,9 +11,9 @@ import { connectListStream } from 'flavours/glitch/actions/streaming'; import { expandListTimeline } from 'flavours/glitch/actions/timelines'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import RadioButton from 'flavours/glitch/components/radio_button'; +import { RadioButton } from 'flavours/glitch/components/radio_button'; import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; diff --git a/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx b/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx index be94ff5595..aa743dea4a 100644 --- a/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx +++ b/app/javascript/flavours/glitch/features/lists/components/new_list_form.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeListEditorTitle, submitListEditor } from 'flavours/glitch/actions/lists'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx b/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx index 9ac6d9b73d..2de7c952c8 100644 --- a/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/navigation/item/index.jsx @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx index 436f64b5d2..3d5f67a178 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx @@ -10,7 +10,7 @@ import classNames from 'classnames'; // Our imports. import Permalink from 'flavours/glitch/components/permalink'; import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import Report from './report'; export default class AdminReport extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx index d982108e92..7c872e182f 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx @@ -11,7 +11,7 @@ import classNames from 'classnames'; import Permalink from 'flavours/glitch/components/permalink'; import AccountContainer from 'flavours/glitch/containers/account_container'; import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class NotificationFollow extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx b/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx index cd150314b7..0602b4cf00 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class ClearColumnButton extends React.Component { diff --git a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx index 7f36fb8135..cc83fa5cfd 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const tooltips = defineMessages({ mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' }, diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx index e9ef70911e..88c90f3ce6 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/follow.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx @@ -11,7 +11,7 @@ import classNames from 'classnames'; import Permalink from 'flavours/glitch/components/permalink'; import AccountContainer from 'flavours/glitch/containers/account_container'; import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class NotificationFollow extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx index 2b985bc085..d7c229404b 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx @@ -1,15 +1,15 @@ import React, { Fragment } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import NotificationOverlayContainer from '../containers/overlay_container'; import { HotKeys } from 'react-hotkeys'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx b/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx index 5a12191a51..8868cc0cb4 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx @@ -1,7 +1,7 @@ import React from 'react'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import Button from 'flavours/glitch/components/button'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { requestBrowserPermission } from 'flavours/glitch/actions/notifications'; import { changeSetting } from 'flavours/glitch/actions/settings'; import { connect } from 'react-redux'; diff --git a/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx b/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx index 554a7a668e..00e6257380 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/overlay.jsx @@ -9,7 +9,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; const messages = defineMessages({ markForDeletion: { id: 'notification.markForDeletion', defaultMessage: 'Mark for deletion' }, diff --git a/app/javascript/flavours/glitch/features/notifications/components/report.jsx b/app/javascript/flavours/glitch/features/notifications/components/report.jsx index 5cff01dacd..b2e795b2d1 100644 --- a/app/javascript/flavours/glitch/features/notifications/components/report.jsx +++ b/app/javascript/flavours/glitch/features/notifications/components/report.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import AvatarOverlay from 'flavours/glitch/components/avatar_overlay'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; const messages = defineMessages({ openReport: { id: 'report_notification.open', defaultMessage: 'Open report' }, diff --git a/app/javascript/flavours/glitch/features/notifications/index.jsx b/app/javascript/flavours/glitch/features/notifications/index.jsx index b9c9d82031..c1042c1367 100644 --- a/app/javascript/flavours/glitch/features/notifications/index.jsx +++ b/app/javascript/flavours/glitch/features/notifications/index.jsx @@ -25,10 +25,10 @@ import { List as ImmutableList } from 'immutable'; import { debounce } from 'lodash'; import ScrollableList from 'flavours/glitch/components/scrollable_list'; import LoadGap from 'flavours/glitch/components/load_gap'; -import Icon from 'flavours/glitch/components/icon'; -import compareId from 'flavours/glitch/compare_id'; +import { Icon } from 'flavours/glitch/components/icon'; +import { compareId } from 'flavours/glitch/compare_id'; import NotificationsPermissionBanner from './components/notifications_permission_banner'; -import NotSignedInIndicator from 'flavours/glitch/components/not_signed_in_indicator'; +import { NotSignedInIndicator } from 'flavours/glitch/components/not_signed_in_indicator'; import { Helmet } from 'react-helmet'; import NotificationPurgeButtonsContainer from 'flavours/glitch/containers/notification_purge_buttons_container'; diff --git a/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx b/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx index 51fe023d32..01a823f173 100644 --- a/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx +++ b/app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import classNames from 'classnames'; import { me, boostModal } from 'flavours/glitch/initial_state'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx b/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx index b9b90f1d8f..b9c72c276c 100644 --- a/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx +++ b/app/javascript/flavours/glitch/features/picture_in_picture/components/header.jsx @@ -3,9 +3,9 @@ import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { Link } from 'react-router-dom'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/reblogs/index.jsx b/app/javascript/flavours/glitch/features/reblogs/index.jsx index 34fe24d3fe..fe74f1fbcc 100644 --- a/app/javascript/flavours/glitch/features/reblogs/index.jsx +++ b/app/javascript/flavours/glitch/features/reblogs/index.jsx @@ -6,7 +6,7 @@ import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import { fetchReblogs } from 'flavours/glitch/actions/interactions'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import ColumnHeader from 'flavours/glitch/components/column_header'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx b/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx index 2231fc0ce2..6b74aafeea 100644 --- a/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx +++ b/app/javascript/flavours/glitch/features/report/components/status_check_box.jsx @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import Option from './option'; import MediaAttachments from 'flavours/glitch/components/media_attachments'; import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; diff --git a/app/javascript/flavours/glitch/features/status/components/action_bar.jsx b/app/javascript/flavours/glitch/features/status/components/action_bar.jsx index d5ab730d65..b1998a8fce 100644 --- a/app/javascript/flavours/glitch/features/status/components/action_bar.jsx +++ b/app/javascript/flavours/glitch/features/status/components/action_bar.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import ImmutablePropTypes from 'react-immutable-proptypes'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/status/components/card.jsx b/app/javascript/flavours/glitch/features/status/components/card.jsx index af3fe4bf09..9b84da06e5 100644 --- a/app/javascript/flavours/glitch/features/status/components/card.jsx +++ b/app/javascript/flavours/glitch/features/status/components/card.jsx @@ -5,9 +5,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import classnames from 'classnames'; import { decode as decodeIDNA } from 'flavours/glitch/utils/idna'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { useBlurhash } from 'flavours/glitch/initial_state'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; const getHostname = url => { const parser = document.createElement('a'); diff --git a/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx b/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx index 3f5b119444..26f40c3e05 100644 --- a/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx +++ b/app/javascript/flavours/glitch/features/status/components/detailed_status.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import DisplayName from 'flavours/glitch/components/display_name'; import StatusContent from 'flavours/glitch/components/status_content'; import MediaGallery from 'flavours/glitch/components/media_gallery'; @@ -16,8 +16,8 @@ import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; import scheduleIdleTask from '../../ui/util/schedule_idle_task'; import classNames from 'classnames'; import PollContainer from 'flavours/glitch/containers/poll_container'; -import Icon from 'flavours/glitch/components/icon'; -import AnimatedNumber from 'flavours/glitch/components/animated_number'; +import { Icon } from 'flavours/glitch/components/icon'; +import { AnimatedNumber } from 'flavours/glitch/components/animated_number'; import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder'; import EditedTimestamp from 'flavours/glitch/components/edited_timestamp'; diff --git a/app/javascript/flavours/glitch/features/status/index.jsx b/app/javascript/flavours/glitch/features/status/index.jsx index 54e6691beb..46e49177ec 100644 --- a/app/javascript/flavours/glitch/features/status/index.jsx +++ b/app/javascript/flavours/glitch/features/status/index.jsx @@ -52,7 +52,7 @@ import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/initial import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning'; import { textForScreenReader, defaultMediaVisibility } from 'flavours/glitch/components/status'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { Helmet } from 'react-helmet'; import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error'; diff --git a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx b/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx index 85144a191e..5fa0053b22 100644 --- a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx +++ b/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.jsx @@ -8,7 +8,7 @@ import { is, List as ImmutableList, Set as ImmutableSet } from 'immutable'; import { languages as preloadedLanguages } from 'flavours/glitch/initial_state'; import Option from 'flavours/glitch/features/report/components/option'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import Button from 'flavours/glitch/components/button'; import { followAccount } from 'flavours/glitch/actions/accounts'; diff --git a/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx index 9a9b1a3f1f..6a98e8b533 100644 --- a/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/actions_modal.jsx @@ -3,11 +3,11 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import DisplayName from 'flavours/glitch/components/display_name'; import classNames from 'classnames'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; export default class ActionsModal extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx index d9523a26ed..939e9765e8 100644 --- a/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/boost_modal.jsx @@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from 'flavours/glitch/components/button'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import DisplayName from 'flavours/glitch/components/display_name'; import AttachmentList from 'flavours/glitch/components/attachment_list'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PrivacyDropdown from 'flavours/glitch/features/compose/components/privacy_dropdown'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx b/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx index b791054503..53a51967ae 100644 --- a/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; const messages = defineMessages({ error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' }, diff --git a/app/javascript/flavours/glitch/features/ui/components/column_header.jsx b/app/javascript/flavours/glitch/features/ui/components/column_header.jsx index 151476f8ba..2b5d7abe28 100644 --- a/app/javascript/flavours/glitch/features/ui/components/column_header.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/column_header.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; export default class ColumnHeader extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/ui/components/column_link.jsx b/app/javascript/flavours/glitch/features/ui/components/column_link.jsx index 10b46f93d1..4b02c9befc 100644 --- a/app/javascript/flavours/glitch/features/ui/components/column_link.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/column_link.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import classNames from 'classnames'; const ColumnLink = ({ icon, text, to, onClick, href, method, badge, transparent, ...other }) => { diff --git a/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx index cc3a16d170..e0083e3f11 100644 --- a/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/compare_history_modal.jsx @@ -7,8 +7,8 @@ import { closeModal } from 'flavours/glitch/actions/modal'; import emojify from 'flavours/glitch/features/emoji/emoji'; import escapeTextContentForBrowser from 'escape-html'; import InlineAccount from 'flavours/glitch/components/inline_account'; -import IconButton from 'flavours/glitch/components/icon_button'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { IconButton } from 'flavours/glitch/components/icon_button'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import MediaAttachments from 'flavours/glitch/components/media_attachments'; const mapStateToProps = (state, { statusId }) => ({ diff --git a/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx index 3face11463..d90cb920c4 100644 --- a/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/deprecated_settings_modal.jsx @@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { preferenceLink } from 'flavours/glitch/utils/backend_links'; import Button from 'flavours/glitch/components/button'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import illustration from 'flavours/glitch/images/logo_warn_glitch.svg'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx index 0b66ad09d2..7891cfa948 100644 --- a/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx @@ -6,7 +6,7 @@ import Atrament from 'atrament'; // the doodling library import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { doodleSet, uploadCompose } from 'flavours/glitch/actions/compose'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { debounce, mapValues } from 'lodash'; import classNames from 'classnames'; diff --git a/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx index 4f1173fd56..1c83517a17 100644 --- a/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/embed_modal.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import api from 'flavours/glitch/api'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, diff --git a/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx index fa6f117925..03e93cd27c 100644 --- a/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/favourite_modal.jsx @@ -4,11 +4,11 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from 'flavours/glitch/components/button'; import StatusContent from 'flavours/glitch/components/status_content'; -import Avatar from 'flavours/glitch/components/avatar'; -import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp'; +import { Avatar } from 'flavours/glitch/components/avatar'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import DisplayName from 'flavours/glitch/components/display_name'; import AttachmentList from 'flavours/glitch/components/attachment_list'; -import Icon from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import ImmutablePureComponent from 'react-immutable-pure-component'; import classNames from 'classnames'; import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon'; diff --git a/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx index 440a6ac4b2..27d2bada2d 100644 --- a/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/filter_modal.jsx @@ -5,7 +5,7 @@ import { fetchFilters, createFilter, createFilterStatus } from 'flavours/glitch/ import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import SelectFilter from 'flavours/glitch/features/filters/select_filter'; import AddedToFilter from 'flavours/glitch/features/filters/added_to_filter'; diff --git a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx index 78aee8dfe0..2b61bad70e 100644 --- a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx @@ -7,7 +7,7 @@ import classNames from 'classnames'; import { changeUploadCompose, uploadThumbnail, onChangeMediaDescription, onChangeMediaFocus } from 'flavours/glitch/actions/compose'; import Video, { getPointerPosition } from 'flavours/glitch/features/video'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import Button from 'flavours/glitch/components/button'; import Audio from 'flavours/glitch/features/audio'; import Textarea from 'react-textarea-autosize'; @@ -15,7 +15,7 @@ import UploadProgress from 'flavours/glitch/features/compose/components/upload_p import CharacterCounter from 'flavours/glitch/features/compose/components/character_counter'; import { length } from 'stringz'; import { Tesseract as fetchTesseract } from 'flavours/glitch/features/ui/util/async-components'; -import GIFV from 'flavours/glitch/components/gifv'; +import { GIFV } from 'flavours/glitch/components/gifv'; import { me } from 'flavours/glitch/initial_state'; // eslint-disable-next-line import/no-extraneous-dependencies import tesseractCorePath from 'tesseract.js-core/tesseract-core.wasm.js'; diff --git a/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx b/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx index f3e3b78ed9..1a5f4418cd 100644 --- a/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/follow_requests_column_link.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { fetchFollowRequests } from 'flavours/glitch/actions/accounts'; import { connect } from 'react-redux'; import ColumnLink from 'flavours/glitch/features/ui/components/column_link'; -import IconWithBadge from 'flavours/glitch/components/icon_with_badge'; +import { IconWithBadge } from 'flavours/glitch/components/icon_with_badge'; import { List as ImmutableList } from 'immutable'; import { injectIntl, defineMessages } from 'react-intl'; diff --git a/app/javascript/flavours/glitch/features/ui/components/header.jsx b/app/javascript/flavours/glitch/features/ui/components/header.jsx index 42ed4d9013..519f917caa 100644 --- a/app/javascript/flavours/glitch/features/ui/components/header.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/header.jsx @@ -3,7 +3,7 @@ import { WordmarkLogo, SymbolLogo } from 'flavours/glitch/components/logo'; import { Link, withRouter } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import { registrationsOpen, me } from 'flavours/glitch/initial_state'; -import Avatar from 'flavours/glitch/components/avatar'; +import { Avatar } from 'flavours/glitch/components/avatar'; import Permalink from 'flavours/glitch/components/permalink'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; diff --git a/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx index 5198b88092..21d7ae8f38 100644 --- a/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/image_modal.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import ImageLoader from './image_loader'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx index 6ca96b743e..1e51db0099 100644 --- a/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx @@ -6,11 +6,11 @@ import Video from 'flavours/glitch/features/video'; import { connect } from 'react-redux'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImageLoader from './image_loader'; -import Icon from 'flavours/glitch/components/icon'; -import GIFV from 'flavours/glitch/components/gifv'; +import { Icon } from 'flavours/glitch/components/icon'; +import { GIFV } from 'flavours/glitch/components/gifv'; import Footer from 'flavours/glitch/features/picture_in_picture/components/footer'; import { getAverageFromBlurhash } from 'flavours/glitch/blurhash'; import { disableSwiping } from 'flavours/glitch/initial_state'; diff --git a/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js b/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js index 6b52ef9b46..db54c16185 100644 --- a/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js +++ b/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import IconWithBadge from 'flavours/glitch/components/icon_with_badge'; +import { IconWithBadge } from 'flavours/glitch/components/icon_with_badge'; const mapStateToProps = state => ({ count: state.getIn(['local_settings', 'notifications', 'tab_badge']) ? state.getIn(['notifications', 'unread']) : 0, diff --git a/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx index 79b4958771..b27e69230c 100644 --- a/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/report_modal.jsx @@ -10,7 +10,7 @@ import { makeGetAccount } from 'flavours/glitch/selectors'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { OrderedSet } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import Category from 'flavours/glitch/features/report/category'; import Statuses from 'flavours/glitch/features/report/statuses'; import Rules from 'flavours/glitch/features/report/rules'; diff --git a/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx b/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx index 47401cfe4c..51defec512 100644 --- a/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/zoomable_image.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import IconButton from 'flavours/glitch/components/icon_button'; +import { IconButton } from 'flavours/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/flavours/glitch/features/video/index.jsx b/app/javascript/flavours/glitch/features/video/index.jsx index 78d36edb70..fb791fa9f3 100644 --- a/app/javascript/flavours/glitch/features/video/index.jsx +++ b/app/javascript/flavours/glitch/features/video/index.jsx @@ -6,8 +6,8 @@ import { throttle } from 'lodash'; import classNames from 'classnames'; import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen'; import { displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; -import Icon from 'flavours/glitch/components/icon'; -import Blurhash from 'flavours/glitch/components/blurhash'; +import { Icon } from 'flavours/glitch/components/icon'; +import { Blurhash } from 'flavours/glitch/components/blurhash'; const messages = defineMessages({ play: { id: 'video.play', defaultMessage: 'Play' }, diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index 6e3bdda633..d95d0c9780 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -54,7 +54,7 @@ import { TIMELINE_DELETE } from 'flavours/glitch/actions/timelines'; import { STORE_HYDRATE } from 'flavours/glitch/actions/store'; import { REDRAFT } from 'flavours/glitch/actions/statuses'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; import { privacyPreference } from 'flavours/glitch/utils/privacy_preference'; import { me, defaultContentType } from 'flavours/glitch/initial_state'; import { overwrite } from 'flavours/glitch/utils/js_helpers'; diff --git a/app/javascript/flavours/glitch/reducers/contexts.js b/app/javascript/flavours/glitch/reducers/contexts.js index aea77ae41e..020a84dec1 100644 --- a/app/javascript/flavours/glitch/reducers/contexts.js +++ b/app/javascript/flavours/glitch/reducers/contexts.js @@ -5,7 +5,7 @@ import { import { CONTEXT_FETCH_SUCCESS } from 'flavours/glitch/actions/statuses'; import { TIMELINE_DELETE, TIMELINE_UPDATE } from 'flavours/glitch/actions/timelines'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ inReplyTos: ImmutableMap(), diff --git a/app/javascript/flavours/glitch/reducers/conversations.js b/app/javascript/flavours/glitch/reducers/conversations.js index 48b70cc33e..149d210398 100644 --- a/app/javascript/flavours/glitch/reducers/conversations.js +++ b/app/javascript/flavours/glitch/reducers/conversations.js @@ -11,7 +11,7 @@ import { } from '../actions/conversations'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'flavours/glitch/actions/accounts'; import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ items: ImmutableList(), diff --git a/app/javascript/flavours/glitch/reducers/notifications.js b/app/javascript/flavours/glitch/reducers/notifications.js index d5b1568e90..ccd715a22e 100644 --- a/app/javascript/flavours/glitch/reducers/notifications.js +++ b/app/javascript/flavours/glitch/reducers/notifications.js @@ -32,7 +32,7 @@ import { import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks'; import { TIMELINE_DELETE, TIMELINE_DISCONNECT } from 'flavours/glitch/actions/timelines'; import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap({ pendingItems: ImmutableList(), diff --git a/app/javascript/flavours/glitch/reducers/settings.js b/app/javascript/flavours/glitch/reducers/settings.js index e69eee9660..0e52762f25 100644 --- a/app/javascript/flavours/glitch/reducers/settings.js +++ b/app/javascript/flavours/glitch/reducers/settings.js @@ -6,7 +6,7 @@ import { EMOJI_USE } from 'flavours/glitch/actions/emojis'; import { LANGUAGE_USE } from 'flavours/glitch/actions/languages'; import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists'; import { Map as ImmutableMap, fromJS } from 'immutable'; -import uuid from '../uuid'; +import { uuid } from '../uuid'; const initialState = ImmutableMap({ saved: true, diff --git a/app/javascript/flavours/glitch/reducers/timelines.js b/app/javascript/flavours/glitch/reducers/timelines.js index 96a6ca961f..1c0b1187e6 100644 --- a/app/javascript/flavours/glitch/reducers/timelines.js +++ b/app/javascript/flavours/glitch/reducers/timelines.js @@ -17,7 +17,7 @@ import { ACCOUNT_UNFOLLOW_SUCCESS, } from 'flavours/glitch/actions/accounts'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import compareId from '../compare_id'; +import { compareId } from '../compare_id'; const initialState = ImmutableMap(); diff --git a/app/javascript/flavours/glitch/types/image.d.ts b/app/javascript/flavours/glitch/types/image.d.ts index 8bd6ab0286..fae2ed7014 100644 --- a/app/javascript/flavours/glitch/types/image.d.ts +++ b/app/javascript/flavours/glitch/types/image.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/no-default-export */ declare module '*.avif' { const path: string; export default path; diff --git a/app/javascript/flavours/glitch/uuid.ts b/app/javascript/flavours/glitch/uuid.ts index 655bcf78c6..ac5414482d 100644 --- a/app/javascript/flavours/glitch/uuid.ts +++ b/app/javascript/flavours/glitch/uuid.ts @@ -1,3 +1,3 @@ -export default function uuid(a?: string): string { +export function uuid(a?: string): string { return a ? ((a as any as number) ^ Math.random() * 16 >> (a as any as number) / 4).toString(16) : ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); } From 81b01c961bcddb99ee79cf4686cc55358e2c1491 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 9 May 2023 23:03:23 +0200 Subject: [PATCH 038/508] Disable broken onboarding code --- app/javascript/flavours/glitch/features/ui/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/ui/index.jsx b/app/javascript/flavours/glitch/features/ui/index.jsx index cc7937e5e2..a29070bc7a 100644 --- a/app/javascript/flavours/glitch/features/ui/index.jsx +++ b/app/javascript/flavours/glitch/features/ui/index.jsx @@ -58,7 +58,7 @@ import { } from './util/async-components'; import { HotKeys } from 'react-hotkeys'; import initialState, { me, owner, singleUserMode, showTrends, trendsAsLanding } from '../../initial_state'; -import { closeOnboarding, INTRODUCTION_VERSION } from 'flavours/glitch/actions/onboarding'; +// TODO: import { closeOnboarding, INTRODUCTION_VERSION } from 'flavours/glitch/actions/onboarding'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import Header from './components/header'; @@ -82,7 +82,7 @@ const mapStateToProps = state => ({ showFaviconBadge: state.getIn(['local_settings', 'notifications', 'favicon_badge']), hicolorPrivacyIcons: state.getIn(['local_settings', 'hicolor_privacy_icons']), moved: state.getIn(['accounts', me, 'moved']) && state.getIn(['accounts', state.getIn(['accounts', me, 'moved'])]), - firstLaunch: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION, + firstLaunch: false, // TODO: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION, username: state.getIn(['accounts', me, 'username']), }); @@ -405,7 +405,7 @@ class UI extends React.Component { // On first launch, redirect to the follow recommendations page if (signedIn && this.props.firstLaunch) { this.context.router.history.replace('/start'); - this.props.dispatch(closeOnboarding()); + // TODO: this.props.dispatch(closeOnboarding()); } if (signedIn) { From cbca95463259d7bf5586a253be902773a6487d14 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Wed, 10 May 2023 06:08:28 +0900 Subject: [PATCH 039/508] Rename Image component to ServerHeroImage (#24894) --- app/javascript/mastodon/components/server_banner.jsx | 4 ++-- .../mastodon/components/{image.tsx => server_hero_image.tsx} | 2 +- app/javascript/mastodon/features/about/index.jsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename app/javascript/mastodon/components/{image.tsx => server_hero_image.tsx} (93%) diff --git a/app/javascript/mastodon/components/server_banner.jsx b/app/javascript/mastodon/components/server_banner.jsx index 991907a3f0..9669decc85 100644 --- a/app/javascript/mastodon/components/server_banner.jsx +++ b/app/javascript/mastodon/components/server_banner.jsx @@ -7,7 +7,7 @@ import ShortNumber from 'mastodon/components/short_number'; import Skeleton from 'mastodon/components/skeleton'; import Account from 'mastodon/containers/account_container'; import { domain } from 'mastodon/initial_state'; -import { Image } from 'mastodon/components/image'; +import { ServerHeroImage } from 'mastodon/components/server_hero_image'; import { Link } from 'react-router-dom'; const messages = defineMessages({ @@ -41,7 +41,7 @@ class ServerBanner extends React.PureComponent { {domain}, mastodon: Mastodon }} />
- +
{isLoading ? ( diff --git a/app/javascript/mastodon/components/image.tsx b/app/javascript/mastodon/components/server_hero_image.tsx similarity index 93% rename from app/javascript/mastodon/components/image.tsx rename to app/javascript/mastodon/components/server_hero_image.tsx index 490543424a..d10b8a620b 100644 --- a/app/javascript/mastodon/components/image.tsx +++ b/app/javascript/mastodon/components/server_hero_image.tsx @@ -9,7 +9,7 @@ type Props = { className?: string; }; -export const Image: React.FC = ({ +export const ServerHeroImage: React.FC = ({ src, srcSet, blurhash, diff --git a/app/javascript/mastodon/features/about/index.jsx b/app/javascript/mastodon/features/about/index.jsx index 11aff67c67..f025a9633a 100644 --- a/app/javascript/mastodon/features/about/index.jsx +++ b/app/javascript/mastodon/features/about/index.jsx @@ -11,7 +11,7 @@ import Account from 'mastodon/containers/account_container'; import Skeleton from 'mastodon/components/skeleton'; import { Icon } from 'mastodon/components/icon'; import classNames from 'classnames'; -import { Image } from 'mastodon/components/image'; +import { ServerHeroImage } from 'mastodon/components/server_hero_image'; const messages = defineMessages({ title: { id: 'column.about', defaultMessage: 'About' }, @@ -114,7 +114,7 @@ class About extends React.PureComponent {
- `${value} ${key.replace('@', '')}`).join(', ')} className='about__header__hero' /> + `${value} ${key.replace('@', '')}`).join(', ')} className='about__header__hero' />

{isLoading ? : server.get('domain')}

Mastodon }} />

From a150bb4f2ef7078ffe26f27cf9adab2d72c0bca8 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Wed, 10 May 2023 06:08:54 +0900 Subject: [PATCH 040/508] Add type annotation for DisplayName component (#24752) --- .../__tests__/display_name-test.jsx | 2 +- .../mastodon/components/account.jsx | 2 +- .../mastodon/components/display_name.jsx | 79 ------------ .../mastodon/components/display_name.tsx | 115 ++++++++++++++++++ app/javascript/mastodon/components/status.jsx | 2 +- .../components/moved_note.jsx | 2 +- .../components/autosuggest_account.jsx | 2 +- .../compose/components/reply_indicator.jsx | 2 +- .../directory/components/account_card.jsx | 2 +- .../components/account_authorize.jsx | 2 +- .../list_adder/components/account.jsx | 2 +- .../list_editor/components/account.jsx | 2 +- .../components/follow_request.jsx | 2 +- .../picture_in_picture/components/header.jsx | 2 +- .../report/components/status_check_box.jsx | 2 +- .../status/components/detailed_status.jsx | 2 +- .../features/ui/components/boost_modal.jsx | 2 +- 17 files changed, 130 insertions(+), 94 deletions(-) delete mode 100644 app/javascript/mastodon/components/display_name.jsx create mode 100644 app/javascript/mastodon/components/display_name.tsx diff --git a/app/javascript/mastodon/components/__tests__/display_name-test.jsx b/app/javascript/mastodon/components/__tests__/display_name-test.jsx index 0d040c4cd8..afb6c4758a 100644 --- a/app/javascript/mastodon/components/__tests__/display_name-test.jsx +++ b/app/javascript/mastodon/components/__tests__/display_name-test.jsx @@ -1,7 +1,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; -import DisplayName from '../display_name'; +import { DisplayName } from '../display_name'; describe('', () => { it('renders display name + account name', () => { diff --git a/app/javascript/mastodon/components/account.jsx b/app/javascript/mastodon/components/account.jsx index b0bbea7ce4..f110bce7a8 100644 --- a/app/javascript/mastodon/components/account.jsx +++ b/app/javascript/mastodon/components/account.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { Avatar } from './avatar'; -import DisplayName from './display_name'; +import { DisplayName } from './display_name'; import { IconButton } from './icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/components/display_name.jsx b/app/javascript/mastodon/components/display_name.jsx deleted file mode 100644 index 1dd9fb1d67..0000000000 --- a/app/javascript/mastodon/components/display_name.jsx +++ /dev/null @@ -1,79 +0,0 @@ -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { autoPlayGif } from 'mastodon/initial_state'; -import Skeleton from 'mastodon/components/skeleton'; - -export default class DisplayName extends React.PureComponent { - - static propTypes = { - account: ImmutablePropTypes.map, - others: ImmutablePropTypes.list, - localDomain: PropTypes.string, - }; - - handleMouseEnter = ({ currentTarget }) => { - if (autoPlayGif) { - return; - } - - const emojis = currentTarget.querySelectorAll('.custom-emoji'); - - for (var i = 0; i < emojis.length; i++) { - let emoji = emojis[i]; - emoji.src = emoji.getAttribute('data-original'); - } - }; - - handleMouseLeave = ({ currentTarget }) => { - if (autoPlayGif) { - return; - } - - const emojis = currentTarget.querySelectorAll('.custom-emoji'); - - for (var i = 0; i < emojis.length; i++) { - let emoji = emojis[i]; - emoji.src = emoji.getAttribute('data-static'); - } - }; - - render () { - const { others, localDomain } = this.props; - - let displayName, suffix, account; - - if (others && others.size > 1) { - displayName = others.take(2).map(a => ).reduce((prev, cur) => [prev, ', ', cur]); - - if (others.size - 2 > 0) { - suffix = `+${others.size - 2}`; - } - } else if ((others && others.size > 0) || this.props.account) { - if (others && others.size > 0) { - account = others.first(); - } else { - account = this.props.account; - } - - let acct = account.get('acct'); - - if (acct.indexOf('@') === -1 && localDomain) { - acct = `${acct}@${localDomain}`; - } - - displayName = ; - suffix = @{acct}; - } else { - displayName = ; - suffix = ; - } - - return ( - - {displayName} {suffix} - - ); - } - -} diff --git a/app/javascript/mastodon/components/display_name.tsx b/app/javascript/mastodon/components/display_name.tsx new file mode 100644 index 0000000000..0452dba794 --- /dev/null +++ b/app/javascript/mastodon/components/display_name.tsx @@ -0,0 +1,115 @@ +import React from 'react'; +import { autoPlayGif } from '..//initial_state'; +import Skeleton from './skeleton'; +import { Account } from '../../types/resources'; +import { List } from 'immutable'; + +type Props = { + account: Account; + others: List; + localDomain: string; +}; +export class DisplayName extends React.PureComponent { + handleMouseEnter: React.ReactEventHandler = ({ + currentTarget, + }) => { + if (autoPlayGif) { + return; + } + + const emojis = + currentTarget.querySelectorAll('img.custom-emoji'); + + emojis.forEach((emoji) => { + const originalSrc = emoji.getAttribute('data-original'); + if (originalSrc != null) emoji.src = originalSrc; + }); + }; + + handleMouseLeave: React.ReactEventHandler = ({ + currentTarget, + }) => { + if (autoPlayGif) { + return; + } + + const emojis = + currentTarget.querySelectorAll('img.custom-emoji'); + + emojis.forEach((emoji) => { + const staticSrc = emoji.getAttribute('data-static'); + if (staticSrc != null) emoji.src = staticSrc; + }); + }; + + render() { + const { others, localDomain } = this.props; + + let displayName: React.ReactNode, suffix: React.ReactNode, account: Account; + + if (others && others.size > 1) { + displayName = others + .take(2) + .map((a) => ( + + + + )) + .reduce((prev, cur) => [prev, ', ', cur]); + + if (others.size - 2 > 0) { + suffix = `+${others.size - 2}`; + } + } else if ((others && others.size > 0) || this.props.account) { + if (others && others.size > 0) { + account = others.first(); + } else { + account = this.props.account; + } + + let acct = account.get('acct'); + + if (acct.indexOf('@') === -1 && localDomain) { + acct = `${acct}@${localDomain}`; + } + + displayName = ( + + + + ); + suffix = @{acct}; + } else { + displayName = ( + + + + + + ); + suffix = ( + + + + ); + } + + return ( + + {displayName} {suffix} + + ); + } +} diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx index 3ca840b720..8cd322edab 100644 --- a/app/javascript/mastodon/components/status.jsx +++ b/app/javascript/mastodon/components/status.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { Avatar } from './avatar'; import { AvatarOverlay } from './avatar_overlay'; import { RelativeTimestamp } from './relative_timestamp'; -import DisplayName from './display_name'; +import { DisplayName } from './display_name'; import StatusContent from './status_content'; import StatusActionBar from './status_action_bar'; import AttachmentList from './attachment_list'; diff --git a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx b/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx index 273583c0ad..29861612c3 100644 --- a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx +++ b/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx @@ -3,7 +3,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { AvatarOverlay } from '../../../components/avatar_overlay'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import { Link } from 'react-router-dom'; export default class MovedNote extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx b/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx index 2c92016e86..a635657d9f 100644 --- a/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx +++ b/app/javascript/mastodon/features/compose/components/autosuggest_account.jsx @@ -1,6 +1,6 @@ import React from 'react'; import { Avatar } from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/reply_indicator.jsx b/app/javascript/mastodon/features/compose/components/reply_indicator.jsx index 68cd7b0804..b3f1b1b482 100644 --- a/app/javascript/mastodon/features/compose/components/reply_indicator.jsx +++ b/app/javascript/mastodon/features/compose/components/reply_indicator.jsx @@ -3,7 +3,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { Avatar } from '../../../components/avatar'; import { IconButton } from '../../../components/icon_button'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import AttachmentList from 'mastodon/components/attachment_list'; diff --git a/app/javascript/mastodon/features/directory/components/account_card.jsx b/app/javascript/mastodon/features/directory/components/account_card.jsx index 4951427151..1ef9d64813 100644 --- a/app/javascript/mastodon/features/directory/components/account_card.jsx +++ b/app/javascript/mastodon/features/directory/components/account_card.jsx @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from 'mastodon/selectors'; import { Avatar } from 'mastodon/components/avatar'; -import DisplayName from 'mastodon/components/display_name'; +import { DisplayName } from 'mastodon/components/display_name'; import { Link } from 'react-router-dom'; import Button from 'mastodon/components/button'; import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx b/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx index b370b33ecb..5d0632b0f6 100644 --- a/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx +++ b/app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Link } from 'react-router-dom'; import { Avatar } from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/list_adder/components/account.jsx b/app/javascript/mastodon/features/list_adder/components/account.jsx index 410f1537a5..5dc384aba6 100644 --- a/app/javascript/mastodon/features/list_adder/components/account.jsx +++ b/app/javascript/mastodon/features/list_adder/components/account.jsx @@ -4,7 +4,7 @@ import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Avatar } from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import { injectIntl } from 'react-intl'; const makeMapStateToProps = () => { diff --git a/app/javascript/mastodon/features/list_editor/components/account.jsx b/app/javascript/mastodon/features/list_editor/components/account.jsx index b46d0504a4..fc1d2d6071 100644 --- a/app/javascript/mastodon/features/list_editor/components/account.jsx +++ b/app/javascript/mastodon/features/list_editor/components/account.jsx @@ -5,7 +5,7 @@ import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Avatar } from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import { IconButton } from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListEditor, addToListEditor } from '../../../actions/lists'; diff --git a/app/javascript/mastodon/features/notifications/components/follow_request.jsx b/app/javascript/mastodon/features/notifications/components/follow_request.jsx index 0d930f0b1f..d8b2ca1cc9 100644 --- a/app/javascript/mastodon/features/notifications/components/follow_request.jsx +++ b/app/javascript/mastodon/features/notifications/components/follow_request.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { Avatar } from 'mastodon/components/avatar'; -import DisplayName from 'mastodon/components/display_name'; +import { DisplayName } from 'mastodon/components/display_name'; import { Link } from 'react-router-dom'; import { IconButton } from 'mastodon/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/picture_in_picture/components/header.jsx b/app/javascript/mastodon/features/picture_in_picture/components/header.jsx index c6d2a103dc..c1c04da548 100644 --- a/app/javascript/mastodon/features/picture_in_picture/components/header.jsx +++ b/app/javascript/mastodon/features/picture_in_picture/components/header.jsx @@ -6,7 +6,7 @@ import PropTypes from 'prop-types'; import { IconButton } from 'mastodon/components/icon_button'; import { Link } from 'react-router-dom'; import { Avatar } from 'mastodon/components/avatar'; -import DisplayName from 'mastodon/components/display_name'; +import { DisplayName } from 'mastodon/components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/report/components/status_check_box.jsx b/app/javascript/mastodon/features/report/components/status_check_box.jsx index 003cdc8e3a..8d6091f778 100644 --- a/app/javascript/mastodon/features/report/components/status_check_box.jsx +++ b/app/javascript/mastodon/features/report/components/status_check_box.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import StatusContent from 'mastodon/components/status_content'; import { Avatar } from 'mastodon/components/avatar'; -import DisplayName from 'mastodon/components/display_name'; +import { DisplayName } from 'mastodon/components/display_name'; import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import Option from './option'; import MediaAttachments from 'mastodon/components/media_attachments'; diff --git a/app/javascript/mastodon/features/status/components/detailed_status.jsx b/app/javascript/mastodon/features/status/components/detailed_status.jsx index 72c9021242..5019dfdb4d 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.jsx +++ b/app/javascript/mastodon/features/status/components/detailed_status.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Avatar } from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import StatusContent from '../../../components/status_content'; import MediaGallery from '../../../components/media_gallery'; import { Link } from 'react-router-dom'; diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.jsx b/app/javascript/mastodon/features/ui/components/boost_modal.jsx index 1f28927d60..4eeb30be09 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/boost_modal.jsx @@ -7,7 +7,7 @@ import Button from '../../../components/button'; import StatusContent from '../../../components/status_content'; import { Avatar } from '../../../components/avatar'; import { RelativeTimestamp } from '../../../components/relative_timestamp'; -import DisplayName from '../../../components/display_name'; +import { DisplayName } from '../../../components/display_name'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { Icon } from 'mastodon/components/icon'; import AttachmentList from 'mastodon/components/attachment_list'; From c5fb52eb23ed09a80afc6e03ed1f2146d4bdd2ff Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Tue, 9 May 2023 19:09:32 +0900 Subject: [PATCH 041/508] [Glitch] Add more detailed type annotation for Account Port a2e9b9d87db4753bd6a6d182b903c4b485ed8ff9 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/types/resources.ts | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/types/resources.ts b/app/javascript/flavours/glitch/types/resources.ts index 28fad2719a..0906504150 100644 --- a/app/javascript/flavours/glitch/types/resources.ts +++ b/app/javascript/flavours/glitch/types/resources.ts @@ -1,10 +1,54 @@ import type { Record } from 'immutable'; -type AccountValues = { - id: number; +type CustomEmoji = Record<{ + shortcode: string; + static_url: string; + url: string; +}>; + +type AccountField = Record<{ + name: string; + value: string; + verified_at: string | null; +}>; + +type AccountApiResponseValues = { + acct: string; avatar: string; avatar_static: string; - [key: string]: any; + bot: boolean; + created_at: string; + discoverable: boolean; + display_name: string; + emojis: CustomEmoji[]; + fields: AccountField[]; + followers_count: number; + following_count: number; + group: boolean; + header: string; + header_static: string; + id: string; + last_status_at: string; + locked: boolean; + note: string; + statuses_count: number; + url: string; + username: string; }; -export type Account = Record; +type NormalizedAccountField = Record<{ + name_emojified: string; + value_emojified: string; + value_plain: string; +}>; + +type NormalizedAccountValues = { + display_name_html: string; + fields: NormalizedAccountField[]; + note_emojified: string; + note_plain: string; +}; + +export type Account = Record< + AccountApiResponseValues & NormalizedAccountValues +>; From e8415aa727e4ba06aaef61566cca6b6866224804 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 14:55:35 +0200 Subject: [PATCH 042/508] [Glitch] Rework polyfills loading Port b640f897776fd0ff4048fd3e15009749c7de4178 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/packs/home.js | 2 +- .../flavours/glitch/packs/public.jsx | 2 +- .../flavours/glitch/packs/settings.js | 2 +- .../flavours/glitch/packs/share.jsx | 2 +- .../base_polyfills.ts} | 22 +++++-------------- .../extra_polyfills.ts} | 0 .../{load_polyfills.js => polyfills/index.ts} | 16 ++++++-------- 7 files changed, 17 insertions(+), 29 deletions(-) rename app/javascript/flavours/glitch/{base_polyfills.js => polyfills/base_polyfills.ts} (58%) rename app/javascript/flavours/glitch/{extra_polyfills.js => polyfills/extra_polyfills.ts} (100%) rename app/javascript/flavours/glitch/{load_polyfills.js => polyfills/index.ts} (82%) diff --git a/app/javascript/flavours/glitch/packs/home.js b/app/javascript/flavours/glitch/packs/home.js index ace9dc3c4f..a28625d33b 100644 --- a/app/javascript/flavours/glitch/packs/home.js +++ b/app/javascript/flavours/glitch/packs/home.js @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; loadPolyfills().then(async () => { const { default: main } = await import('flavours/glitch/main'); diff --git a/app/javascript/flavours/glitch/packs/public.jsx b/app/javascript/flavours/glitch/packs/public.jsx index f77d6d3242..34a8f35133 100644 --- a/app/javascript/flavours/glitch/packs/public.jsx +++ b/app/javascript/flavours/glitch/packs/public.jsx @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; import ready from 'flavours/glitch/ready'; import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions'; import axios from 'axios'; diff --git a/app/javascript/flavours/glitch/packs/settings.js b/app/javascript/flavours/glitch/packs/settings.js index cca71dae14..891b49337a 100644 --- a/app/javascript/flavours/glitch/packs/settings.js +++ b/app/javascript/flavours/glitch/packs/settings.js @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions'; import { delegate } from '@rails/ujs'; import 'cocoon-js-vanilla'; diff --git a/app/javascript/flavours/glitch/packs/share.jsx b/app/javascript/flavours/glitch/packs/share.jsx index 26228e448a..47a51a5b01 100644 --- a/app/javascript/flavours/glitch/packs/share.jsx +++ b/app/javascript/flavours/glitch/packs/share.jsx @@ -1,5 +1,5 @@ import 'packs/public-path'; -import loadPolyfills from 'flavours/glitch/load_polyfills'; +import { loadPolyfills } from 'flavours/glitch/polyfills'; import ComposeContainer from 'flavours/glitch/containers/compose_container'; import React from 'react'; import ReactDOM from 'react-dom'; diff --git a/app/javascript/flavours/glitch/base_polyfills.js b/app/javascript/flavours/glitch/polyfills/base_polyfills.ts similarity index 58% rename from app/javascript/flavours/glitch/base_polyfills.js rename to app/javascript/flavours/glitch/polyfills/base_polyfills.ts index 91bc5d6dc8..2e583f580d 100644 --- a/app/javascript/flavours/glitch/base_polyfills.js +++ b/app/javascript/flavours/glitch/polyfills/base_polyfills.ts @@ -1,26 +1,16 @@ import 'intl'; import 'intl/locale-data/jsonp/en'; -import 'es6-symbol/implement'; -import assign from 'object-assign'; -import values from 'object.values'; -import { decode as decodeBase64 } from './utils/base64'; -import promiseFinally from 'promise.prototype.finally'; - -if (!Object.assign) { - Object.assign = assign; -} - -if (!Object.values) { - values.shim(); -} - -promiseFinally.shim(); +import 'core-js/features/object/assign'; +import 'core-js/features/object/values'; +import 'core-js/features/symbol'; +import 'core-js/features/promise/finally'; +import { decode as decodeBase64 } from '../utils/base64'; if (!HTMLCanvasElement.prototype.toBlob) { const BASE64_MARKER = ';base64,'; Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { - value(callback, type = 'image/png', quality) { + value(callback: BlobCallback, type = 'image/png', quality: any) { const dataURL = this.toDataURL(type, quality); let data; diff --git a/app/javascript/flavours/glitch/extra_polyfills.js b/app/javascript/flavours/glitch/polyfills/extra_polyfills.ts similarity index 100% rename from app/javascript/flavours/glitch/extra_polyfills.js rename to app/javascript/flavours/glitch/polyfills/extra_polyfills.ts diff --git a/app/javascript/flavours/glitch/load_polyfills.js b/app/javascript/flavours/glitch/polyfills/index.ts similarity index 82% rename from app/javascript/flavours/glitch/load_polyfills.js rename to app/javascript/flavours/glitch/polyfills/index.ts index 7909dc4ea3..6d2e5426e4 100644 --- a/app/javascript/flavours/glitch/load_polyfills.js +++ b/app/javascript/flavours/glitch/polyfills/index.ts @@ -10,14 +10,14 @@ function importExtraPolyfills() { return import(/* webpackChunkName: "extra_polyfills" */ './extra_polyfills'); } -function loadPolyfills() { +export function loadPolyfills() { const needsBasePolyfills = !( - HTMLCanvasElement.prototype.toBlob && - window.Intl && - Object.assign && - Object.values && - window.Symbol && - Promise.prototype.finally + 'toBlob' in HTMLCanvasElement.prototype && + 'Intl' in window && + 'assign' in Object && + 'values' in Object && + 'Symbol' in window && + 'finally' in Promise.prototype ); // Latest version of Firefox and Safari do not have IntersectionObserver. @@ -36,5 +36,3 @@ function loadPolyfills() { needsExtraPolyfills && importExtraPolyfills(), ]); } - -export default loadPolyfills; From b21d2eaeb68675fa21ebafc7ff777de70c58398a Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 15:48:53 +0200 Subject: [PATCH 043/508] [Glitch] Remove unused iOS agent sniffing function Port d57be2731c24bba01a2137a22e3b8b916f5be8ab to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/is_mobile.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/javascript/flavours/glitch/is_mobile.ts b/app/javascript/flavours/glitch/is_mobile.ts index d33246882d..a3437d28b1 100644 --- a/app/javascript/flavours/glitch/is_mobile.ts +++ b/app/javascript/flavours/glitch/is_mobile.ts @@ -27,10 +27,6 @@ export const layoutFromWindow = (layout_local_setting : string): LayoutType => { } }; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-expect-error -const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && window.MSStream != null; - const listenerOptions = supportsPassiveEvents ? { passive: true } : false; let userTouching = false; @@ -44,5 +40,3 @@ const touchListener = () => { window.addEventListener('touchstart', touchListener, listenerOptions); export const isUserTouching = () => userTouching; - -export const isIOS = () => iOS; From 487715a3e35301e2eda5ec94c4945b5f00bfb91c Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 May 2023 16:56:26 +0200 Subject: [PATCH 044/508] [Glitch] Type Redux store and middleware Port d67de22458e599447c0d5c85ecbd6fb5aef9b4f4 to glitch-soc Signed-off-by: Claire --- .../glitch/containers/compose_container.jsx | 2 +- .../flavours/glitch/containers/mastodon.jsx | 2 +- app/javascript/flavours/glitch/main.jsx | 2 +- .../glitch/reducers/{index.js => index.ts} | 4 ++- .../flavours/glitch/store/configureStore.js | 16 ------------ app/javascript/flavours/glitch/store/index.ts | 23 ++++++++++++++++ .../errors.js => store/middlewares/errors.ts} | 7 ++--- .../middlewares/loading_bar.ts} | 12 ++++++--- .../sounds.js => store/middlewares/sounds.ts} | 26 +++++++++++++------ 9 files changed, 60 insertions(+), 34 deletions(-) rename app/javascript/flavours/glitch/reducers/{index.js => index.ts} (97%) delete mode 100644 app/javascript/flavours/glitch/store/configureStore.js create mode 100644 app/javascript/flavours/glitch/store/index.ts rename app/javascript/flavours/glitch/{middleware/errors.js => store/middlewares/errors.ts} (66%) rename app/javascript/flavours/glitch/{middleware/loading_bar.js => store/middlewares/loading_bar.ts} (68%) rename app/javascript/flavours/glitch/{middleware/sounds.js => store/middlewares/sounds.ts} (54%) diff --git a/app/javascript/flavours/glitch/containers/compose_container.jsx b/app/javascript/flavours/glitch/containers/compose_container.jsx index dada4cfed7..9b84ed583d 100644 --- a/app/javascript/flavours/glitch/containers/compose_container.jsx +++ b/app/javascript/flavours/glitch/containers/compose_container.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import { store } from 'flavours/glitch/store/configureStore'; +import { store } from 'flavours/glitch/store'; import { hydrateStore } from 'flavours/glitch/actions/store'; import { IntlProvider, addLocaleData } from 'react-intl'; import { getLocale } from 'mastodon/locales'; diff --git a/app/javascript/flavours/glitch/containers/mastodon.jsx b/app/javascript/flavours/glitch/containers/mastodon.jsx index aca7f4dc59..1044fdd160 100644 --- a/app/javascript/flavours/glitch/containers/mastodon.jsx +++ b/app/javascript/flavours/glitch/containers/mastodon.jsx @@ -5,7 +5,7 @@ import { IntlProvider, addLocaleData } from 'react-intl'; import { Provider as ReduxProvider } from 'react-redux'; import { BrowserRouter, Route } from 'react-router-dom'; import { ScrollContext } from 'react-router-scroll-4'; -import { store } from 'flavours/glitch/store/configureStore'; +import { store } from 'flavours/glitch/store'; import UI from 'flavours/glitch/features/ui'; import { fetchCustomEmojis } from 'flavours/glitch/actions/custom_emojis'; import { hydrateStore } from 'flavours/glitch/actions/store'; diff --git a/app/javascript/flavours/glitch/main.jsx b/app/javascript/flavours/glitch/main.jsx index fa8ba47d49..1ac7d579ec 100644 --- a/app/javascript/flavours/glitch/main.jsx +++ b/app/javascript/flavours/glitch/main.jsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { setupBrowserNotifications } from 'flavours/glitch/actions/notifications'; import Mastodon from 'flavours/glitch/containers/mastodon'; -import { store } from 'flavours/glitch/store/configureStore'; +import { store } from 'flavours/glitch/store'; import { me } from 'flavours/glitch/initial_state'; import ready from 'flavours/glitch/ready'; diff --git a/app/javascript/flavours/glitch/reducers/index.js b/app/javascript/flavours/glitch/reducers/index.ts similarity index 97% rename from app/javascript/flavours/glitch/reducers/index.js rename to app/javascript/flavours/glitch/reducers/index.ts index 5b7bdbf699..da2174fc2c 100644 --- a/app/javascript/flavours/glitch/reducers/index.js +++ b/app/javascript/flavours/glitch/reducers/index.ts @@ -91,4 +91,6 @@ const reducers = { followed_tags, }; -export default combineReducers(reducers); +const rootReducer = combineReducers(reducers); + +export { rootReducer }; diff --git a/app/javascript/flavours/glitch/store/configureStore.js b/app/javascript/flavours/glitch/store/configureStore.js deleted file mode 100644 index cb17dd9ce8..0000000000 --- a/app/javascript/flavours/glitch/store/configureStore.js +++ /dev/null @@ -1,16 +0,0 @@ -import { configureStore } from '@reduxjs/toolkit'; -import thunk from 'redux-thunk'; -import appReducer from '../reducers'; -import loadingBarMiddleware from '../middleware/loading_bar'; -import errorsMiddleware from '../middleware/errors'; -import soundsMiddleware from '../middleware/sounds'; - -export const store = configureStore({ - reducer: appReducer, - middleware: [ - thunk, - loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), - errorsMiddleware(), - soundsMiddleware(), - ], -}); diff --git a/app/javascript/flavours/glitch/store/index.ts b/app/javascript/flavours/glitch/store/index.ts new file mode 100644 index 0000000000..822c01aa90 --- /dev/null +++ b/app/javascript/flavours/glitch/store/index.ts @@ -0,0 +1,23 @@ +import { configureStore } from '@reduxjs/toolkit'; +import { rootReducer } from '../reducers'; +import { loadingBarMiddleware } from './middlewares/loading_bar'; +import { errorsMiddleware } from './middlewares/errors'; +import { soundsMiddleware } from './middlewares/sounds'; +import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; + +export const store = configureStore({ + reducer: rootReducer, + middleware: getDefaultMiddleware => + getDefaultMiddleware().concat( + loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] })) + .concat(errorsMiddleware) + .concat(soundsMiddleware()), +}); + +// Infer the `RootState` and `AppDispatch` types from the store itself +export type RootState = ReturnType +// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState} +export type AppDispatch = typeof store.dispatch + +export const useAppDispatch: () => AppDispatch = useDispatch; +export const useAppSelector: TypedUseSelectorHook = useSelector; diff --git a/app/javascript/flavours/glitch/middleware/errors.js b/app/javascript/flavours/glitch/store/middlewares/errors.ts similarity index 66% rename from app/javascript/flavours/glitch/middleware/errors.js rename to app/javascript/flavours/glitch/store/middlewares/errors.ts index 3639a59512..be9e586521 100644 --- a/app/javascript/flavours/glitch/middleware/errors.js +++ b/app/javascript/flavours/glitch/store/middlewares/errors.ts @@ -1,9 +1,11 @@ +import { Middleware } from 'redux'; import { showAlertForError } from 'flavours/glitch/actions/alerts'; +import { RootState } from '..'; const defaultFailSuffix = 'FAIL'; -export default function errorsMiddleware() { - return ({ dispatch }) => next => action => { +export const errorsMiddleware: Middleware, RootState> = + ({ dispatch }) => next => action => { if (action.type && !action.skipAlert) { const isFail = new RegExp(`${defaultFailSuffix}$`, 'g'); @@ -14,4 +16,3 @@ export default function errorsMiddleware() { return next(action); }; -} diff --git a/app/javascript/flavours/glitch/middleware/loading_bar.js b/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts similarity index 68% rename from app/javascript/flavours/glitch/middleware/loading_bar.js rename to app/javascript/flavours/glitch/store/middlewares/loading_bar.ts index da8cc4c7d3..e860b31b6f 100644 --- a/app/javascript/flavours/glitch/middleware/loading_bar.js +++ b/app/javascript/flavours/glitch/store/middlewares/loading_bar.ts @@ -1,8 +1,14 @@ import { showLoading, hideLoading } from 'react-redux-loading-bar'; +import { Middleware } from 'redux'; +import { RootState } from '..'; -const defaultTypeSuffixes = ['PENDING', 'FULFILLED', 'REJECTED']; +interface Config { + promiseTypeSuffixes?: string[] +} -export default function loadingBarMiddleware(config = {}) { +const defaultTypeSuffixes: Config['promiseTypeSuffixes'] = ['PENDING', 'FULFILLED', 'REJECTED']; + +export const loadingBarMiddleware = (config: Config = {}): Middleware, RootState> => { const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypeSuffixes; return ({ dispatch }) => next => (action) => { @@ -22,4 +28,4 @@ export default function loadingBarMiddleware(config = {}) { return next(action); }; -} +}; diff --git a/app/javascript/flavours/glitch/middleware/sounds.js b/app/javascript/flavours/glitch/store/middlewares/sounds.ts similarity index 54% rename from app/javascript/flavours/glitch/middleware/sounds.js rename to app/javascript/flavours/glitch/store/middlewares/sounds.ts index 7f23889836..c9d51f857f 100644 --- a/app/javascript/flavours/glitch/middleware/sounds.js +++ b/app/javascript/flavours/glitch/store/middlewares/sounds.ts @@ -1,4 +1,12 @@ -const createAudio = sources => { +import { Middleware, AnyAction } from 'redux'; +import { RootState } from '..'; + +interface AudioSource { + src: string + type: string +} + +const createAudio = (sources: AudioSource[]) => { const audio = new Audio(); sources.forEach(({ type, src }) => { const source = document.createElement('source'); @@ -9,7 +17,7 @@ const createAudio = sources => { return audio; }; -const play = audio => { +const play = (audio: HTMLAudioElement) => { if (!audio.paused) { audio.pause(); if (typeof audio.fastSeek === 'function') { @@ -22,8 +30,8 @@ const play = audio => { audio.play(); }; -export default function soundsMiddleware() { - const soundCache = { +export const soundsMiddleware = (): Middleware, RootState> => { + const soundCache: {[key: string]: HTMLAudioElement} = { boop: createAudio([ { src: '/sounds/boop.ogg', @@ -36,11 +44,13 @@ export default function soundsMiddleware() { ]), }; - return () => next => action => { - if (action.meta && action.meta.sound && soundCache[action.meta.sound]) { - play(soundCache[action.meta.sound]); + return () => next => (action: AnyAction) => { + const sound = action?.meta?.sound; + + if (sound && soundCache[sound]) { + play(soundCache[sound]); } return next(action); }; -} +}; From e63a08bafdf02d9db9e61626afd2d12f55a7e760 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 9 May 2023 23:41:18 +0200 Subject: [PATCH 045/508] Run prettier on Typescript files Port 0886856bd2adecedcad6fad9dcb86ed8069c46c0 to glitch-soc --- app/javascript/flavours/glitch/blurhash.ts | 4 +- app/javascript/flavours/glitch/compare_id.ts | 2 +- .../glitch/components/animated_number.tsx | 50 +++-- .../flavours/glitch/components/avatar.tsx | 15 +- .../flavours/glitch/components/blurhash.tsx | 2 +- .../flavours/glitch/components/gifv.tsx | 26 ++- .../flavours/glitch/components/icon.tsx | 15 +- .../glitch/components/icon_button.tsx | 28 +-- .../glitch/components/icon_with_badge.tsx | 15 +- .../flavours/glitch/components/image.tsx | 14 +- .../components/not_signed_in_indicator.tsx | 5 +- .../glitch/components/radio_button.tsx | 8 +- .../glitch/components/relative_timestamp.tsx | 189 ++++++++++++------ app/javascript/flavours/glitch/is_mobile.ts | 32 +-- app/javascript/flavours/glitch/permissions.ts | 6 +- .../glitch/polyfills/base_polyfills.ts | 2 +- app/javascript/flavours/glitch/scroll.ts | 37 +++- app/javascript/flavours/glitch/store/index.ts | 14 +- .../glitch/store/middlewares/errors.ts | 4 +- .../glitch/store/middlewares/loading_bar.ts | 43 ++-- .../glitch/store/middlewares/sounds.ts | 13 +- .../flavours/glitch/utils/filters.ts | 24 +-- .../flavours/glitch/utils/numbers.ts | 13 +- app/javascript/flavours/glitch/uuid.ts | 7 +- 24 files changed, 373 insertions(+), 195 deletions(-) diff --git a/app/javascript/flavours/glitch/blurhash.ts b/app/javascript/flavours/glitch/blurhash.ts index cb1c3b2c82..dadf2b7f2c 100644 --- a/app/javascript/flavours/glitch/blurhash.ts +++ b/app/javascript/flavours/glitch/blurhash.ts @@ -98,9 +98,9 @@ export const decode83 = (str: string) => { }; export const intToRGB = (int: number) => ({ - r: Math.max(0, (int >> 16)), + r: Math.max(0, int >> 16), g: Math.max(0, (int >> 8) & 255), - b: Math.max(0, (int & 255)), + b: Math.max(0, int & 255), }); export const getAverageFromBlurhash = (blurhash: string) => { diff --git a/app/javascript/flavours/glitch/compare_id.ts b/app/javascript/flavours/glitch/compare_id.ts index 3ddfb76351..30b0572481 100644 --- a/app/javascript/flavours/glitch/compare_id.ts +++ b/app/javascript/flavours/glitch/compare_id.ts @@ -1,4 +1,4 @@ -export function compareId (id1: string, id2: string) { +export function compareId(id1: string, id2: string) { if (id1 === id2) { return 0; } diff --git a/app/javascript/flavours/glitch/components/animated_number.tsx b/app/javascript/flavours/glitch/components/animated_number.tsx index 20ffa1a4d0..f6c77d35ff 100644 --- a/app/javascript/flavours/glitch/components/animated_number.tsx +++ b/app/javascript/flavours/glitch/components/animated_number.tsx @@ -16,13 +16,10 @@ const obfuscatedCount = (count: number) => { type Props = { value: number; obfuscate?: boolean; -} -export const AnimatedNumber: React.FC = ({ - value, - obfuscate, -})=> { +}; +export const AnimatedNumber: React.FC = ({ value, obfuscate }) => { const [previousValue, setPreviousValue] = useState(value); - const [direction, setDirection] = useState<1|-1>(1); + const [direction, setDirection] = useState<1 | -1>(1); if (previousValue !== value) { setPreviousValue(value); @@ -30,24 +27,45 @@ export const AnimatedNumber: React.FC = ({ } const willEnter = useCallback(() => ({ y: -1 * direction }), [direction]); - const willLeave = useCallback(() => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), [direction]); + const willLeave = useCallback( + () => ({ y: spring(1 * direction, { damping: 35, stiffness: 400 }) }), + [direction] + ); if (reduceMotion) { - return obfuscate ? <>{obfuscatedCount(value)} : ; + return obfuscate ? ( + <>{obfuscatedCount(value)} + ) : ( + + ); } - const styles = [{ - key: `${value}`, - data: value, - style: { y: spring(0, { damping: 35, stiffness: 400 }) }, - }]; + const styles = [ + { + key: `${value}`, + data: value, + style: { y: spring(0, { damping: 35, stiffness: 400 }) }, + }, + ]; return ( - - {items => ( + + {(items) => ( {items.map(({ key, data, style }) => ( - 0 ? 'absolute' : 'static', transform: `translateY(${style.y * 100}%)` }}>{obfuscate ? obfuscatedCount(data) : } + 0 ? 'absolute' : 'static', + transform: `translateY(${style.y * 100}%)`, + }} + > + {obfuscate ? obfuscatedCount(data) : } + ))} )} diff --git a/app/javascript/flavours/glitch/components/avatar.tsx b/app/javascript/flavours/glitch/components/avatar.tsx index c2f44706c9..1bd7739f5f 100644 --- a/app/javascript/flavours/glitch/components/avatar.tsx +++ b/app/javascript/flavours/glitch/components/avatar.tsx @@ -10,7 +10,7 @@ type Props = { size: number; style?: React.CSSProperties; inline?: boolean; -} +}; export const Avatar: React.FC = ({ account, @@ -19,7 +19,8 @@ export const Avatar: React.FC = ({ inline = false, style: styleFromParent, }) => { - const { hovering, handleMouseEnter, handleMouseLeave } = useHovering(autoPlayGif); + const { hovering, handleMouseEnter, handleMouseLeave } = + useHovering(autoPlayGif); const style = { ...styleFromParent, @@ -29,12 +30,18 @@ export const Avatar: React.FC = ({ }; if (account) { - style.backgroundImage = `url(${account.get(hovering ? 'avatar' : 'avatar_static')})`; + style.backgroundImage = `url(${account.get( + hovering ? 'avatar' : 'avatar_static' + )})`; } return (
= ({ hash, width = 32, diff --git a/app/javascript/flavours/glitch/components/gifv.tsx b/app/javascript/flavours/glitch/components/gifv.tsx index 5d9f235e11..72914ba741 100644 --- a/app/javascript/flavours/glitch/components/gifv.tsx +++ b/app/javascript/flavours/glitch/components/gifv.tsx @@ -8,7 +8,7 @@ type Props = { width: number; height: number; onClick?: () => void; -} +}; export const GIFV: React.FC = ({ src, @@ -17,19 +17,23 @@ export const GIFV: React.FC = ({ width, height, onClick, -})=> { +}) => { const [loading, setLoading] = useState(true); - const handleLoadedData: React.ReactEventHandler = useCallback(() => { - setLoading(false); - }, [setLoading]); + const handleLoadedData: React.ReactEventHandler = + useCallback(() => { + setLoading(false); + }, [setLoading]); - const handleClick: React.MouseEventHandler = useCallback((e) => { - if (onClick) { - e.stopPropagation(); - onClick(); - } - }, [onClick]); + const handleClick: React.MouseEventHandler = useCallback( + (e) => { + if (onClick) { + e.stopPropagation(); + onClick(); + } + }, + [onClick] + ); return (
diff --git a/app/javascript/flavours/glitch/components/icon.tsx b/app/javascript/flavours/glitch/components/icon.tsx index f74437b555..4eb948dc76 100644 --- a/app/javascript/flavours/glitch/components/icon.tsx +++ b/app/javascript/flavours/glitch/components/icon.tsx @@ -7,6 +7,15 @@ type Props = { fixedWidth?: boolean; children?: never; [key: string]: any; -} -export const Icon: React.FC = ({ id, className, fixedWidth, ...other }) => - ; +}; +export const Icon: React.FC = ({ + id, + className, + fixedWidth, + ...other +}) => ( + +); diff --git a/app/javascript/flavours/glitch/components/icon_button.tsx b/app/javascript/flavours/glitch/components/icon_button.tsx index d3d0609718..80b20ae1b0 100644 --- a/app/javascript/flavours/glitch/components/icon_button.tsx +++ b/app/javascript/flavours/glitch/components/icon_button.tsx @@ -26,13 +26,12 @@ type Props = { obfuscateCount?: boolean; href?: string; ariaHidden: boolean; -} +}; type States = { - activate: boolean, - deactivate: boolean, -} + activate: boolean; + deactivate: boolean; +}; export class IconButton extends React.PureComponent { - static defaultProps = { size: 18, active: false, @@ -48,7 +47,7 @@ export class IconButton extends React.PureComponent { deactivate: false, }; - UNSAFE_componentWillReceiveProps (nextProps: Props) { + UNSAFE_componentWillReceiveProps(nextProps: Props) { if (!nextProps.animate) return; if (this.props.active && !nextProps.active) { @@ -58,7 +57,7 @@ export class IconButton extends React.PureComponent { } } - handleClick: React.MouseEventHandler = (e) => { + handleClick: React.MouseEventHandler = (e) => { e.preventDefault(); if (!this.props.disabled && this.props.onClick != null) { @@ -84,7 +83,7 @@ export class IconButton extends React.PureComponent { } }; - render () { + render() { // Hack required for some icons which have an overriden size let containerSize = '1.28571429em'; if (this.props.style?.fontSize) { @@ -120,10 +119,7 @@ export class IconButton extends React.PureComponent { ariaHidden, } = this.props; - const { - activate, - deactivate, - } = this.state; + const { activate, deactivate } = this.state; const classes = classNames(className, 'icon-button', { active, @@ -141,7 +137,12 @@ export class IconButton extends React.PureComponent { let contents = ( - ); @@ -174,5 +175,4 @@ export class IconButton extends React.PureComponent { ); } - } diff --git a/app/javascript/flavours/glitch/components/icon_with_badge.tsx b/app/javascript/flavours/glitch/components/icon_with_badge.tsx index a4af86ca9b..bf86814c03 100644 --- a/app/javascript/flavours/glitch/components/icon_with_badge.tsx +++ b/app/javascript/flavours/glitch/components/icon_with_badge.tsx @@ -1,18 +1,25 @@ import React from 'react'; import { Icon } from './icon'; -const formatNumber = (num: number): number | string => num > 40 ? '40+' : num; +const formatNumber = (num: number): number | string => (num > 40 ? '40+' : num); type Props = { id: string; count: number; issueBadge: boolean; className: string; -} -export const IconWithBadge: React.FC = ({ id, count, issueBadge, className }) => ( +}; +export const IconWithBadge: React.FC = ({ + id, + count, + issueBadge, + className, +}) => ( - {count > 0 && {formatNumber(count)}} + {count > 0 && ( + {formatNumber(count)} + )} {issueBadge && } ); diff --git a/app/javascript/flavours/glitch/components/image.tsx b/app/javascript/flavours/glitch/components/image.tsx index b332d4115b..490543424a 100644 --- a/app/javascript/flavours/glitch/components/image.tsx +++ b/app/javascript/flavours/glitch/components/image.tsx @@ -7,9 +7,14 @@ type Props = { srcSet?: string; blurhash?: string; className?: string; -} +}; -export const Image: React.FC = ({ src, srcSet, blurhash, className }) => { +export const Image: React.FC = ({ + src, + srcSet, + blurhash, + className, +}) => { const [loaded, setLoaded] = useState(false); const handleLoad = useCallback(() => { @@ -17,7 +22,10 @@ export const Image: React.FC = ({ src, srcSet, blurhash, className }) => }, [setLoaded]); return ( -
+
{blurhash && }
diff --git a/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx b/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx index 3bfee6ae91..53945d6a7a 100644 --- a/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx +++ b/app/javascript/flavours/glitch/components/not_signed_in_indicator.tsx @@ -4,7 +4,10 @@ import { FormattedMessage } from 'react-intl'; export const NotSignedInIndicator: React.FC = () => (
- +
); diff --git a/app/javascript/flavours/glitch/components/radio_button.tsx b/app/javascript/flavours/glitch/components/radio_button.tsx index 194b67afe1..829f471747 100644 --- a/app/javascript/flavours/glitch/components/radio_button.tsx +++ b/app/javascript/flavours/glitch/components/radio_button.tsx @@ -9,7 +9,13 @@ type Props = { label: React.ReactNode; }; -export const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { +export const RadioButton: React.FC = ({ + name, + value, + checked, + onChange, + label, +}) => { return (