import PropTypes from 'prop-types'; import { PureComponent } from 'react'; import { FormattedMessage } from 'react-intl'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { identityContextPropShape, withIdentity } from 'mastodon/identity_context'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_REPORTS } from 'mastodon/permissions'; import { CheckboxWithLabel } from './checkbox_with_label'; import ClearColumnButton from './clear_column_button'; import GrantPermissionButton from './grant_permission_button'; import SettingToggle from './setting_toggle'; class ColumnSettings extends PureComponent { static propTypes = { identity: identityContextPropShape, settings: ImmutablePropTypes.map.isRequired, pushSettings: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired, onRequestNotificationPermission: PropTypes.func, alertsEnabled: PropTypes.bool, browserSupport: PropTypes.bool, browserPermission: PropTypes.string, notificationPolicy: ImmutablePropTypes.map, onChangePolicy: PropTypes.func.isRequired, }; onPushChange = (path, checked) => { this.props.onChange(['push', ...path], checked); }; handleFilterNotFollowing = checked => { this.props.onChangePolicy('filter_not_following', checked); }; handleFilterNotFollowers = checked => { this.props.onChangePolicy('filter_not_followers', checked); }; handleFilterNewAccounts = checked => { this.props.onChangePolicy('filter_new_accounts', checked); }; handleFilterPrivateMentions = checked => { this.props.onChangePolicy('filter_private_mentions', checked); }; render () { const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission, notificationPolicy } = this.props; const filterAdvancedStr = ; const unreadMarkersShowStr = ; const alertStr = ; const showStr = ; const soundStr = ; const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed'); const pushStr = showPushSettings && ; return (
{alertsEnabled && browserSupport && browserPermission === 'denied' && ( )}
{alertsEnabled && browserSupport && browserPermission === 'default' && (
)}

{showPushSettings && }

{showPushSettings && }

{showPushSettings && }

{showPushSettings && }

{showPushSettings && }

{showPushSettings && }

{showPushSettings && }

{showPushSettings && }
{((this.props.identity.permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS) && (

{showPushSettings && }
)} {((this.props.identity.permissions & PERMISSION_MANAGE_REPORTS) === PERMISSION_MANAGE_REPORTS) && (

{showPushSettings && }
)}
); } } export default withIdentity(ColumnSettings);