[Glitch] Run eslint --fix

I don't like it changing files this way, but it's basically what
c49213f0ea and a few others did.
This commit is contained in:
Claire
2023-02-03 20:52:07 +01:00
parent ed7cb79723
commit 155424e52f
233 changed files with 1262 additions and 1248 deletions

View File

@ -59,7 +59,7 @@ class Section extends React.PureComponent {
const { collapsed } = this.state;
this.setState({ collapsed: !collapsed }, () => onOpen && onOpen());
}
};
render () {
const { title, children } = this.props;
@ -106,7 +106,7 @@ class About extends React.PureComponent {
handleDomainBlocksOpen = () => {
const { dispatch } = this.props;
dispatch(fetchDomainBlocks());
}
};
render () {
const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;

View File

@ -41,7 +41,7 @@ class Header extends ImmutablePureComponent {
} else if (e.keyCode === 27) {
this.props.onCancelAccountNote();
}
}
};
render () {
const { account, accountNote, isEditing, isSubmitting, intl } = this.props;

View File

@ -21,7 +21,7 @@ class ActionBar extends React.PureComponent {
return false;
}
return !location.pathname.match(/\/(followers|following)\/?$/);
}
};
render () {
const { account, intl } = this.props;
@ -32,7 +32,7 @@ class ActionBar extends React.PureComponent {
<div className='account__disclaimer'>
<Icon id='info-circle' fixedWidth /> <FormattedMessage
id='account.suspended_disclaimer_full'
defaultMessage="This user has been suspended by a moderator."
defaultMessage='This user has been suspended by a moderator.'
/>
</div>
</div>

View File

@ -109,7 +109,7 @@ class Header extends ImmutablePureComponent {
openEditProfile = () => {
window.open(profileLink, '_blank');
}
};
handleMouseEnter = ({ currentTarget }) => {
if (autoPlayGif) {
@ -122,7 +122,7 @@ class Header extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-original');
}
}
};
handleMouseLeave = ({ currentTarget }) => {
if (autoPlayGif) {
@ -135,14 +135,14 @@ class Header extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-static');
}
}
};
handleAvatarClick = e => {
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
this.props.onOpenAvatar();
}
}
};
handleShare = () => {
const { account } = this.props;
@ -153,7 +153,7 @@ class Header extends ImmutablePureComponent {
}).catch((e) => {
if (e.name !== 'AbortError') console.error(e);
});
}
};
render () {
const { account, hidden, intl, domain } = this.props;
@ -177,8 +177,7 @@ class Header extends ImmutablePureComponent {
if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) {
info.push(<span className='relationship-tag'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>);
}
else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) {
} else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) {
info.push(<span className='relationship-tag'><FormattedMessage id='account.blocked' defaultMessage='Blocked' /></span>);
}
@ -378,7 +377,7 @@ class Header extends ImmutablePureComponent {
{fields.map((pair, i) => (
<dl key={i}>
<dt dangerouslySetInnerHTML={{ __html: pair.get('name_emojified') }} title={pair.get('name')} />
<dd className={pair.get('verified_at') && 'verified'} title={pair.get('value_plain')}>
{pair.get('verified_at') && <span title={intl.formatMessage(messages.linkVerifiedOn, { date: intl.formatDate(pair.get('verified_at'), dateFormatOptions) })}><Icon id='check' className='verified__mark' /></span>} <span dangerouslySetInnerHTML={{ __html: pair.get('value_emojified') }} className='translate' />
</dd>

View File

@ -22,20 +22,20 @@ export default class MediaItem extends ImmutablePureComponent {
handleImageLoad = () => {
this.setState({ loaded: true });
}
};
handleMouseEnter = e => {
if (this.hoverToPlay()) {
e.target.play();
}
}
};
handleMouseLeave = e => {
if (this.hoverToPlay()) {
e.target.pause();
e.target.currentTime = 0;
}
}
};
hoverToPlay () {
return !autoPlayGif && ['gifv', 'video'].indexOf(this.props.attachment.get('type')) !== -1;
@ -51,7 +51,7 @@ export default class MediaItem extends ImmutablePureComponent {
this.setState({ visible: true });
}
}
}
};
render () {
const { attachment, displayWidth } = this.props;

View File

@ -45,7 +45,7 @@ class LoadMoreMedia extends ImmutablePureComponent {
handleLoadMore = () => {
this.props.onLoadMore(this.props.maxId);
}
};
render () {
return (
@ -109,13 +109,13 @@ class AccountGallery extends ImmutablePureComponent {
handleHeaderClick = () => {
this.column.scrollTop();
}
};
handleScrollToBottom = () => {
if (this.props.hasMore) {
this.handleLoadMore(this.props.attachments.size > 0 ? this.props.attachments.last().getIn(['status', 'id']) : undefined);
}
}
};
handleScroll = e => {
const { scrollTop, scrollHeight, clientHeight } = e.target;
@ -124,7 +124,7 @@ class AccountGallery extends ImmutablePureComponent {
if (150 > offset && !this.props.isLoading) {
this.handleScrollToBottom();
}
}
};
handleLoadMore = maxId => {
this.props.dispatch(expandAccountMediaTimeline(this.props.accountId, { maxId }));
@ -133,11 +133,11 @@ class AccountGallery extends ImmutablePureComponent {
handleLoadOlder = e => {
e.preventDefault();
this.handleScrollToBottom();
}
};
setColumnRef = c => {
this.column = c;
}
};
handleOpenMedia = attachment => {
const { dispatch } = this.props;
@ -153,13 +153,13 @@ class AccountGallery extends ImmutablePureComponent {
dispatch(openModal('MEDIA', { media, index, statusId }));
}
}
};
handleRef = c => {
if (c) {
this.setState({ width: c.offsetWidth });
}
}
};
render () {
const { attachments, isLoading, hasMore, isAccount, multiColumn, suspended } = this.props;

View File

@ -37,35 +37,35 @@ export default class Header extends ImmutablePureComponent {
handleFollow = () => {
this.props.onFollow(this.props.account);
}
};
handleBlock = () => {
this.props.onBlock(this.props.account);
}
};
handleMention = () => {
this.props.onMention(this.props.account, this.context.router.history);
}
};
handleDirect = () => {
this.props.onDirect(this.props.account, this.context.router.history);
}
};
handleReport = () => {
this.props.onReport(this.props.account);
}
};
handleReblogToggle = () => {
this.props.onReblogToggle(this.props.account);
}
};
handleNotifyToggle = () => {
this.props.onNotifyToggle(this.props.account);
}
};
handleMute = () => {
this.props.onMute(this.props.account);
}
};
handleBlockDomain = () => {
const domain = this.props.account.get('acct').split('@')[1];
@ -73,7 +73,7 @@ export default class Header extends ImmutablePureComponent {
if (!domain) return;
this.props.onBlockDomain(domain);
}
};
handleUnblockDomain = () => {
const domain = this.props.account.get('acct').split('@')[1];
@ -81,31 +81,31 @@ export default class Header extends ImmutablePureComponent {
if (!domain) return;
this.props.onUnblockDomain(domain);
}
};
handleEndorseToggle = () => {
this.props.onEndorseToggle(this.props.account);
}
};
handleAddToList = () => {
this.props.onAddToList(this.props.account);
}
};
handleEditAccountNote = () => {
this.props.onEditAccountNote(this.props.account);
}
};
handleChangeLanguages = () => {
this.props.onChangeLanguages(this.props.account);
}
};
handleInteractionModal = () => {
this.props.onInteractionModal(this.props.account);
}
};
handleOpenAvatar = () => {
this.props.onOpenAvatar(this.props.account);
}
};
render () {
const { account, hidden, hideTabs } = this.props;

View File

@ -20,7 +20,7 @@ class LimitedAccountHint extends React.PureComponent {
static propTypes = {
accountId: PropTypes.string.isRequired,
reveal: PropTypes.func,
}
};
render () {
const { reveal } = this.props;

View File

@ -21,13 +21,13 @@ export default class MovedNote extends ImmutablePureComponent {
handleAccountClick = e => {
if (e.button === 0) {
e.preventDefault();
let state = {...this.context.router.history.location.state};
let state = { ...this.context.router.history.location.state };
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
this.context.router.history.push(`/@${this.props.to.get('acct')}`, state);
}
e.stopPropagation();
}
};
render () {
const { from, to } = this.props;

View File

@ -12,7 +12,7 @@ import {
} from 'flavours/glitch/actions/accounts';
import {
mentionCompose,
directCompose
directCompose,
} from 'flavours/glitch/actions/compose';
import { initMuteModal } from 'flavours/glitch/actions/mutes';
import { initBlockModal } from 'flavours/glitch/actions/blocks';

View File

@ -140,15 +140,15 @@ class AccountTimeline extends ImmutablePureComponent {
handleHeaderClick = () => {
this.column.scrollTop();
}
};
handleLoadMore = maxId => {
this.props.dispatch(expandAccountTimeline(this.props.accountId, { maxId, withReplies: this.props.withReplies, tagged: this.props.params.tagged }));
}
};
setRef = c => {
this.column = c;
}
};
render () {
const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;

View File

@ -75,7 +75,7 @@ class Audio extends React.PureComponent {
if (this.player) {
this._setDimensions();
}
}
};
_pack() {
return {
@ -107,11 +107,11 @@ class Audio extends React.PureComponent {
setSeekRef = c => {
this.seek = c;
}
};
setVolumeRef = c => {
this.volume = c;
}
};
setAudioRef = c => {
this.audio = c;
@ -120,14 +120,14 @@ class Audio extends React.PureComponent {
this.audio.volume = 1;
this.audio.muted = false;
}
}
};
setCanvasRef = c => {
this.canvas = c;
this.visualizer.setCanvas(c);
}
};
componentDidMount () {
window.addEventListener('scroll', this.handleScroll);
window.addEventListener('resize', this.handleResize, { passive: true });
@ -169,7 +169,7 @@ class Audio extends React.PureComponent {
} else {
this.setState({ paused: true }, () => this.audio.pause());
}
}
};
handleResize = debounce(() => {
if (this.player) {
@ -187,7 +187,7 @@ class Audio extends React.PureComponent {
}
this._renderCanvas();
}
};
handlePause = () => {
this.setState({ paused: true });
@ -195,7 +195,7 @@ class Audio extends React.PureComponent {
if (this.audioContext) {
this.audioContext.suspend();
}
}
};
handleProgress = () => {
const lastTimeRange = this.audio.buffered.length - 1;
@ -203,7 +203,7 @@ class Audio extends React.PureComponent {
if (lastTimeRange > -1) {
this.setState({ buffer: Math.ceil(this.audio.buffered.end(lastTimeRange) / this.audio.duration * 100) });
}
}
};
toggleMute = () => {
const muted = !this.state.muted;
@ -213,7 +213,7 @@ class Audio extends React.PureComponent {
this.gainNode.gain.value = muted ? 0 : this.state.volume;
}
});
}
};
toggleReveal = () => {
if (this.props.onToggleVisibility) {
@ -221,7 +221,7 @@ class Audio extends React.PureComponent {
} else {
this.setState({ revealed: !this.state.revealed });
}
}
};
handleVolumeMouseDown = e => {
document.addEventListener('mousemove', this.handleMouseVolSlide, true);
@ -233,14 +233,14 @@ class Audio extends React.PureComponent {
e.preventDefault();
e.stopPropagation();
}
};
handleVolumeMouseUp = () => {
document.removeEventListener('mousemove', this.handleMouseVolSlide, true);
document.removeEventListener('mouseup', this.handleVolumeMouseUp, true);
document.removeEventListener('touchmove', this.handleMouseVolSlide, true);
document.removeEventListener('touchend', this.handleVolumeMouseUp, true);
}
};
handleMouseDown = e => {
document.addEventListener('mousemove', this.handleMouseMove, true);
@ -254,7 +254,7 @@ class Audio extends React.PureComponent {
e.preventDefault();
e.stopPropagation();
}
};
handleMouseUp = () => {
document.removeEventListener('mousemove', this.handleMouseMove, true);
@ -264,7 +264,7 @@ class Audio extends React.PureComponent {
this.setState({ dragging: false });
this.audio.play();
}
};
handleMouseMove = throttle(e => {
const { x } = getPointerPosition(this.seek, e);
@ -282,7 +282,7 @@ class Audio extends React.PureComponent {
currentTime: this.audio.currentTime,
duration: this.audio.duration,
});
}
};
handleMouseVolSlide = throttle(e => {
const { x } = getPointerPosition(this.volume, e);
@ -317,11 +317,11 @@ class Audio extends React.PureComponent {
handleMouseEnter = () => {
this.setState({ hovered: true });
}
};
handleMouseLeave = () => {
this.setState({ hovered: false });
}
};
handleLoadedData = () => {
const { autoPlay, currentTime } = this.props;
@ -333,7 +333,7 @@ class Audio extends React.PureComponent {
if (autoPlay) {
this.togglePlay();
}
}
};
_initAudioContext () {
const AudioContext = window.AudioContext || window.webkitAudioContext;
@ -367,7 +367,7 @@ class Audio extends React.PureComponent {
}).catch(err => {
console.error(err);
});
}
};
_renderCanvas () {
requestAnimationFrame(() => {
@ -438,7 +438,7 @@ class Audio extends React.PureComponent {
e.stopPropagation();
this.togglePlay();
}
}
};
handleKeyDown = e => {
switch(e.key) {
@ -463,7 +463,7 @@ class Audio extends React.PureComponent {
this.seekBy(10);
break;
}
}
};
render () {
const { src, intl, alt, editable, autoPlay, sensitive, blurhash } = this.props;

View File

@ -48,24 +48,24 @@ class Bookmarks extends ImmutablePureComponent {
} else {
dispatch(addColumn('BOOKMARKS', {}));
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setRef = c => {
this.column = c;
}
};
handleLoadMore = debounce(() => {
this.props.dispatch(expandBookmarkedStatuses());
}, 300, { leading: true })
}, 300, { leading: true });
render () {
const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;

View File

@ -72,4 +72,4 @@ class ClosedRegistrationsModal extends ImmutablePureComponent {
);
}
};
}

