diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-09-21 22:46:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 22:46:57 +0200 |
commit | d2f7e30a283a1dca1f7974884ac0c237b93903ad (patch) | |
tree | ef69d5cc54d0f8a18bf9b0ea8216441d35843dae /app/javascript | |
parent | 26c51cfa07952b39802ce6de4c952c6adf56b748 (diff) |
Add privacy icons to report modal (#19190)
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/features/report/components/status_check_box.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/report/components/status_check_box.js b/app/javascript/mastodon/features/report/components/status_check_box.js index 373c60e21..5366da90b 100644 --- a/app/javascript/mastodon/features/report/components/status_check_box.js +++ b/app/javascript/mastodon/features/report/components/status_check_box.js @@ -7,14 +7,25 @@ import DisplayName from 'mastodon/components/display_name'; import RelativeTimestamp from 'mastodon/components/relative_timestamp'; import Option from './option'; import MediaAttachments from 'mastodon/components/media_attachments'; +import { injectIntl, defineMessages } from 'react-intl'; +import Icon from 'mastodon/components/icon'; -export default class StatusCheckBox extends React.PureComponent { +const messages = defineMessages({ + public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, + unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, + private_short: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, + direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, +}); + +export default @injectIntl +class StatusCheckBox extends React.PureComponent { static propTypes = { id: PropTypes.string.isRequired, status: ImmutablePropTypes.map.isRequired, checked: PropTypes.bool, onToggle: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, }; handleStatusesToggle = (value, checked) => { @@ -23,12 +34,21 @@ export default class StatusCheckBox extends React.PureComponent { }; render () { - const { status, checked } = this.props; + const { status, checked, intl } = this.props; if (status.get('reblog')) { return null; } + const visibilityIconInfo = { + 'public': { icon: 'globe', text: intl.formatMessage(messages.public_short) }, + 'unlisted': { icon: 'unlock', text: intl.formatMessage(messages.unlisted_short) }, + 'private': { icon: 'lock', text: intl.formatMessage(messages.private_short) }, + 'direct': { icon: 'at', text: intl.formatMessage(messages.direct_short) }, + }; + + const visibilityIcon = visibilityIconInfo[status.get('visibility')]; + const labelComponent = ( <div className='status-check-box__status poll__option__text'> <div className='detailed-status__display-name'> @@ -37,7 +57,7 @@ export default class StatusCheckBox extends React.PureComponent { </div> <div> - <DisplayName account={status.get('account')} /> · <RelativeTimestamp timestamp={status.get('created_at')} /> + <DisplayName account={status.get('account')} /> · <span className='status__visibility-icon'><Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></span> <RelativeTimestamp timestamp={status.get('created_at')} /> </div> </div> |