Merge commit '5a16bd7bf4591feb852364da9b84407438c9b7d6' into glitch-soc/merge-upstream

This commit is contained in:
Claire 2023-05-28 14:32:26 +02:00
commit 8278907ff7
24 changed files with 94 additions and 98 deletions

View File

@ -98,8 +98,10 @@ module.exports = {
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', 'tsx'] }],
'react/jsx-boolean-value': 'error',
'react/display-name': 'off',
'react/jsx-fragments': ['error', 'syntax'],
'react/jsx-equals-spacing': 'error',
'react/jsx-no-bind': 'error',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-no-target-blank': 'off',
'react/jsx-tag-spacing': 'error',
'react/jsx-uses-react': 'off', // not needed with new JSX transform

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'mastodon/api';
import { FormattedNumber } from 'react-intl';
@ -62,25 +62,25 @@ export default class Counter extends PureComponent {
if (loading) {
content = (
<Fragment>
<>
<span className='sparkline__value__total'><Skeleton width={43} /></span>
<span className='sparkline__value__change'><Skeleton width={43} /></span>
</Fragment>
</>
);
} else {
const measure = data[0];
const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1);
content = (
<Fragment>
<>
<span className='sparkline__value__total'>{measure.human_value || <FormattedNumber value={measure.total} />}</span>
{measure.previous_total && (<span className={classNames('sparkline__value__change', { positive: percentChange > 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'}<FormattedNumber value={percentChange} style='percent' /></span>)}
</Fragment>
</>
);
}
const inner = (
<Fragment>
<>
<div className='sparkline__value'>
{content}
</div>
@ -96,7 +96,7 @@ export default class Counter extends PureComponent {
</Sparklines>
)}
</div>
</Fragment>
</>
);
if (href) {

View File

@ -1,4 +1,4 @@
import { PureComponent, cloneElement, Children, Fragment } from 'react';
import { PureComponent, cloneElement, Children } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { IconButton } from './icon_button';
@ -306,7 +306,7 @@ export default class Dropdown extends PureComponent {
);
return (
<Fragment>
<>
<span ref={this.setTargetRef}>
{button}
</span>
@ -329,7 +329,7 @@ export default class Dropdown extends PureComponent {
</div>
)}
</Overlay>
</Fragment>
</>
);
}

View File

@ -1,5 +1,5 @@
// @ts-check
import { Component, Fragment } from 'react';
import { Component } from 'react';
import { Sparklines, SparklinesCurve } from 'react-sparklines';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
@ -69,7 +69,7 @@ const Hashtag = ({ name, to, people, uses, history, className, description, with
<div className={classNames('trends__item', className)}>
<div className='trends__item__name'>
<Link to={to}>
{name ? <Fragment>#<span>{name}</span></Fragment> : <Skeleton width={50} />}
{name ? <>#<span>{name}</span></> : <Skeleton width={50} />}
</Link>
{description ? (

View File

@ -5,14 +5,12 @@ import Trends from 'mastodon/features/getting_started/containers/trends_containe
import AccountNavigation from 'mastodon/features/account/navigation';
const DefaultNavigation = () => (
<>
{showTrends && (
<>
<div className='flex-spacer' />
<Trends />
</>
)}
</>
showTrends ? (
<>
<div className='flex-spacer' />
<Trends />
</>
) : null
);
class NavigationPortal extends PureComponent {

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl';
@ -75,7 +75,7 @@ export default class MediaContainer extends PureComponent {
return (
<IntlProvider locale={locale} messages={messages}>
<Fragment>
<>
{[].map.call(components, (component, i) => {
const componentName = component.getAttribute('data-component');
const Component = MEDIA_COMPONENTS[componentName];
@ -115,7 +115,7 @@ export default class MediaContainer extends PureComponent {
/>
)}
</ModalRoot>
</Fragment>
</>
</IntlProvider>
);
}

View File

@ -1,4 +1,3 @@
import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@ -399,10 +398,10 @@ class Header extends ImmutablePureComponent {
{!suspended && (
<div className='account__header__tabs__buttons'>
{!hidden && (
<Fragment>
<>
{actionBtn}
{bellBtn}
</Fragment>
</>
)}
<DropdownMenuContainer disabled={menu.length === 0} items={menu} icon='ellipsis-v' size={24} direction='right' />

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Blurhash } from 'mastodon/components/blurhash';
import { accountsCountRenderer } from 'mastodon/components/hashtag';
@ -38,10 +38,10 @@ export default class Story extends PureComponent {
<div className='story__thumbnail'>
{thumbnail ? (
<Fragment>
<>
<div className={classNames('story__thumbnail__preview', { 'story__thumbnail__preview--hidden': thumbnailLoaded })}><Blurhash hash={blurhash} /></div>
<img src={thumbnail} onLoad={this.handleImageLoad} alt='' role='presentation' />
</Fragment>
</>
) : <Skeleton />}
</div>
</a>

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
@ -102,7 +102,7 @@ class Results extends PureComponent {
}
return (
<Fragment>
<>
<div className='account__section-headline'>
<button onClick={this.handleSelectAll} className={type === 'all' && 'active'}><FormattedMessage id='search_results.all' defaultMessage='All' /></button>
<button onClick={this.handleSelectAccounts} className={type === 'accounts' && 'active'}><FormattedMessage id='search_results.accounts' defaultMessage='Profiles' /></button>
@ -117,7 +117,7 @@ class Results extends PureComponent {
<Helmet>
<title>{intl.formatMessage(messages.title, { q })}</title>
</Helmet>
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';
@ -30,7 +30,7 @@ class AddedToFilter extends PureComponent {
let expiredMessage = null;
if (filter.get('expires_at') && filter.get('expires_at') < new Date()) {
expiredMessage = (
<Fragment>
<>
<h4 className='report-dialog-modal__subtitle'><FormattedMessage id='filter_modal.added.expired_title' defaultMessage='Expired filter!' /></h4>
<p className='report-dialog-modal__lead'>
<FormattedMessage
@ -38,14 +38,14 @@ class AddedToFilter extends PureComponent {
defaultMessage='This filter category has expired, you will need to change the expiration date for it to apply.'
/>
</p>
</Fragment>
</>
);
}
let contextMismatchMessage = null;
if (contextType && !filter.get('context').includes(toServerSideType(contextType))) {
contextMismatchMessage = (
<Fragment>
<>
<h4 className='report-dialog-modal__subtitle'><FormattedMessage id='filter_modal.added.context_mismatch_title' defaultMessage='Context mismatch!' /></h4>
<p className='report-dialog-modal__lead'>
<FormattedMessage
@ -53,7 +53,7 @@ class AddedToFilter extends PureComponent {
defaultMessage='This filter category does not apply to the context in which you have accessed this post. If you want the post to be filtered in this context too, you will have to edit the filter.'
/>
</p>
</Fragment>
</>
);
}
@ -67,7 +67,7 @@ class AddedToFilter extends PureComponent {
);
return (
<Fragment>
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='filter_modal.added.title' defaultMessage='Filter added!' /></h3>
<p className='report-dialog-modal__lead'>
<FormattedMessage
@ -94,7 +94,7 @@ class AddedToFilter extends PureComponent {
<div className='report-dialog-modal__actions'>
<Button onClick={this.handleCloseClick}><FormattedMessage id='report.close' defaultMessage='Done' /></Button>
</div>
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@ -169,7 +169,7 @@ class SelectFilter extends PureComponent {
const results = this.search();
return (
<Fragment>
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='filter_modal.select_filter.title' defaultMessage='Filter this post' /></h3>
<p className='report-dialog-modal__lead'><FormattedMessage id='filter_modal.select_filter.subtitle' defaultMessage='Use an existing category or create a new one' /></p>
@ -183,7 +183,7 @@ class SelectFilter extends PureComponent {
{isSearching && this.renderCreateNew(searchValue) }
</div>
</Fragment>
</>
);
}

View File

@ -1,4 +1,3 @@
import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { Avatar } from 'mastodon/components/avatar';
@ -31,10 +30,10 @@ class FollowRequest extends ImmutablePureComponent {
if (hidden) {
return (
<Fragment>
<>
{account.get('display_name')}
{account.get('username')}
</Fragment>
</>
);
}

View File

@ -1,4 +1,3 @@
import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
@ -31,9 +30,9 @@ class Report extends ImmutablePureComponent {
if (hidden) {
return (
<Fragment>
<>
{report.get('id')}
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
@ -74,7 +74,7 @@ class Category extends PureComponent {
];
return (
<Fragment>
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='report.category.title' defaultMessage="Tell us what's going on with this {type}" values={{ type: intl.formatMessage(messages[startedFrom]) }} /></h3>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.category.subtitle' defaultMessage='Choose the best match' /></p>
@ -97,7 +97,7 @@ class Category extends PureComponent {
<div className='report-dialog-modal__actions'>
<Button onClick={this.handleNextClick} disabled={category === null}><FormattedMessage id='report.next' defaultMessage='Next' /></Button>
</div>
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
import Button from 'mastodon/components/button';
@ -47,7 +47,7 @@ class Comment extends PureComponent {
const { comment, isRemote, forward, domain, isSubmitting, intl } = this.props;
return (
<Fragment>
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='report.comment.title' defaultMessage='Is there anything else you think we should know?' /></h3>
<textarea
@ -60,14 +60,14 @@ class Comment extends PureComponent {
/>
{isRemote && (
<Fragment>
<>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.forward_hint' defaultMessage='The account is from another server. Send an anonymized copy of the report there as well?' /></p>
<label className='report-dialog-modal__toggle'>
<Toggle checked={forward} disabled={isSubmitting} onChange={this.handleForwardChange} />
<FormattedMessage id='report.forward' defaultMessage='Forward to {target}' values={{ target: domain }} />
</label>
</Fragment>
</>
)}
<div className='flex-spacer' />
@ -75,7 +75,7 @@ class Comment extends PureComponent {
<div className='report-dialog-modal__actions'>
<Button onClick={this.handleClick} disabled={isSubmitting}><FormattedMessage id='report.submit' defaultMessage='Submit report' /></Button>
</div>
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
@ -33,7 +33,7 @@ class Rules extends PureComponent {
const { rules, selectedRuleIds } = this.props;
return (
<Fragment>
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='report.rules.title' defaultMessage='Which rules are being violated?' /></h3>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.rules.subtitle' defaultMessage='Select all that apply' /></p>
@ -56,7 +56,7 @@ class Rules extends PureComponent {
<div className='report-dialog-modal__actions'>
<Button onClick={this.handleNextClick} disabled={selectedRuleIds.size < 1}><FormattedMessage id='report.next' defaultMessage='Next' /></Button>
</div>
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
@ -33,7 +33,7 @@ class Statuses extends PureComponent {
const { availableStatusIds, selectedStatusIds, onToggle, isLoading } = this.props;
return (
<Fragment>
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='report.statuses.title' defaultMessage='Are there any posts that back up this report?' /></h3>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.statuses.subtitle' defaultMessage='Select all that apply' /></p>
@ -53,7 +53,7 @@ class Statuses extends PureComponent {
<div className='report-dialog-modal__actions'>
<Button onClick={this.handleNextClick}><FormattedMessage id='report.next' defaultMessage='Next' /></Button>
</div>
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';
@ -48,17 +48,17 @@ class Thanks extends PureComponent {
const { account, submitted } = this.props;
return (
<Fragment>
<>
<h3 className='report-dialog-modal__title'>{submitted ? <FormattedMessage id='report.thanks.title_actionable' defaultMessage="Thanks for reporting, we'll look into this." /> : <FormattedMessage id='report.thanks.title' defaultMessage="Don't want to see this?" />}</h3>
<p className='report-dialog-modal__lead'>{submitted ? <FormattedMessage id='report.thanks.take_action_actionable' defaultMessage='While we review this, you can take action against @{name}:' values={{ name: account.get('username') }} /> : <FormattedMessage id='report.thanks.take_action' defaultMessage='Here are your options for controlling what you see on Mastodon:' />}</p>
{account.getIn(['relationship', 'following']) && (
<Fragment>
<>
<h4 className='report-dialog-modal__subtitle'><FormattedMessage id='report.unfollow' defaultMessage='Unfollow @{name}' values={{ name: account.get('username') }} /></h4>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.unfollow_explanation' defaultMessage='You are following this account. To not see their posts in your home feed anymore, unfollow them.' /></p>
<Button secondary onClick={this.handleUnfollowClick}><FormattedMessage id='account.unfollow' defaultMessage='Unfollow' /></Button>
<hr />
</Fragment>
</>
)}
<h4 className='report-dialog-modal__subtitle'><FormattedMessage id='account.mute' defaultMessage='Mute @{name}' values={{ name: account.get('username') }} /></h4>
@ -76,7 +76,7 @@ class Thanks extends PureComponent {
<div className='report-dialog-modal__actions'>
<Button onClick={this.handleCloseClick}><FormattedMessage id='report.close' defaultMessage='Done' /></Button>
</div>
</Fragment>
</>
);
}

View File

@ -1,4 +1,3 @@
import { Fragment } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { Avatar } from '../../../components/avatar';
@ -190,7 +189,7 @@ class DetailedStatus extends ImmutablePureComponent {
}
if (status.get('application')) {
applicationLink = <Fragment> · <a className='detailed-status__application' href={status.getIn(['application', 'website'])} target='_blank' rel='noopener noreferrer'>{status.getIn(['application', 'name'])}</a></Fragment>;
applicationLink = <> · <a className='detailed-status__application' href={status.getIn(['application', 'website'])} target='_blank' rel='noopener noreferrer'>{status.getIn(['application', 'name'])}</a></>;
}
const visibilityIconInfo = {
@ -201,33 +200,33 @@ class DetailedStatus extends ImmutablePureComponent {
};
const visibilityIcon = visibilityIconInfo[status.get('visibility')];
const visibilityLink = <Fragment> · <Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></Fragment>;
const visibilityLink = <> · <Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></>;
if (['private', 'direct'].includes(status.get('visibility'))) {
reblogLink = '';
} else if (this.context.router) {
reblogLink = (
<Fragment>
<Fragment> · </Fragment>
<>
·
<Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}/reblogs`} className='detailed-status__link'>
<Icon id={reblogIcon} />
<span className='detailed-status__reblogs'>
<AnimatedNumber value={status.get('reblogs_count')} />
</span>
</Link>
</Fragment>
</>
);
} else {
reblogLink = (
<Fragment>
<Fragment> · </Fragment>
<>
·
<a href={`/interact/${status.get('id')}?type=reblog`} className='detailed-status__link' onClick={this.handleModalLink}>
<Icon id={reblogIcon} />
<span className='detailed-status__reblogs'>
<AnimatedNumber value={status.get('reblogs_count')} />
</span>
</a>
</Fragment>
</>
);
}
@ -253,10 +252,10 @@ class DetailedStatus extends ImmutablePureComponent {
if (status.get('edited_at')) {
edited = (
<Fragment>
<Fragment> · </Fragment>
<>
·
<EditedTimestamp statusId={status.get('id')} timestamp={status.get('edited_at')} />
</Fragment>
</>
);
}

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
@ -65,10 +65,10 @@ class CompareHistoryModal extends PureComponent {
<div className='compare-history-modal__container'>
<div className='status__content'>
{currentVersion.get('spoiler_text').length > 0 && (
<Fragment>
<>
<div className='translate' dangerouslySetInnerHTML={spoilerContent} lang={language} />
<hr />
</Fragment>
</>
)}
<div className='status__content__text status__content__text--visible translate' dangerouslySetInnerHTML={content} lang={language} />

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import SearchContainer from 'mastodon/features/compose/containers/search_container';
@ -46,17 +46,17 @@ class ComposePanel extends PureComponent {
<SearchContainer openInRoute />
{!signedIn && (
<Fragment>
<>
<ServerBanner />
<div className='flex-spacer' />
</Fragment>
</>
)}
{signedIn && (
<Fragment>
<>
<NavigationContainer onClose={this.onBlur} />
<ComposeFormContainer singleColumn />
</Fragment>
</>
)}
<LinkFooter />

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import ImmutablePureComponent from 'react-immutable-pure-component';
@ -315,7 +315,7 @@ class FocalPointModal extends ImmutablePureComponent {
{focals && <p><FormattedMessage id='upload_modal.hint' defaultMessage='Click or drag the circle on the preview to choose the focal point which will always be in view on all thumbnails.' /></p>}
{thumbnailable && (
<Fragment>
<>
<label className='setting-text-label' htmlFor='upload-modal__thumbnail'><FormattedMessage id='upload_form.thumbnail' defaultMessage='Change thumbnail' /></label>
<Button disabled={isUploadingThumbnail || !media.get('unattached')} text={intl.formatMessage(messages.chooseImage)} onClick={this.handleFileInputClick} />
@ -335,7 +335,7 @@ class FocalPointModal extends ImmutablePureComponent {
</label>
<hr className='setting-divider' />
</Fragment>
</>
)}
<label className='setting-text-label' htmlFor='upload-modal__description'>

View File

@ -1,4 +1,4 @@
import { Component, Fragment } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import { Link } from 'react-router-dom';
@ -51,11 +51,11 @@ class NavigationPanel extends Component {
</div>
{signedIn && (
<Fragment>
<>
<ColumnLink transparent to='/home' icon='home' text={intl.formatMessage(messages.home)} />
<ColumnLink transparent to='/notifications' icon={<NotificationsCounterIcon className='column-link__icon' />} text={intl.formatMessage(messages.notifications)} />
<FollowRequestsColumnLink />
</Fragment>
</>
)}
{showTrends ? (
@ -79,7 +79,7 @@ class NavigationPanel extends Component {
)}
{signedIn && (
<Fragment>
<>
<ColumnLink transparent to='/conversations' icon='at' text={intl.formatMessage(messages.direct)} />
<ColumnLink transparent to='/bookmarks' icon='bookmark' text={intl.formatMessage(messages.bookmarks)} />
<ColumnLink transparent to='/favourites' icon='star' text={intl.formatMessage(messages.favourites)} />
@ -90,7 +90,7 @@ class NavigationPanel extends Component {
<hr />
<ColumnLink transparent href='/settings/preferences' icon='cog' text={intl.formatMessage(messages.preferences)} />
</Fragment>
</>
)}
<div className='navigation-panel__legal'>

View File

@ -1,4 +1,4 @@
import { PureComponent, Fragment } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { IconButton } from 'mastodon/components/icon_button';
import { defineMessages, injectIntl } from 'react-intl';
@ -411,7 +411,7 @@ class ZoomableImage extends PureComponent {
const zoomButtonTitle = this.state.zoomState === 'compress' ? intl.formatMessage(messages.compress) : intl.formatMessage(messages.expand);
return (
<Fragment>
<>
<IconButton
className={`media-modal__zoom-button ${zoomButtonShouldHide}`}
title={zoomButtonTitle}
@ -445,7 +445,7 @@ class ZoomableImage extends PureComponent {
onMouseDown={this.handleMouseDown}
/>
</div>
</Fragment>
</>
);
}