View File

@ -12,7 +12,7 @@ const mapStateToProps = (state, { columnId }) => {
settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'community']),
};
};
const mapDispatchToProps = (dispatch, { columnId }) => {
return {
onChange (key, checked) {

View File

@ -63,16 +63,16 @@ class CommunityTimeline extends React.PureComponent {
} else {
dispatch(addColumn('COMMUNITY', { other: { onlyMedia } }));
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
componentDidMount () {
const { dispatch, onlyMedia } = this.props;
@ -112,13 +112,13 @@ class CommunityTimeline extends React.PureComponent {
setRef = c => {
this.column = c;
}
};
handleLoadMore = maxId => {
const { dispatch, onlyMedia } = this.props;
dispatch(expandCommunityTimeline({ maxId, onlyMedia }));
}
};
render () {
const { intl, hasUnread, columnId, multiColumn, onlyMedia } = this.props;

View File

@ -32,7 +32,7 @@ class ActionBar extends React.PureComponent {
handleLogout = () => {
this.props.onLogout();
}
};
render () {
const { intl } = this.props;

View File

@ -22,9 +22,9 @@ import { length } from 'stringz';
const messages = defineMessages({
placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' },
missingDescriptionMessage: { id: 'confirmations.missing_media_description.message',
defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' },
defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' },
missingDescriptionConfirm: { id: 'confirmations.missing_media_description.confirm',
defaultMessage: 'Send anyway' },
defaultMessage: 'Send anyway' },
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
});
@ -83,22 +83,22 @@ class ComposeForm extends ImmutablePureComponent {
handleChange = (e) => {
this.props.onChange(e.target.value);
}
};
getFulltextForCharacterCounting = () => {
return [
this.props.spoiler? this.props.spoilerText: '',
countableText(this.props.text),
this.props.advancedOptions && this.props.advancedOptions.get('do_not_federate') ? ' 👁️' : ''
this.props.advancedOptions && this.props.advancedOptions.get('do_not_federate') ? ' 👁️' : '',
].join('');
}
};
canSubmit = () => {
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
const fulltext = this.getFulltextForCharacterCounting();
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (!fulltext.trim().length && !anyMedia));
}
};
handleSubmit = (overriddenVisibility = null) => {
const {
@ -129,7 +129,7 @@ class ComposeForm extends ImmutablePureComponent {
}
onSubmit(this.context.router ? this.context.router.history : null);
}
}
};
// Changes the text value of the spoiler.
handleChangeSpoiler = ({ target: { value } }) => {
@ -137,7 +137,7 @@ class ComposeForm extends ImmutablePureComponent {
if (onChangeSpoilerText) {
onChangeSpoilerText(value);
}
}
};
setRef = c => {
this.composeForm = c;
@ -150,7 +150,7 @@ class ComposeForm extends ImmutablePureComponent {
if (onPickEmoji) {
onPickEmoji(selectionStart, data);
}
}
};
// Handles the secondary submit button.
handleSecondarySubmit = () => {
@ -158,16 +158,16 @@ class ComposeForm extends ImmutablePureComponent {
sideArm,
} = this.props;
this.handleSubmit(sideArm === 'none' ? null : sideArm);
}
};
// Selects a suggestion from the autofill.
onSuggestionSelected = (tokenStart, token, value) => {
this.props.onSuggestionSelected(tokenStart, token, value, ['text']);
}
};
onSpoilerSuggestionSelected = (tokenStart, token, value) => {
this.props.onSuggestionSelected(tokenStart, token, value, ['spoiler_text']);
}
};
handleKeyDown = (e) => {
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
@ -177,21 +177,21 @@ class ComposeForm extends ImmutablePureComponent {
if (e.keyCode == 13 && e.altKey) {
this.handleSecondarySubmit();
}
}
};
// Sets a reference to the textarea.
setAutosuggestTextarea = (textareaComponent) => {
if (textareaComponent) {
this.textarea = textareaComponent.textarea;
}
}
};
// Sets a reference to the CW field.
handleRefSpoilerText = (spoilerComponent) => {
if (spoilerComponent) {
this.spoilerText = spoilerComponent.input;
}
}
};
handleFocus = () => {
if (this.composeForm && !this.props.singleColumn) {
@ -200,7 +200,7 @@ class ComposeForm extends ImmutablePureComponent {
this.composeForm.scrollIntoView();
}
}
}
};
componentDidMount () {
this._updateFocusAndSelection({ });
@ -217,7 +217,7 @@ class ComposeForm extends ImmutablePureComponent {
// - Replying to more than one user, selects any usernames past
// the first; this provides a convenient shortcut to drop
// everyone else from the conversation.
_updateFocusAndSelection = (prevProps) => {
_updateFocusAndSelection = (prevProps) => {
const {
textarea,
spoilerText,
@ -271,7 +271,7 @@ class ComposeForm extends ImmutablePureComponent {
}
}
}
}
};
render () {

View File

@ -64,7 +64,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
}
this.setState({ open: !this.state.open, openedViaKeyboard: type !== 'click' });
}
}
};
handleKeyDown = (e) => {
switch (e.key) {
@ -72,13 +72,13 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
this.handleClose();
break;
}
}
};
handleMouseDown = () => {
if (!this.state.open) {
this.activeElement = document.activeElement;
}
}
};
handleButtonKeyDown = (e) => {
switch(e.key) {
@ -87,7 +87,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
this.handleMouseDown();
break;
}
}
};
handleKeyPress = (e) => {
switch(e.key) {
@ -98,14 +98,14 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
e.preventDefault();
break;
}
}
};
handleClose = () => {
if (this.state.open && this.activeElement) {
this.activeElement.focus({ preventScroll: true });
}
this.setState({ open: false });
}
};
handleItemClick = (e) => {
const {
@ -151,22 +151,22 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
...rest,
active: value && name === value,
name,
})
}),
),
};
}
};
setTargetRef = c => {
this.target = c;
}
};
findTarget = () => {
return this.target;
}
};
handleOverlayEnter = (state) => {
this.setState({ placement: state.placement });
}
};
// Rendering.
render () {

View File

@ -44,12 +44,12 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
if (this.node && !this.node.contains(e.target)) {
this.props.onClose();
}
}
};
// Stores our node in `this.node`.
setRef = (node) => {
this.node = node;
}
};
// On mounting, we add our listeners.
componentDidMount () {
@ -84,7 +84,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
onClose();
}
onChange(name);
}
};
// Handle changes differently whether the dropdown is a list of options or actions
handleChange = (name) => {
@ -93,7 +93,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
} else {
this.setState({ value: name });
}
}
};
handleKeyDown = (e) => {
const index = Number(e.currentTarget.getAttribute('data-index'));
@ -135,11 +135,11 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
e.preventDefault();
e.stopPropagation();
}
}
};
setFocusRef = c => {
this.focusedItem = c;
}
};
renderItem = (item, i) => {
const { name, icon, meta, text } = item;
@ -177,7 +177,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
{contents}
</div>
);
}
};
// Rendering.
render () {

View File

@ -58,7 +58,7 @@ class ModifierPickerMenu extends React.PureComponent {
handleClick = e => {
this.props.onSelect(e.currentTarget.getAttribute('data-index') * 1);
}
};
componentWillReceiveProps (nextProps) {
if (nextProps.active) {
@ -76,7 +76,7 @@ class ModifierPickerMenu extends React.PureComponent {
if (this.node && !this.node.contains(e.target)) {
this.props.onClose();
}
}
};
attachListeners () {
document.addEventListener('click', this.handleDocumentClick, false);
@ -90,7 +90,7 @@ class ModifierPickerMenu extends React.PureComponent {
setRef = c => {
this.node = c;
}
};
render () {
const { active } = this.props;
@ -125,12 +125,12 @@ class ModifierPicker extends React.PureComponent {
} else {
this.props.onOpen();
}
}
};
handleSelect = modifier => {
this.props.onChange(modifier);
this.props.onClose();
}
};
render () {
const { active, modifier } = this.props;
@ -175,7 +175,7 @@ class EmojiPickerMenu extends React.PureComponent {
if (this.node && !this.node.contains(e.target)) {
this.props.onClose();
}
}
};
componentDidMount () {
document.addEventListener('click', this.handleDocumentClick, false);
@ -199,7 +199,7 @@ class EmojiPickerMenu extends React.PureComponent {
setRef = c => {
this.node = c;
}
};
getI18n = () => {
const { intl } = this.props;
@ -220,7 +220,7 @@ class EmojiPickerMenu extends React.PureComponent {
custom: intl.formatMessage(messages.custom),
},
};
}
};
handleClick = (emoji, event) => {
if (!emoji.native) {
@ -230,19 +230,19 @@ class EmojiPickerMenu extends React.PureComponent {
this.props.onClose();
}
this.props.onPick(emoji);
}
};
handleModifierOpen = () => {
this.setState({ modifierOpen: true });
}
};
handleModifierClose = () => {
this.setState({ modifierOpen: false });
}
};
handleModifierChange = modifier => {
this.props.onSkinTone(modifier);
}
};
render () {
const { loading, style, intl, custom_emojis, skinTone, frequentlyUsedEmojis } = this.props;
@ -327,7 +327,7 @@ class EmojiPickerDropdown extends React.PureComponent {
setRef = (c) => {
this.dropdown = c;
}
};
onShowDropdown = () => {
this.setState({ active: true });
@ -344,11 +344,11 @@ class EmojiPickerDropdown extends React.PureComponent {
this.setState({ loading: false, active: false });
});
}
}
};
onHideDropdown = () => {
this.setState({ active: false });
}
};
onToggle = (e) => {
if (!this.state.loading && (!e.key || e.key === 'Enter')) {
@ -358,21 +358,21 @@ class EmojiPickerDropdown extends React.PureComponent {
this.onShowDropdown(e);
}
}
}
};
handleKeyDown = e => {
if (e.key === 'Escape') {
this.onHideDropdown();
}
}
};
setTargetRef = c => {
this.target = c;
}
};
findTarget = () => {
return this.target;
}
};
render () {
const { intl, onPickEmoji, onSkinTone, skinTone, frequentlyUsedEmojis, button } = this.props;

View File

@ -47,6 +47,7 @@ const messages = defineMessages({
export default @injectIntl
class Header extends ImmutablePureComponent {
static propTypes = {
columns: ImmutablePropTypes.list,
unreadNotifications: PropTypes.number,
@ -63,7 +64,7 @@ class Header extends ImmutablePureComponent {
this.props.onLogout();
return false;
}
};
render () {
const { intl, columns, unreadNotifications, showNotificationsBadge, onSettingsClick } = this.props;
@ -71,8 +72,8 @@ class Header extends ImmutablePureComponent {
// Only renders the component if the column isn't being shown.
const renderForColumn = conditionalRender.bind(null,
columnId => !columns || !columns.some(
column => column.get('id') === columnId
)
column => column.get('id') === columnId,
),
);
// The result.
@ -125,10 +126,11 @@ class Header extends ImmutablePureComponent {
<a
aria-label={intl.formatMessage(messages.logout)}
onClick={this.handleLogoutClick}
href={ signOutLink }
href={signOutLink}
title={intl.formatMessage(messages.logout)}
><Icon id='sign-out' /></a>
</nav>
);
};
}
}

View File

@ -40,7 +40,7 @@ class LanguageDropdownMenu extends React.PureComponent {
if (this.node && !this.node.contains(e.target)) {
this.props.onClose();
}
}
};
componentDidMount () {
document.addEventListener('click', this.handleDocumentClick, false);
@ -63,15 +63,15 @@ class LanguageDropdownMenu extends React.PureComponent {
setRef = c => {
this.node = c;
}
};
setListRef = c => {
this.listNode = c;
}
};
handleSearchChange = ({ target }) => {
this.setState({ searchValue: target.value });
}
};
search () {
const { languages, value, frequentlyUsedLanguages } = this.props;
@ -122,7 +122,7 @@ class LanguageDropdownMenu extends React.PureComponent {
this.props.onClose();
this.props.onChange(value);
}
};
handleKeyDown = e => {
const { onClose } = this.props;
@ -163,7 +163,7 @@ class LanguageDropdownMenu extends React.PureComponent {
e.preventDefault();
e.stopPropagation();
}
}
};
handleSearchKeyDown = e => {
const { onChange, onClose } = this.props;
@ -199,11 +199,11 @@ class LanguageDropdownMenu extends React.PureComponent {
break;
}
}
};
handleClear = () => {
this.setState({ searchValue: '' });
}
};
renderItem = lang => {
const { value } = this.props;
@ -213,7 +213,7 @@ class LanguageDropdownMenu extends React.PureComponent {
<span className='language-dropdown__dropdown__results__item__native-name'>{lang[2]}</span> <span className='language-dropdown__dropdown__results__item__common-name'>({lang[1]})</span>
</div>
);
}
};
render () {
const { intl } = this.props;
@ -259,7 +259,7 @@ class LanguageDropdown extends React.PureComponent {
}
this.setState({ open: !this.state.open });
}
};
handleClose = () => {
const { value, onClose } = this.props;
@ -270,24 +270,24 @@ class LanguageDropdown extends React.PureComponent {
this.setState({ open: false });
onClose(value);
}
};
handleChange = value => {
const { onChange } = this.props;
onChange(value);
}
};
setTargetRef = c => {
this.target = c;
}
};
findTarget = () => {
return this.target;
}
};
handleOverlayEnter = (state) => {
this.setState({ placement: state.placement });
}
};
render () {
const { value, intl, frequentlyUsedLanguages } = this.props;

View File

@ -144,7 +144,7 @@ class ComposerOptions extends ImmutablePureComponent {
if (files.length && onUpload) {
onUpload(files);
}
}
};
// Handles attachment clicks.
handleClickAttach = (name) => {
@ -164,12 +164,12 @@ class ComposerOptions extends ImmutablePureComponent {
}
return;
}
}
};
// Handles a ref to the file input.
handleRefFileElement = (fileElement) => {
this.fileElement = fileElement;
}
};
renderToggleItemContents = (item) => {
const { onChangeAdvancedOption } = this.props;

View File

@ -49,15 +49,15 @@ class Option extends React.PureComponent {
onSuggestionsClearRequested = () => {
this.props.onClearSuggestions();
}
};
onSuggestionsFetchRequested = (token) => {
this.props.onFetchSuggestions(token);
}
};
onSuggestionSelected = (tokenStart, token, value) => {
this.props.onSuggestionSelected(tokenStart, token, value, ['poll', 'options', this.props.index]);
}
};
render () {
const { isPollMultiple, title, lang, index, autoFocus, intl } = this.props;

View File

@ -94,5 +94,6 @@ class Publisher extends ImmutablePureComponent {
</div>
</div>
);
};
}
}

