mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-24 00:54:02 -05:00
Fix more JS linting issues (#2212)
* Fix uses of intl.formatMessages without default messages * Ignore lint issue for ColumnLink button
This commit is contained in:
parent
16c5354b8c
commit
5d18840ab9
@ -24,6 +24,10 @@ const messages = defineMessages({
|
|||||||
id: 'compose_form.publish_loud',
|
id: 'compose_form.publish_loud',
|
||||||
},
|
},
|
||||||
saveChanges: { id: 'compose_form.save_changes', defaultMessage: 'Save changes' },
|
saveChanges: { id: 'compose_form.save_changes', defaultMessage: 'Save changes' },
|
||||||
|
public: { id: 'privacy.public.short', defaultMessage: 'Public' },
|
||||||
|
unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' },
|
||||||
|
private: { id: 'privacy.private.short', defaultMessage: 'Followers-only' },
|
||||||
|
direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' },
|
||||||
});
|
});
|
||||||
|
|
||||||
class Publisher extends ImmutablePureComponent {
|
class Publisher extends ImmutablePureComponent {
|
||||||
@ -68,6 +72,13 @@ class Publisher extends ImmutablePureComponent {
|
|||||||
publishText = privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
|
publishText = privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const privacyNames = {
|
||||||
|
public: messages.public,
|
||||||
|
unlisted: messages.unlisted,
|
||||||
|
private: messages.private,
|
||||||
|
direct: messages.direct,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={computedClass}>
|
<div className={computedClass}>
|
||||||
{sideArm && !isEditing && sideArm !== 'none' ? (
|
{sideArm && !isEditing && sideArm !== 'none' ? (
|
||||||
@ -78,7 +89,7 @@ class Publisher extends ImmutablePureComponent {
|
|||||||
onClick={onSecondarySubmit}
|
onClick={onSecondarySubmit}
|
||||||
style={{ padding: null }}
|
style={{ padding: null }}
|
||||||
text={<Icon id={privacyIcons[sideArm]} />}
|
text={<Icon id={privacyIcons[sideArm]} />}
|
||||||
title={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage({ id: `privacy.${sideArm}.short` })}`}
|
title={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage(privacyNames[sideArm])}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
@ -86,7 +97,7 @@ class Publisher extends ImmutablePureComponent {
|
|||||||
<Button
|
<Button
|
||||||
className='primary'
|
className='primary'
|
||||||
text={publishText}
|
text={publishText}
|
||||||
title={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage({ id: `privacy.${privacy}.short` })}`}
|
title={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage(privacyNames[privacy])}`}
|
||||||
onClick={this.handleSubmit}
|
onClick={this.handleSubmit}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
|
@ -29,6 +29,10 @@ const messages = defineMessages({
|
|||||||
rewrite_mentions_username: { id: 'settings.rewrite_mentions_username', defaultMessage: 'Rewrite with username' },
|
rewrite_mentions_username: { id: 'settings.rewrite_mentions_username', defaultMessage: 'Rewrite with username' },
|
||||||
pop_in_left: { id: 'settings.pop_in_left', defaultMessage: 'Left' },
|
pop_in_left: { id: 'settings.pop_in_left', defaultMessage: 'Left' },
|
||||||
pop_in_right: { id: 'settings.pop_in_right', defaultMessage: 'Right' },
|
pop_in_right: { id: 'settings.pop_in_right', defaultMessage: 'Right' },
|
||||||
|
public: { id: 'privacy.public.short', defaultMessage: 'Public' },
|
||||||
|
unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' },
|
||||||
|
private: { id: 'privacy.private.short', defaultMessage: 'Followers-only' },
|
||||||
|
direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' },
|
||||||
});
|
});
|
||||||
|
|
||||||
class LocalSettingsPage extends React.PureComponent {
|
class LocalSettingsPage extends React.PureComponent {
|
||||||
@ -241,10 +245,10 @@ class LocalSettingsPage extends React.PureComponent {
|
|||||||
id='mastodon-settings--side_arm'
|
id='mastodon-settings--side_arm'
|
||||||
options={[
|
options={[
|
||||||
{ value: 'none', message: intl.formatMessage(messages.side_arm_none) },
|
{ value: 'none', message: intl.formatMessage(messages.side_arm_none) },
|
||||||
{ value: 'direct', message: intl.formatMessage({ id: 'privacy.direct.short' }) },
|
{ value: 'direct', message: intl.formatMessage(messages.direct) },
|
||||||
{ value: 'private', message: intl.formatMessage({ id: 'privacy.private.short' }) },
|
{ value: 'private', message: intl.formatMessage(messages.private) },
|
||||||
{ value: 'unlisted', message: intl.formatMessage({ id: 'privacy.unlisted.short' }) },
|
{ value: 'unlisted', message: intl.formatMessage(messages.unlisted) },
|
||||||
{ value: 'public', message: intl.formatMessage({ id: 'privacy.public.short' }) },
|
{ value: 'public', message: intl.formatMessage(messages.public) },
|
||||||
]}
|
]}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
>
|
>
|
||||||
|
@ -32,6 +32,7 @@ const ColumnLink = ({ icon, text, to, onClick, href, method, badge, transparent,
|
|||||||
return onClick(e);
|
return onClick(e);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
// eslint-disable-next-line jsx-a11y/anchor-is-valid -- intentional to have the same look and feel as other menu items
|
||||||
<a href='#' onClick={onClick && handleOnClick} className={className} title={text} {...other} tabIndex={0}>
|
<a href='#' onClick={onClick && handleOnClick} className={className} title={text} {...other} tabIndex={0}>
|
||||||
{iconElement}
|
{iconElement}
|
||||||
<span>{text}</span>
|
<span>{text}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user