View File

@ -33,7 +33,7 @@ class ReplyIndicator extends ImmutablePureComponent {
if (onCancel) {
onCancel();
}
}
};
// Rendering.
render () {

View File

@ -71,14 +71,14 @@ class Search extends React.PureComponent {
setRef = c => {
this.searchForm = c;
}
};
handleChange = (e) => {
const { onChange } = this.props;
if (onChange) {
onChange(e.target.value);
}
}
};
handleClear = (e) => {
const {
@ -90,11 +90,11 @@ class Search extends React.PureComponent {
if (onClear && (submitted || value && value.length)) {
onClear();
}
}
};
handleBlur = () => {
this.setState({ expanded: false });
}
};
handleFocus = () => {
this.setState({ expanded: true });
@ -106,7 +106,7 @@ class Search extends React.PureComponent {
this.searchForm.scrollIntoView();
}
}
}
};
handleKeyUp = (e) => {
const { onSubmit } = this.props;
@ -121,11 +121,11 @@ class Search extends React.PureComponent {
case 'Escape':
focusRoot();
}
}
};
findTarget = () => {
return this.searchForm;
}
};
render () {
const { intl, value, submitted } = this.props;

View File

@ -103,7 +103,7 @@ class SearchResults extends ImmutablePureComponent {
<section className='search-results__section'>
<h5><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Posts' /></h5>
{results.get('statuses').map(statusId => <StatusContainer id={statusId} key={statusId}/>)}
{results.get('statuses').map(statusId => <StatusContainer id={statusId} key={statusId} />)}
{results.get('statuses').size >= 5 && <LoadMore visible onClick={this.handleLoadMoreStatuses} />}
</section>
@ -136,5 +136,6 @@ class SearchResults extends ImmutablePureComponent {
{hashtags}
</div>
);
};
}
}

View File

@ -51,9 +51,10 @@ class TextareaIcons extends ImmutablePureComponent {
id={icon}
/>
</span>
) : null
) : null,
) : null}
</div>
);
}
}

View File

@ -23,12 +23,12 @@ export default class Upload extends ImmutablePureComponent {
handleUndoClick = e => {
e.stopPropagation();
this.props.onUndo(this.props.media.get('id'));
}
};
handleFocalPointClick = e => {
e.stopPropagation();
this.props.onOpenFocalPoint(this.props.media.get('id'));
}
};
render () {
const { media } = this.props;
@ -39,7 +39,7 @@ export default class Upload extends ImmutablePureComponent {
return (
<div className='compose-form__upload' tabIndex='0' role='button'>
<Motion defaultStyle={{ scale: 0.8 }} style={{ scale: spring(1, { stiffness: 180, damping: 12, }) }}>
<Motion defaultStyle={{ scale: 0.8 }} style={{ scale: spring(1, { stiffness: 180, damping: 12 }) }}>
{({ scale }) => (
<div className='compose-form__upload-thumbnail' style={{ transform: `scale(${scale})`, backgroundImage: `url(${media.get('preview_url')})`, backgroundPosition: `${x}% ${y}%` }}>
<div className='compose-form__upload__actions'>

View File

@ -6,6 +6,7 @@ import UploadContainer from '../containers/upload_container';
import SensitiveButtonContainer from '../containers/sensitive_button_container';
export default class UploadForm extends ImmutablePureComponent {
static propTypes = {
mediaIds: ImmutablePropTypes.list.isRequired,
};

View File

@ -22,11 +22,11 @@ import { privacyPreference } from 'flavours/glitch/utils/privacy_preference';
const messages = defineMessages({
missingDescriptionMessage: { id: 'confirmations.missing_media_description.message',
defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' },
defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' },
missingDescriptionConfirm: { id: 'confirmations.missing_media_description.confirm',
defaultMessage: 'Send anyway' },
defaultMessage: 'Send anyway' },
missingDescriptionEdit: { id: 'confirmations.missing_media_description.edit',
defaultMessage: 'Edit media' },
defaultMessage: 'Edit media' },
});
// State mapping.
@ -38,12 +38,12 @@ function mapStateToProps (state) {
const sideArmRestrictedPrivacy = replyPrivacy ? privacyPreference(replyPrivacy, sideArmBasePrivacy) : null;
let sideArmPrivacy = null;
switch (state.getIn(['local_settings', 'side_arm_reply_mode'])) {
case 'copy':
sideArmPrivacy = replyPrivacy;
break;
case 'restrict':
sideArmPrivacy = sideArmRestrictedPrivacy;
break;
case 'copy':
sideArmPrivacy = replyPrivacy;
break;
case 'restrict':
sideArmPrivacy = sideArmRestrictedPrivacy;
break;
}
sideArmPrivacy = sideArmPrivacy || sideArmBasePrivacy;
return {
@ -72,7 +72,7 @@ function mapStateToProps (state) {
isInReply: state.getIn(['compose', 'in_reply_to']) !== null,
lang: state.getIn(['compose', 'language']),
};
};
}
// Dispatch mapping.
const mapDispatchToProps = (dispatch, { intl }) => ({
@ -124,7 +124,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onConfirm: () => {
if (overriddenVisibility) {
dispatch(changeComposeVisibility(overriddenVisibility));
};
}
dispatch(submitCompose(routerHistory));
},
secondary: intl.formatMessage(messages.missingDescriptionEdit),

View File

@ -23,7 +23,7 @@ function mapStateToProps (state) {
showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),
contentType: state.getIn(['compose', 'content_type']),
};
};
}
const mapDispatchToProps = (dispatch) => ({

View File

@ -8,7 +8,7 @@ import { profileLink, termsLink } from 'flavours/glitch/utils/backend_links';
const buildHashtagRE = () => {
try {
const HASHTAG_SEPARATORS = "_\\u00b7\\u200c";
const HASHTAG_SEPARATORS = '_\\u00b7\\u200c';
const ALPHA = '\\p{L}\\p{M}';
const WORD = '\\p{L}\\p{M}\\p{N}\\p{Pc}';
return new RegExp(
@ -22,7 +22,7 @@ const buildHashtagRE = () => {
'[' + WORD + '_]*' +
'[' + ALPHA + ']' +
'[' + WORD + '_]*' +
'))', 'iu'
'))', 'iu',
);
} catch {
return /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i;

View File

@ -43,6 +43,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
export default @connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class Compose extends React.PureComponent {
static propTypes = {
multiColumn: PropTypes.bool,
showSearch: PropTypes.bool,

View File

@ -6,4 +6,4 @@ export function countableText(inputText) {
return inputText
.replace(urlRegex, urlPlaceholder)
.replace(/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/ig, '$1@$3');
};
}

View File

@ -60,12 +60,12 @@ class Conversation extends ImmutablePureComponent {
}
destination = `/statuses/${lastStatus.get('id')}`;
}
let state = {...router.history.location.state};
let state = { ...router.history.location.state };
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
router.history.push(destination, state);
e.preventDefault();
}
}
};
handleMouseEnter = ({ currentTarget }) => {
if (autoPlayGif) {
@ -78,7 +78,7 @@ class Conversation extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-original');
}
}
};
handleMouseLeave = ({ currentTarget }) => {
if (autoPlayGif) {
@ -91,7 +91,7 @@ class Conversation extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-static');
}
}
};
handleClick = () => {
if (!this.context.router) {
@ -105,31 +105,31 @@ class Conversation extends ImmutablePureComponent {
}
this.context.router.history.push(`/@${lastStatus.getIn(['account', 'acct'])}/${lastStatus.get('id')}`);
}
};
handleMarkAsRead = () => {
this.props.markRead();
}
};
handleReply = () => {
this.props.reply(this.props.lastStatus, this.context.router.history);
}
};
handleDelete = () => {
this.props.delete();
}
};
handleHotkeyMoveUp = () => {
this.props.onMoveUp(this.props.conversationId);
}
};
handleHotkeyMoveDown = () => {
this.props.onMoveDown(this.props.conversationId);
}
};
handleConversationMute = () => {
this.props.onMute(this.props.lastStatus);
}
};
handleShowMore = () => {
this.props.onToggleHidden(this.props.lastStatus);
@ -141,7 +141,7 @@ class Conversation extends ImmutablePureComponent {
setExpansion = value => {
this.setState({ isExpanded: value });
}
};
render () {
const { accounts, lastStatus, unread, scrollKey, intl } = this.props;

View File

@ -16,17 +16,17 @@ export default class ConversationsList extends ImmutablePureComponent {
onLoadMore: PropTypes.func,
};
getCurrentIndex = id => this.props.conversations.findIndex(x => x.get('id') === id)
getCurrentIndex = id => this.props.conversations.findIndex(x => x.get('id') === id);
handleMoveUp = id => {
const elementIndex = this.getCurrentIndex(id) - 1;
this._selectChild(elementIndex, true);
}
};
handleMoveDown = id => {
const elementIndex = this.getCurrentIndex(id) + 1;
this._selectChild(elementIndex, false);
}
};
_selectChild (index, align_top) {
const container = this.node.node;
@ -44,7 +44,7 @@ export default class ConversationsList extends ImmutablePureComponent {
setRef = c => {
this.node = c;
}
};
handleLoadOlder = debounce(() => {
const last = this.props.conversations.last();
@ -52,7 +52,7 @@ export default class ConversationsList extends ImmutablePureComponent {
if (last && last.get('last_status')) {
this.props.onLoadMore(last.get('last_status'));
}
}, 300, { leading: true })
}, 300, { leading: true });
render () {
const { conversations, onLoadMore, ...other } = this.props;

View File

@ -43,16 +43,16 @@ class DirectTimeline extends React.PureComponent {
} else {
dispatch(addColumn('DIRECT', {}));
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
componentDidMount () {
const { dispatch, conversationsMode } = this.props;
@ -89,15 +89,15 @@ class DirectTimeline extends React.PureComponent {
setRef = c => {
this.column = c;
}
};
handleLoadMoreTimeline = maxId => {
this.props.dispatch(expandDirectTimeline({ maxId }));
}
};
handleLoadMoreConversations = maxId => {
this.props.dispatch(expandConversations({ maxId }));
}
};
render () {
const { intl, hasUnread, columnId, multiColumn, conversationsMode } = this.props;

View File

@ -118,7 +118,7 @@ class AccountCard extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-original');
}
}
};
handleMouseLeave = ({ currentTarget }) => {
if (autoPlayGif) {
@ -131,7 +131,7 @@ class AccountCard extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-static');
}
}
};
handleFollow = () => {
this.props.onFollow(this.props.account);
@ -143,11 +143,11 @@ class AccountCard extends ImmutablePureComponent {
handleMute = () => {
this.props.onMute(this.props.account);
}
};
handleEditProfile = () => {
window.open('/settings/profile', '_blank');
}
};
handleDismiss = (e) => {
const { account, onDismiss } = this.props;
@ -155,7 +155,7 @@ class AccountCard extends ImmutablePureComponent {
e.preventDefault();
e.stopPropagation();
}
};
render() {
const { account, intl } = this.props;

View File

@ -64,7 +64,7 @@ class Directory extends React.PureComponent {
} else {
dispatch(addColumn('DIRECTORY', this.getParams(this.props, this.state)));
}
}
};
getParams = (props, state) => ({
order: state.order === null ? (props.params.order || 'active') : state.order,
@ -74,11 +74,11 @@ class Directory extends React.PureComponent {
handleMove = dir => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
componentDidMount () {
const { dispatch } = this.props;
@ -97,7 +97,7 @@ class Directory extends React.PureComponent {
setRef = c => {
this.column = c;
}
};
handleChangeOrder = e => {
const { dispatch, columnId } = this.props;
@ -107,7 +107,7 @@ class Directory extends React.PureComponent {
} else {
this.setState({ order: e.target.value });
}
}
};
handleChangeLocal = e => {
const { dispatch, columnId } = this.props;
@ -117,12 +117,12 @@ class Directory extends React.PureComponent {
} else {
this.setState({ local: e.target.value === '1' });
}
}
};
handleLoadMore = () => {
const { dispatch } = this.props;
dispatch(expandDirectory(this.getParams(this.props, this.state)));
}
};
render () {
const { isLoading, accountIds, intl, columnId, multiColumn, domain } = this.props;

View File

@ -41,11 +41,11 @@ class Explore extends React.PureComponent {
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setRef = c => {
this.column = c;
}
};
render() {
const { intl, multiColumn, isSearching } = this.props;

View File

@ -33,7 +33,7 @@ class Statuses extends React.PureComponent {
handleLoadMore = debounce(() => {
const { dispatch } = this.props;
dispatch(expandTrendingStatuses());
}, 300, { leading: true })
}, 300, { leading: true });
render () {
const { isLoading, hasMore, statusIds, multiColumn } = this.props;

View File

@ -29,7 +29,7 @@ class Suggestions extends React.PureComponent {
handleDismiss = (accountId) => {
const { dispatch } = this.props;
dispatch(dismissSuggestion(accountId));
}
};
render () {
const { isLoading, suggestions } = this.props;

View File

@ -48,24 +48,24 @@ class Favourites extends ImmutablePureComponent {
} else {
dispatch(addColumn('FAVOURITES', {}));
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setRef = c => {
this.column = c;
}
};
handleLoadMore = debounce(() => {
this.props.dispatch(expandFavouritedStatuses());
}, 300, { leading: true })
}, 300, { leading: true });
render () {
const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;

View File

@ -48,15 +48,15 @@ class Favourites extends ImmutablePureComponent {
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setRef = c => {
this.column = c;
}
};
handleRefresh = () => {
this.props.dispatch(fetchFavourites(this.props.params.statusId));
}
};
render () {
const { intl, accountIds, multiColumn } = this.props;

View File

@ -71,7 +71,7 @@ class SelectFilter extends React.PureComponent {
<span className='language-dropdown__dropdown__results__item__native-name'>{filter[1]}</span> {warning}
</div>
);
}
};
renderCreateNew (name) {
return (
@ -83,11 +83,11 @@ class SelectFilter extends React.PureComponent {
handleSearchChange = ({ target }) => {
this.setState({ searchValue: target.value });
}
};
setListRef = c => {
this.listNode = c;
}
};
handleKeyDown = e => {
const index = Array.from(this.listNode.childNodes).findIndex(node => node === e.currentTarget);
@ -125,7 +125,7 @@ class SelectFilter extends React.PureComponent {
e.preventDefault();
e.stopPropagation();
}
}
};
handleSearchKeyDown = e => {
let element = null;
@ -143,11 +143,11 @@ class SelectFilter extends React.PureComponent {
break;
}
}
};
handleClear = () => {
this.setState({ searchValue: '' });
}
};
handleItemClick = e => {
const value = e.currentTarget.getAttribute('data-index');
@ -155,7 +155,7 @@ class SelectFilter extends React.PureComponent {
e.preventDefault();
this.props.onSelectFilter(value);
}
};
handleNewFilterClick = e => {
e.preventDefault();

View File

@ -50,7 +50,7 @@ class Account extends ImmutablePureComponent {
} else {
dispatch(followAccount(account.get('id')));
}
}
};
render () {
const { account, intl } = this.props;

View File

@ -69,7 +69,7 @@ class FollowRecommendations extends ImmutablePureComponent {
}));
router.history.push('/home');
}
};
render () {
const { suggestions, isLoading } = this.props;

View File

@ -107,11 +107,11 @@ class Followers extends ImmutablePureComponent {
setRef = c => {
this.column = c;
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
render () {
const { accountId, accountIds, hasMore, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;

View File

@ -107,11 +107,11 @@ class Following extends ImmutablePureComponent {
setRef = c => {
this.column = c;
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
render () {
const { accountId, accountIds, hasMore, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;

View File

@ -35,7 +35,7 @@ class Content extends ImmutablePureComponent {
setRef = c => {
this.node = c;
}
};
componentDidMount () {
this._updateLinks();
@ -89,7 +89,7 @@ class Content extends ImmutablePureComponent {
e.preventDefault();
this.context.router.history.push(`/@${mention.get('acct')}`);
}
}
};
onHashtagClick = (hashtag, e) => {
hashtag = hashtag.replace(/^#/, '');
@ -98,14 +98,14 @@ class Content extends ImmutablePureComponent {
e.preventDefault();
this.context.router.history.push(`/tags/${hashtag}`);
}
}
};
onStatusClick = (status, e) => {
if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
this.context.router.history.push(`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`);
}
}
};
handleMouseEnter = ({ currentTarget }) => {
if (autoPlayGif) {
@ -118,7 +118,7 @@ class Content extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-original');
}
}
};
handleMouseLeave = ({ currentTarget }) => {
if (autoPlayGif) {
@ -131,7 +131,7 @@ class Content extends ImmutablePureComponent {
let emoji = emojis[i];
emoji.src = emoji.getAttribute('data-static');
}
}
};
render () {
const { announcement } = this.props;
@ -216,11 +216,11 @@ class Reaction extends ImmutablePureComponent {
} else {
addReaction(announcementId, reaction.get('name'));
}
}
};
handleMouseEnter = () => this.setState({ hovered: true })
handleMouseEnter = () => this.setState({ hovered: true });
handleMouseLeave = () => this.setState({ hovered: false })
handleMouseLeave = () => this.setState({ hovered: false });
render () {
const { reaction } = this.props;
@ -254,7 +254,7 @@ class ReactionsBar extends ImmutablePureComponent {
handleEmojiPick = data => {
const { addReaction, announcementId } = this.props;
addReaction(announcementId, data.native.replace(/:/g, ''));
}
};
willEnter () {
return { scale: reduceMotion ? 1 : 0 };
@ -397,15 +397,15 @@ class Announcements extends ImmutablePureComponent {
handleChangeIndex = index => {
this.setState({ index: index % this.props.announcements.size });
}
};
handleNextClick = () => {
this.setState({ index: (this.state.index + 1) % this.props.announcements.size });
}
};
handlePrevClick = () => {
this.setState({ index: (this.props.announcements.size + this.state.index - 1) % this.props.announcements.size });
}
};
render () {
const { announcements, intl } = this.props;

View File

@ -79,9 +79,9 @@ const badgeDisplay = (number, limit) => {
const NAVIGATION_PANEL_BREAKPOINT = 600 + (285 * 2) + (10 * 2);
export default @connect(makeMapStateToProps, mapDispatchToProps)
export default @connect(makeMapStateToProps, mapDispatchToProps)
@injectIntl
class GettingStarted extends ImmutablePureComponent {
class GettingStarted extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object.isRequired,
@ -164,7 +164,7 @@ const NAVIGATION_PANEL_BREAKPOINT = 600 + (285 * 2) + (10 * 2);
<div key='9'>
<ColumnLink key='lists' icon='bars' text={intl.formatMessage(messages.lists)} to='/lists' />
{lists.filter(list => !columns.find(item => item.get('id') === 'LIST' && item.getIn(['params', 'id']) === list.get('id'))).map(list =>
<ColumnLink key={`list-${list.get('id')}`} to={`/lists/${list.get('id')}`} icon='list-ul' text={list.get('title')} />
<ColumnLink key={`list-${list.get('id')}`} to={`/lists/${list.get('id')}`} icon='list-ul' text={list.get('title')} />,
)}
</div>,
]);

View File

@ -35,11 +35,11 @@ class gettingStartedMisc extends ImmutablePureComponent {
openOnboardingModal = (e) => {
this.props.dispatch(openModal('ONBOARDING'));
}
};
openFeaturedAccountsModal = (e) => {
this.props.dispatch(openModal('PINNED_ACCOUNTS_EDITOR'));
}
};
render () {
const { intl } = this.props;

View File

@ -38,7 +38,7 @@ class ColumnSettings extends React.PureComponent {
} else {
return tags;
}
};
}
onSelect = mode => value => {
const oldValue = this.tags(mode);
@ -98,7 +98,7 @@ class ColumnSettings extends React.PureComponent {
default:
return '';
}
};
}
render () {
const { settings, onChange } = this.props;

View File

@ -54,7 +54,7 @@ class HashtagTimeline extends React.PureComponent {
} else {
dispatch(addColumn('HASHTAG', { id: this.props.params.id }));
}
}
};
title = () => {
const { id } = this.props.params;
@ -73,7 +73,7 @@ class HashtagTimeline extends React.PureComponent {
}
return title;
}
};
additionalFor = (mode) => {
const { tags } = this.props.params;
@ -83,16 +83,16 @@ class HashtagTimeline extends React.PureComponent {
} else {
return '';
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
_subscribe (dispatch, id, tags = {}, local) {
const { signedIn } = this.context.identity;
@ -157,14 +157,14 @@ class HashtagTimeline extends React.PureComponent {
setRef = c => {
this.column = c;
}
};
handleLoadMore = maxId => {
const { dispatch, params } = this.props;
const { id, tags, local } = params;
dispatch(expandHashtagTimeline(id, { maxId, tags, local }));
}
};
handleFollow = () => {
const { dispatch, params, tag } = this.props;
@ -180,7 +180,7 @@ class HashtagTimeline extends React.PureComponent {
} else {
dispatch(followHashtag(id));
}
}
};
render () {
const { hasUnread, columnId, multiColumn, tag, intl } = this.props;

View File

@ -60,24 +60,24 @@ class HomeTimeline extends React.PureComponent {
} else {
dispatch(addColumn('HOME', {}));
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setRef = c => {
this.column = c;
}
};
handleLoadMore = maxId => {
this.props.dispatch(expandHomeTimeline({ maxId }));
}
};
componentDidMount () {
setTimeout(() => this.props.dispatch(fetchAnnouncements()), 700);
@ -116,7 +116,7 @@ class HomeTimeline extends React.PureComponent {
handleToggleAnnouncementsClick = (e) => {
e.stopPropagation();
this.props.dispatch(toggleShowAnnouncements());
}
};
render () {
const { intl, hasUnread, columnId, multiColumn, hasAnnouncements, unreadAnnouncements, showAnnouncements } = this.props;

View File

@ -30,14 +30,14 @@ class Copypaste extends React.PureComponent {
setRef = c => {
this.input = c;
}
};
handleInputClick = () => {
this.setState({ copied: false });
this.input.focus();
this.input.select();
this.input.setSelectionRange(0, this.input.value.length);
}
};
handleButtonClick = () => {
const { value } = this.props;
@ -45,7 +45,7 @@ class Copypaste extends React.PureComponent {
this.input.blur();
this.setState({ copied: true });
this.timeout = setTimeout(() => this.setState({ copied: false }), 700);
}
};
componentWillUnmount () {
if (this.timeout) clearTimeout(this.timeout);
@ -86,7 +86,7 @@ class InteractionModal extends React.PureComponent {
handleSignupClick = () => {
this.props.onSignupClick();
}
};
render () {
const { url, type, displayNameHtml } = this.props;

View File

@ -33,16 +33,16 @@ class ListForm extends React.PureComponent {
handleChange = e => {
this.props.onChange(e.target.value);
}
};
handleSubmit = e => {
e.preventDefault();
this.props.onSubmit();
}
};
handleClick = () => {
this.props.onSubmit();
}
};
render () {
const { value, disabled, intl } = this.props;

View File

@ -20,17 +20,17 @@ export default class Search extends React.PureComponent {
handleChange = e => {
this.props.onChange(e.target.value);
}
};
handleKeyUp = e => {
if (e.keyCode === 13) {
this.props.onSubmit(this.props.value);
}
}
};
handleClear = () => {
this.props.onClear();
}
};
render () {
const { value, intl } = this.props;

View File

@ -58,16 +58,16 @@ class ListTimeline extends React.PureComponent {
dispatch(addColumn('LIST', { id: this.props.params.id }));
this.context.router.history.push('/');
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
componentDidMount () {
const { dispatch } = this.props;
@ -105,16 +105,16 @@ class ListTimeline extends React.PureComponent {
setRef = c => {
this.column = c;
}
};
handleLoadMore = maxId => {
const { id } = this.props.params;
this.props.dispatch(expandListTimeline(id, { maxId }));
}
};
handleEditClick = () => {
this.props.dispatch(openModal('LIST_EDITOR', { listId: this.props.params.id }));
}
};
handleDeleteClick = () => {
const { dispatch, columnId, intl } = this.props;
@ -126,20 +126,20 @@ class ListTimeline extends React.PureComponent {
onConfirm: () => {
dispatch(deleteList(id));
if (!!columnId) {
if (columnId) {
dispatch(removeColumn(columnId));
} else {
this.context.router.history.push('/lists');
}
},
}));
}
};
handleRepliesPolicyChange = ({ target }) => {
const { dispatch, list } = this.props;
const { id } = this.props.params;
this.props.dispatch(updateList(id, undefined, false, target.value));
}
};
render () {
const { hasUnread, columnId, multiColumn, list, intl } = this.props;

View File

@ -34,16 +34,16 @@ class NewListForm extends React.PureComponent {
handleChange = e => {
this.props.onChange(e.target.value);
}
};
handleSubmit = e => {
e.preventDefault();
this.props.onSubmit();
}
};
handleClick = () => {
this.props.onSubmit();
}
};
render () {
const { value, disabled, intl } = this.props;

View File

@ -72,7 +72,7 @@ class LocalSettingsNavigation extends React.PureComponent {
/>
<LocalSettingsNavigationItem
active={index === 5}
href={ preferencesLink }
href={preferencesLink}
index={5}
icon='cog'
title={intl.formatMessage(messages.preferences)}

View File

@ -26,7 +26,7 @@ export default class LocalSettingsPage extends React.PureComponent {
onNavigate(index);
e.preventDefault();
}
}
};
render () {
const { handleClick } = this;

View File

@ -60,7 +60,7 @@ class LocalSettingsPage extends React.PureComponent {
onChange={onChange}
>
<FormattedMessage id='settings.hicolor_privacy_icons' defaultMessage='High color privacy icons' />
<span className='hint'><FormattedMessage id='settings.hicolor_privacy_icons.hint' defaultMessage="Display privacy icons in bright and easily distinguishable colors" /></span>
<span className='hint'><FormattedMessage id='settings.hicolor_privacy_icons.hint' defaultMessage='Display privacy icons in bright and easily distinguishable colors' /></span>
</LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
@ -77,7 +77,7 @@ class LocalSettingsPage extends React.PureComponent {
onChange={onChange}
>
<FormattedMessage id='settings.tag_misleading_links' defaultMessage='Tag misleading links' />
<span className='hint'><FormattedMessage id='settings.tag_misleading_links.hint' defaultMessage="Add a visual indication with the link target host to every link not mentioning it explicitly" /></span>
<span className='hint'><FormattedMessage id='settings.tag_misleading_links.hint' defaultMessage='Add a visual indication with the link target host to every link not mentioning it explicitly' /></span>
</LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
@ -100,7 +100,7 @@ class LocalSettingsPage extends React.PureComponent {
id='mastodon-settings--notifications-tab_badge'
onChange={onChange}
>
<FormattedMessage id='settings.notifications.tab_badge' defaultMessage="Unread notifications badge" />
<FormattedMessage id='settings.notifications.tab_badge' defaultMessage='Unread notifications badge' />
<span className='hint'><FormattedMessage id='settings.notifications.tab_badge.hint' defaultMessage="Display a badge for unread notifications in the column icons when the notifications column isn't open" /></span>
</LocalSettingsPageItem>
<LocalSettingsPageItem
@ -110,7 +110,7 @@ class LocalSettingsPage extends React.PureComponent {
onChange={onChange}
>
<FormattedMessage id='settings.notifications.favicon_badge' defaultMessage='Unread notifications favicon badge' />
<span className='hint'><FormattedMessage id='settings.notifications.favicon_badge.hint' defaultMessage="Add a badge for unread notifications to the favicon" /></span>
<span className='hint'><FormattedMessage id='settings.notifications.favicon_badge.hint' defaultMessage='Add a badge for unread notifications to the favicon' /></span>
</LocalSettingsPageItem>
</section>
@ -306,7 +306,7 @@ class LocalSettingsPage extends React.PureComponent {
defaultMessage='user preferences'
/>
</a>
)
),
}}
/>
</span>
@ -414,7 +414,7 @@ class LocalSettingsPage extends React.PureComponent {
onChange={onChange}
dependsOn={[['collapsed', 'enabled']]}
dependsOnNot={[['collapsed', 'auto', 'all']]}
inputProps={{type: 'number', min: '200', max: '999'}}
inputProps={{ type: 'number', min: '200', max: '999' }}
>
<FormattedMessage id='settings.auto_collapse_height' defaultMessage='Height (in pixels) for a toot to be considered lengthy' />
</LocalSettingsPageItem>

View File

@ -31,7 +31,7 @@ export default class LocalSettingsPageItem extends React.PureComponent {
if (options && options.length > 0) onChange(item, target.value);
else if (placeholder) onChange(item, target.value);
else onChange(item, target.checked);
}
};
render () {
const { handleChange } = this;
@ -55,7 +55,7 @@ export default class LocalSettingsPageItem extends React.PureComponent {
let optionId = `${id}--${opt.value}`;
return (
<label htmlFor={optionId}>
<input
<input
type='radio'
name={id}
id={optionId}
@ -109,7 +109,7 @@ export default class LocalSettingsPageItem extends React.PureComponent {
onChange={handleChange}
disabled={!enabled}
{...inputProps}
/>
/>
{children}
</label>
</div>

View File

@ -32,28 +32,28 @@ export default class AdminReport extends ImmutablePureComponent {
handleMoveUp = () => {
const { notification, onMoveUp } = this.props;
onMoveUp(notification.get('id'));
}
};
handleMoveDown = () => {
const { notification, onMoveDown } = this.props;
onMoveDown(notification.get('id'));
}
};
handleOpen = () => {
this.handleOpenProfile();
}
};
handleOpenProfile = () => {
const { notification } = this.props;
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
}
};
handleMention = e => {
e.preventDefault();
const { notification, onMention } = this.props;
onMention(notification.get('account'), this.context.router.history);
}
};
getHandlers () {
return {

View File

@ -26,28 +26,28 @@ export default class NotificationFollow extends ImmutablePureComponent {
handleMoveUp = () => {
const { notification, onMoveUp } = this.props;
onMoveUp(notification.get('id'));
}
};
handleMoveDown = () => {
const { notification, onMoveDown } = this.props;
onMoveDown(notification.get('id'));
}
};
handleOpen = () => {
this.handleOpenProfile();
}
};
handleOpenProfile = () => {
const { notification } = this.props;
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
}
};
handleMention = e => {
e.preventDefault();
const { notification, onMention } = this.props;
onMention(notification.get('account'), this.context.router.history);
}
};
getHandlers () {
return {

View File

@ -27,7 +27,7 @@ export default class ColumnSettings extends React.PureComponent {
onPushChange = (path, checked) => {
this.props.onChange(['push', ...path], checked);
}
};
render () {
const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission } = this.props;

View File

@ -26,28 +26,28 @@ export default class NotificationFollow extends ImmutablePureComponent {
handleMoveUp = () => {
const { notification, onMoveUp } = this.props;
onMoveUp(notification.get('id'));
}
};
handleMoveDown = () => {
const { notification, onMoveDown } = this.props;
onMoveDown(notification.get('id'));
}
};
handleOpen = () => {
this.handleOpenProfile();
}
};
handleOpenProfile = () => {
const { notification } = this.props;
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
}
};
handleMention = e => {
e.preventDefault();
const { notification, onMention } = this.props;
onMention(notification.get('account'), this.context.router.history);
}
};
getHandlers () {
return {

View File

@ -32,28 +32,28 @@ class FollowRequest extends ImmutablePureComponent {
handleMoveUp = () => {
const { notification, onMoveUp } = this.props;
onMoveUp(notification.get('id'));
}
};
handleMoveDown = () => {
const { notification, onMoveDown } = this.props;
onMoveDown(notification.get('id'));
}
};
handleOpen = () => {
this.handleOpenProfile();
}
};
handleOpenProfile = () => {
const { notification } = this.props;
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
}
};
handleMention = e => {
e.preventDefault();
const { notification, onMention } = this.props;
onMention(notification.get('account'), this.context.router.history);
}
};
getHandlers () {
return {

View File

@ -23,11 +23,11 @@ class NotificationsPermissionBanner extends React.PureComponent {
handleClick = () => {
this.props.dispatch(requestBrowserPermission());
}
};
handleClose = () => {
this.props.dispatch(changeSetting(['notifications', 'dismissPermissionBanner'], true));
}
};
render () {
const { intl } = this.props;

View File

@ -29,7 +29,7 @@ class NotificationOverlay extends ImmutablePureComponent {
const mark = !this.props.notification.get('markedForDelete');
const id = this.props.notification.get('id');
this.props.onMarkForDelete(id, mark);
}
};
render () {
const { notification, show, intl } = this.props;

View File

@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import classNames from 'classnames'
import classNames from 'classnames';
export default class PillBarButton extends React.PureComponent {
@ -12,12 +12,12 @@ export default class PillBarButton extends React.PureComponent {
label: PropTypes.node.isRequired,
onChange: PropTypes.func.isRequired,
disabled: PropTypes.bool,
}
};
onChange = () => {
const { settings, settingPath } = this.props;
this.props.onChange(settingPath, !settings.getIn(settingPath));
}
};
render () {
const { prefix, settings, settingPath, label, disabled } = this.props;

View File

@ -14,11 +14,11 @@ export default class SettingToggle extends React.PureComponent {
onChange: PropTypes.func.isRequired,
defaultValue: PropTypes.bool,
disabled: PropTypes.bool,
}
};
onChange = ({ target }) => {
this.props.onChange(this.props.settingPath, target.checked);
}
};
render () {
const { prefix, settings, settingPath, label, meta, defaultValue, disabled } = this.props;

View File

@ -158,30 +158,30 @@ class Notifications extends React.PureComponent {
} else {
dispatch(addColumn('NOTIFICATIONS', {}));
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setColumnRef = c => {
this.column = c;
}
};
handleMoveUp = id => {
const elementIndex = this.props.notifications.findIndex(item => item !== null && item.get('id') === id) - 1;
this._selectChild(elementIndex, true);
}
};
handleMoveDown = id => {
const elementIndex = this.props.notifications.findIndex(item => item !== null && item.get('id') === id) + 1;
this._selectChild(elementIndex, false);
}
};
_selectChild (index, align_top) {
const container = this.column.node;
@ -213,16 +213,16 @@ class Notifications extends React.PureComponent {
handleTransitionEndNCD = () => {
this.setState({ animatingNCD: false });
}
};
onEnterCleaningMode = () => {
this.setState({ animatingNCD: true });
this.props.onEnterCleaningMode(!this.props.notifCleaningActive);
}
};
handleMarkAsRead = () => {
this.props.onMarkAsRead();
}
};
render () {
const { intl, notifications, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar, lastReadId, canMarkAsRead, needsNotificationPermission } = this.props;

View File

@ -114,7 +114,7 @@ class Footer extends ImmutablePureComponent {
_performReblog = (privacy) => {
const { dispatch, status } = this.props;
dispatch(reblog(status, privacy));
}
};
handleReblogClick = e => {
const { dispatch, status } = this.props;
@ -151,7 +151,7 @@ class Footer extends ImmutablePureComponent {
}
router.history.push(`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`);
}
};
render () {
const { status, intl, showReplyCount, withOpenButton } = this.props;

View File

@ -35,7 +35,7 @@ class PictureInPicture extends React.Component {
handleClose = () => {
const { dispatch } = this.props;
dispatch(removePictureInPicture());
}
};
render () {
const { type, src, currentTime, accountId, statusId, left } = this.props;

View File

@ -4,7 +4,7 @@ import { injectIntl } from 'react-intl';
import {
fetchPinnedAccountsSuggestions,
clearPinnedAccountsSuggestions,
changePinnedAccountsSuggestions
changePinnedAccountsSuggestions,
} from '../../../actions/accounts';
import Search from 'flavours/glitch/features/list_editor/components/search';

View File

@ -37,11 +37,11 @@ class PinnedStatuses extends ImmutablePureComponent {
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setRef = c => {
this.column = c;
}
};
render () {
const { intl, statusIds, hasMore, multiColumn } = this.props;

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import ColumnSettings from '../components/column_settings';
import { changeSetting } from 'flavours/glitch/actions/settings';
import { changeColumnParams } from 'flavours/glitch/actions/columns';
const mapStateToProps = (state, { columnId }) => {
const uuid = columnId;
const columns = state.getIn(['settings', 'columns']);

View File

@ -68,16 +68,16 @@ class PublicTimeline extends React.PureComponent {
} else {
dispatch(addColumn(onlyRemote ? 'REMOTE' : 'PUBLIC', { other: { onlyMedia, onlyRemote, allowLocalOnly } }));
}
}
};
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
};
handleHeaderClick = () => {
this.column.scrollTop();
}
};
componentDidMount () {
const { dispatch, onlyMedia, onlyRemote, allowLocalOnly } = this.props;
@ -116,13 +116,13 @@ class PublicTimeline extends React.PureComponent {
setRef = c => {
this.column = c;
}
};
handleLoadMore = maxId => {
const { dispatch, onlyMedia, onlyRemote, allowLocalOnly } = this.props;
dispatch(expandPublicTimeline({ maxId, onlyMedia, onlyRemote, allowLocalOnly }));
}
};
render () {
const { intl, columnId, hasUnread, multiColumn, onlyMedia, onlyRemote, allowLocalOnly } = this.props;

View File

@ -48,15 +48,15 @@ class Reblogs extends ImmutablePureComponent {
handleHeaderClick = () => {
this.column.scrollTop();
}
};
setRef = c => {
this.column = c;
}
};
handleRefresh = () => {
this.props.dispatch(fetchReblogs(this.props.params.statusId));
}
};
render () {
const { intl, accountIds, multiColumn } = this.props;

View File

@ -24,12 +24,12 @@ export default class Option extends React.PureComponent {
e.preventDefault();
onToggle(value, !checked);
}
}
};
handleChange = e => {
const { value, onToggle } = this.props;
onToggle(value, e.target.checked);
}
};
render () {
const { name, value, checked, label, labelComponent, description, multiple } = this.props;

View File

@ -68,75 +68,75 @@ class ActionBar extends React.PureComponent {
handleReplyClick = () => {
this.props.onReply(this.props.status);
}
};
handleReblogClick = (e) => {
this.props.onReblog(this.props.status, e);
}
};
handleFavouriteClick = (e) => {
this.props.onFavourite(this.props.status, e);
}
};
handleBookmarkClick = (e) => {
this.props.onBookmark(this.props.status, e);
}
};
handleDeleteClick = () => {
this.props.onDelete(this.props.status, this.context.router.history);
}
};
handleRedraftClick = () => {
this.props.onDelete(this.props.status, this.context.router.history, true);
}
};
handleEditClick = () => {
this.props.onEdit(this.props.status, this.context.router.history);
}
};
handleDirectClick = () => {
this.props.onDirect(this.props.status.get('account'), this.context.router.history);
}
};
handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.context.router.history);
}
};
handleMuteClick = () => {
this.props.onMute(this.props.status.get('account'));
}
};
handleConversationMuteClick = () => {
this.props.onMuteConversation(this.props.status);
}
};
handleBlockClick = () => {
this.props.onBlock(this.props.status);
}
};
handleReport = () => {
this.props.onReport(this.props.status);
}
};
handlePinClick = () => {
this.props.onPin(this.props.status);
}
};
handleShare = () => {
navigator.share({
text: this.props.status.get('search_index'),
url: this.props.status.get('url'),
});
}
};
handleEmbed = () => {
this.props.onEmbed(this.props.status);
}
};
handleCopy = () => {
const url = this.props.status.get('url');
navigator.clipboard.writeText(url);
}
};
render () {
const { status, intl } = this.props;

View File

@ -138,7 +138,7 @@ export default class Card extends React.PureComponent {
} else {
this.setState({ embedded: true });
}
}
};
setRef = c => {
this.node = c;
@ -146,17 +146,17 @@ export default class Card extends React.PureComponent {
if (this.node) {
this._setDimensions();
}
}
};
handleImageLoad = () => {
this.setState({ previewLoaded: true });
}
};
handleReveal = e => {
e.preventDefault();
e.stopPropagation();
this.setState({ revealed: true });
}
};
renderVideo () {
const { card } = this.props;

View File

@ -56,28 +56,28 @@ class DetailedStatus extends ImmutablePureComponent {
handleAccountClick = (e) => {
if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) {
e.preventDefault();
let state = {...this.context.router.history.location.state};
let state = { ...this.context.router.history.location.state };
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state);
}
e.stopPropagation();
}
};
parseClick = (e, destination) => {
if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) {
e.preventDefault();
let state = {...this.context.router.history.location.state};
let state = { ...this.context.router.history.location.state };
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
this.context.router.history.push(destination, state);
}
e.stopPropagation();
}
};
handleOpenVideo = (options) => {
this.props.onOpenVideo(this.props.status.getIn(['media_attachments', 0]), options);
}
};
_measureHeight (heightJustChanged) {
if (this.props.measureHeight && this.node) {
@ -92,7 +92,7 @@ class DetailedStatus extends ImmutablePureComponent {
setRef = c => {
this.node = c;
this._measureHeight();
}
};
componentDidUpdate (prevProps, prevState) {
this._measureHeight(prevState.height !== this.state.height);
@ -100,7 +100,7 @@ class DetailedStatus extends ImmutablePureComponent {
handleChildUpdate = () => {
this._measureHeight();
}
};
handleModalLink = e => {
e.preventDefault();
@ -114,12 +114,12 @@ class DetailedStatus extends ImmutablePureComponent {
}
window.open(href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes');
}
};
handleTranslate = () => {
const { onTranslate, status } = this.props;
onTranslate(status);
}
};
render () {
const status = (this.props.status && this.props.status.get('reblog')) ? this.props.status.get('reblog') : this.props.status;

View File

@ -263,15 +263,15 @@ class Status extends ImmutablePureComponent {
} else if (this.props.status.get('spoiler_text')) {
this.setExpansion(!this.state.isExpanded);
}
}
};
handleToggleMediaVisibility = () => {
this.setState({ showMedia: !this.state.showMedia });
}
};
handleModalFavourite = (status) => {
this.props.dispatch(favourite(status));
}
};
handleFavouriteClick = (status, e) => {
const { dispatch } = this.props;
@ -294,7 +294,7 @@ class Status extends ImmutablePureComponent {
url: status.get('url'),
}));
}
}
};
handlePin = (status) => {
if (status.get('pinned')) {
@ -302,7 +302,7 @@ class Status extends ImmutablePureComponent {
} else {
this.props.dispatch(pin(status));
}
}
};
handleReplyClick = (status) => {
const { askReplyConfirmation, dispatch, intl } = this.props;
@ -326,7 +326,7 @@ class Status extends ImmutablePureComponent {
url: status.get('url'),
}));
}
}
};
handleModalReblog = (status, privacy) => {
const { dispatch } = this.props;
@ -336,7 +336,7 @@ class Status extends ImmutablePureComponent {
} else {
dispatch(reblog(status, privacy));
}
}
};
handleReblogClick = (status, e) => {
const { settings, dispatch } = this.props;
@ -357,7 +357,7 @@ class Status extends ImmutablePureComponent {
url: status.get('url'),
}));
}
}
};
handleBookmarkClick = (status) => {
if (status.get('bookmarked')) {
@ -365,7 +365,7 @@ class Status extends ImmutablePureComponent {
} else {
this.props.dispatch(bookmark(status));
}
}
};
handleDeleteClick = (status, history, withRedraft = false) => {
const { dispatch, intl } = this.props;
@ -379,27 +379,27 @@ class Status extends ImmutablePureComponent {
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
}));
}
}
};
handleEditClick = (status, history) => {
this.props.dispatch(editStatus(status.get('id'), history));
}
};
handleDirectClick = (account, router) => {
this.props.dispatch(directCompose(account, router));
}
};
handleMentionClick = (account, router) => {
this.props.dispatch(mentionCompose(account, router));
}
};
handleOpenMedia = (media, index) => {
this.props.dispatch(openModal('MEDIA', { statusId: this.props.status.get('id'), media, index }));
}
};
handleOpenVideo = (media, options) => {
this.props.dispatch(openModal('VIDEO', { statusId: this.props.status.get('id'), media, options }));
}
};
handleHotkeyOpenMedia = e => {
const { status } = this.props;
@ -413,11 +413,11 @@ class Status extends ImmutablePureComponent {
this.handleOpenMedia(status.get('media_attachments'), 0);
}
}
}
};
handleMuteClick = (account) => {
this.props.dispatch(initMuteModal(account));
}
};
handleConversationMuteClick = (status) => {
if (status.get('muted')) {
@ -425,7 +425,7 @@ class Status extends ImmutablePureComponent {
} else {
this.props.dispatch(muteStatus(status.get('id')));
}
}
};
handleToggleAll = () => {
const { status, ancestorsIds, descendantsIds, settings } = this.props;
@ -442,7 +442,7 @@ class Status extends ImmutablePureComponent {
}
this.setState({ isExpanded: !isExpanded, threadExpanded: !isExpanded });
}
};
handleTranslate = status => {
const { dispatch } = this.props;
@ -452,61 +452,61 @@ class Status extends ImmutablePureComponent {
} else {
dispatch(translateStatus(status.get('id')));
}
}
};
handleBlockClick = (status) => {
const { dispatch } = this.props;
const account = status.get('account');
dispatch(initBlockModal(account));
}
};
handleReport = (status) => {
this.props.dispatch(initReport(status.get('account'), status));
}
};
handleEmbed = (status) => {
this.props.dispatch(openModal('EMBED', { url: status.get('url') }));
}
};
handleHotkeyToggleSensitive = () => {
this.handleToggleMediaVisibility();
}
};
handleHotkeyMoveUp = () => {
this.handleMoveUp(this.props.status.get('id'));
}
};
handleHotkeyMoveDown = () => {
this.handleMoveDown(this.props.status.get('id'));
}
};
handleHotkeyReply = e => {
e.preventDefault();
this.handleReplyClick(this.props.status);
}
};
handleHotkeyFavourite = () => {
this.handleFavouriteClick(this.props.status);
}
};
handleHotkeyBoost = () => {
this.handleReblogClick(this.props.status);
}
};
handleHotkeyBookmark = () => {
this.handleBookmarkClick(this.props.status);
}
};
handleHotkeyMention = e => {
e.preventDefault();
this.handleMentionClick(this.props.status);
}
};
handleHotkeyOpenProfile = () => {
let state = {...this.context.router.history.location.state};
let state = { ...this.context.router.history.location.state };
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state);
}
};
handleMoveUp = id => {
const { status, ancestorsIds, descendantsIds } = this.props;
@ -523,7 +523,7 @@ class Status extends ImmutablePureComponent {
this._selectChild(index - 1, true);
}
}
}
};
handleMoveDown = id => {
const { status, ancestorsIds, descendantsIds } = this.props;
@ -540,7 +540,7 @@ class Status extends ImmutablePureComponent {
this._selectChild(index + 1, false);
}
}
}
};
_selectChild (index, align_top) {
const container = this.node;
@ -558,7 +558,7 @@ class Status extends ImmutablePureComponent {
handleHeaderClick = () => {
this.column.scrollTop();
}
};
renderChildren (list) {
return list.map(id => (
@ -575,15 +575,15 @@ class Status extends ImmutablePureComponent {
setExpansion = value => {
this.setState({ isExpanded: value });
}
};
setRef = c => {
this.node = c;
}
};
setColumnRef = c => {
this.column = c;
}
};
componentDidUpdate (prevProps) {
if (this.props.params.statusId && (this.props.params.statusId !== prevProps.params.statusId || prevProps.ancestorsIds.size < this.props.ancestorsIds.size)) {
@ -605,7 +605,7 @@ class Status extends ImmutablePureComponent {
onFullScreenChange = () => {
this.setState({ fullscreen: isFullscreen() });
}
};
render () {
let ancestors, descendants;

View File

@ -72,7 +72,7 @@ class SubscribedLanguagesModal extends ImmutablePureComponent {
handleSubmit = () => {
this.props.onSubmit(this.state.selectedLanguages.toArray());
this.props.onClose();
}
};
renderItem (value) {
const language = this.props.languages.find(language => language[0] === value);

View File

@ -52,7 +52,7 @@ export default class ActionsModal extends ImmutablePureComponent {
</a>
</li>
);
}
};
render () {
const status = this.props.status && (

View File

@ -55,20 +55,20 @@ class BlockModal extends React.PureComponent {
handleClick = () => {
this.props.onClose();
this.props.onConfirm(this.props.account);
}
};
handleSecondary = () => {
this.props.onClose();
this.props.onBlockAndReport(this.props.account);
}
};
handleCancel = () => {
this.props.onClose();
}
};
setRef = (c) => {
this.button = c;
}
};
render () {
const { account } = this.props;

View File

@ -58,17 +58,17 @@ class BoostModal extends ImmutablePureComponent {
handleReblog = () => {
this.props.onReblog(this.props.status, this.props.privacy);
this.props.onClose();
}
};
handleAccountClick = (e) => {
if (e.button === 0) {
e.preventDefault();
this.props.onClose();
let state = {...this.context.router.history.location.state};
let state = { ...this.context.router.history.location.state };
state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state);
}
}
};
_findContainer = () => {
return document.getElementsByClassName('modal-root__container')[0];
@ -76,7 +76,7 @@ class BoostModal extends ImmutablePureComponent {
setRef = (c) => {
this.button = c;
}
};
render () {
const { status, missingMediaDescription, privacy, intl } = this.props;
@ -116,9 +116,9 @@ class BoostModal extends ImmutablePureComponent {
<div className='boost-modal__action-bar'>
<div>
{ missingMediaDescription ?
<FormattedMessage id='boost_modal.missing_description' defaultMessage='This toot contains some media without description' />
<FormattedMessage id='boost_modal.missing_description' defaultMessage='This toot contains some media without description' />
:
<FormattedMessage id='boost_modal.combo' defaultMessage='You can press {combo} to skip this next time' values={{ combo: <span>Shift + <Icon id='retweet' /></span> }} />
<FormattedMessage id='boost_modal.combo' defaultMessage='You can press {combo} to skip this next time' values={{ combo: <span>Shift + <Icon id='retweet' /></span> }} />
}
</div>

View File

@ -15,7 +15,7 @@ class Bundle extends React.Component {
onFetch: PropTypes.func,
onFetchSuccess: PropTypes.func,
onFetchFail: PropTypes.func,
}
};
static defaultProps = {
loading: emptyComponent,
@ -24,14 +24,14 @@ class Bundle extends React.Component {
onFetch: noop,
onFetchSuccess: noop,
onFetchFail: noop,
}
};
static cache = {}
static cache = {};
state = {
mod: undefined,
forceRender: false,
}
};
componentWillMount() {
this.load(this.props);
@ -84,7 +84,7 @@ class Bundle extends React.Component {
this.setState({ mod: null });
onFetchFail(error);
});
}
};
render() {
const { loading: Loading, error: Error, children, renderDelay } = this.props;

View File

@ -31,7 +31,7 @@ class GIF extends React.PureComponent {
if (!animate) {
this.setState({ hovering: true });
}
}
};
handleMouseLeave = () => {
const { animate } = this.props;
@ -39,7 +39,7 @@ class GIF extends React.PureComponent {
if (!animate) {
this.setState({ hovering: false });
}
}
};
render () {
const { src, staticSrc, className, animate } = this.props;
@ -75,7 +75,7 @@ class CopyButton extends React.PureComponent {
navigator.clipboard.writeText(value);
this.setState({ copied: true });
this.timeout = setTimeout(() => this.setState({ copied: false }), 700);
}
};
componentWillUnmount () {
if (this.timeout) clearTimeout(this.timeout);
@ -113,7 +113,7 @@ class BundleColumnError extends React.PureComponent {
if (onRetry) {
onRetry();
}
}
};
render () {
const { errorType, multiColumn, stacktrace } = this.props;

View File

@ -16,11 +16,11 @@ class BundleModalError extends React.Component {
onRetry: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
};
handleRetry = () => {
this.props.onRetry();
}
};
render () {
const { onClose, intl: { formatMessage } } = this.props;

View File

@ -25,7 +25,7 @@ export default class Column extends React.PureComponent {
}
this._interruptScrollAnimation = scrollTop(scrollable);
}
};
scrollTop () {
const scrollable = this.props.bindToDocument ? document.scrollingElement : this.node.querySelector('.scrollable');
@ -42,11 +42,11 @@ export default class Column extends React.PureComponent {
if (typeof this._interruptScrollAnimation !== 'undefined') {
this._interruptScrollAnimation();
}
}, 200)
}, 200);
setRef = (c) => {
this.node = c;
}
};
render () {
const { heading, icon, children, active, hideHeadingOnMobile, name } = this.props;

View File

@ -15,7 +15,7 @@ export default class ColumnHeader extends React.PureComponent {
handleClick = () => {
this.props.onClick();
}
};
render () {
const { icon, type, active, columnHeaderId } = this.props;

View File

@ -30,7 +30,7 @@ const ColumnLink = ({ icon, text, to, onClick, href, method, badge, transparent,
e.preventDefault();
e.stopPropagation();
return onClick(e);
}
};
return (
<a href='#' onClick={onClick && handleOnClick} className={className} title={text} {...other} tabIndex='0'>
{iconElement}

View File

@ -59,7 +59,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
state = {
renderComposePanel: !(this.mediaQuery && this.mediaQuery.matches),
}
};
componentDidMount() {
if (!this.props.singleColumn) {
@ -113,7 +113,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
handleLayoutChange = (e) => {
this.setState({ renderComposePanel: !e.matches });
}
};
handleWheel = () => {
if (typeof this._interruptScrollAnimation !== 'function') {
@ -121,19 +121,19 @@ export default class ColumnsArea extends ImmutablePureComponent {
}
this._interruptScrollAnimation();
}
};
setRef = (node) => {
this.node = node;
}
};
renderLoading = columnId => () => {
return columnId === 'COMPOSE' ? <DrawerLoading /> : <ColumnLoading multiColumn />;
}
};
renderError = (props) => {
return <BundleColumnError multiColumn errorType='network' {...props} />;
}
};
render () {
const { columns, children, singleColumn, navbarUnder, openSettings } = this.props;

Some files were not shown because too many files have changed in this diff Show More