Add options to configure filtering behavior
This commit is contained in:
parent
bde7a415b9
commit
16b79a6237
|
@ -506,9 +506,11 @@ class Status extends ImmutablePureComponent {
|
||||||
<HotKeys handlers={minHandlers}>
|
<HotKeys handlers={minHandlers}>
|
||||||
<div className='status__wrapper status__wrapper--filtered focusable' tabIndex='0' ref={this.handleRef}>
|
<div className='status__wrapper status__wrapper--filtered focusable' tabIndex='0' ref={this.handleRef}>
|
||||||
<FormattedMessage id='status.filtered' defaultMessage='Filtered' />
|
<FormattedMessage id='status.filtered' defaultMessage='Filtered' />
|
||||||
<button className='status__wrapper--filtered__button' onClick={this.handleUnfilterClick}>
|
{settings.get('filtering_behavior') === 'hide' && (
|
||||||
<FormattedMessage id='status.show_filter_reason' defaultMessage='Show why' />
|
<button className='status__wrapper--filtered__button' onClick={this.handleUnfilterClick}>
|
||||||
</button>
|
<FormattedMessage id='status.show_filter_reason' defaultMessage='Show why' />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</HotKeys>
|
</HotKeys>
|
||||||
);
|
);
|
||||||
|
|
|
@ -13,6 +13,7 @@ const messages = defineMessages({
|
||||||
general: { id: 'settings.general', defaultMessage: 'General' },
|
general: { id: 'settings.general', defaultMessage: 'General' },
|
||||||
compose: { id: 'settings.compose_box_opts', defaultMessage: 'Compose box' },
|
compose: { id: 'settings.compose_box_opts', defaultMessage: 'Compose box' },
|
||||||
content_warnings: { id: 'settings.content_warnings', defaultMessage: 'Content Warnings' },
|
content_warnings: { id: 'settings.content_warnings', defaultMessage: 'Content Warnings' },
|
||||||
|
filters: { id: 'settings.filters', defaultMessage: 'Filters' },
|
||||||
collapsed: { id: 'settings.collapsed_statuses', defaultMessage: 'Collapsed toots' },
|
collapsed: { id: 'settings.collapsed_statuses', defaultMessage: 'Collapsed toots' },
|
||||||
media: { id: 'settings.media', defaultMessage: 'Media' },
|
media: { id: 'settings.media', defaultMessage: 'Media' },
|
||||||
preferences: { id: 'settings.preferences', defaultMessage: 'Preferences' },
|
preferences: { id: 'settings.preferences', defaultMessage: 'Preferences' },
|
||||||
|
@ -60,27 +61,34 @@ export default class LocalSettingsNavigation extends React.PureComponent {
|
||||||
active={index === 3}
|
active={index === 3}
|
||||||
index={3}
|
index={3}
|
||||||
onNavigate={onNavigate}
|
onNavigate={onNavigate}
|
||||||
icon='angle-double-up'
|
icon='filter'
|
||||||
title={intl.formatMessage(messages.collapsed)}
|
title={intl.formatMessage(messages.filters)}
|
||||||
/>
|
/>
|
||||||
<LocalSettingsNavigationItem
|
<LocalSettingsNavigationItem
|
||||||
active={index === 4}
|
active={index === 4}
|
||||||
index={4}
|
index={4}
|
||||||
onNavigate={onNavigate}
|
onNavigate={onNavigate}
|
||||||
|
icon='angle-double-up'
|
||||||
|
title={intl.formatMessage(messages.collapsed)}
|
||||||
|
/>
|
||||||
|
<LocalSettingsNavigationItem
|
||||||
|
active={index === 5}
|
||||||
|
index={5}
|
||||||
|
onNavigate={onNavigate}
|
||||||
icon='image'
|
icon='image'
|
||||||
title={intl.formatMessage(messages.media)}
|
title={intl.formatMessage(messages.media)}
|
||||||
/>
|
/>
|
||||||
<LocalSettingsNavigationItem
|
<LocalSettingsNavigationItem
|
||||||
active={index === 5}
|
active={index === 6}
|
||||||
href={ preferencesLink }
|
href={ preferencesLink }
|
||||||
index={5}
|
index={6}
|
||||||
icon='cog'
|
icon='cog'
|
||||||
title={intl.formatMessage(messages.preferences)}
|
title={intl.formatMessage(messages.preferences)}
|
||||||
/>
|
/>
|
||||||
<LocalSettingsNavigationItem
|
<LocalSettingsNavigationItem
|
||||||
active={index === 6}
|
active={index === 7}
|
||||||
className='close'
|
className='close'
|
||||||
index={6}
|
index={7}
|
||||||
onNavigate={onClose}
|
onNavigate={onClose}
|
||||||
icon='times'
|
icon='times'
|
||||||
title={intl.formatMessage(messages.close)}
|
title={intl.formatMessage(messages.close)}
|
||||||
|
|
|
@ -21,6 +21,10 @@ const messages = defineMessages({
|
||||||
side_arm_copy: { id: 'settings.side_arm_reply_mode.copy', defaultMessage: 'Copy privacy setting of the toot being replied to' },
|
side_arm_copy: { id: 'settings.side_arm_reply_mode.copy', defaultMessage: 'Copy privacy setting of the toot being replied to' },
|
||||||
side_arm_restrict: { id: 'settings.side_arm_reply_mode.restrict', defaultMessage: 'Restrict privacy setting to that of the toot being replied to' },
|
side_arm_restrict: { id: 'settings.side_arm_reply_mode.restrict', defaultMessage: 'Restrict privacy setting to that of the toot being replied to' },
|
||||||
regexp: { id: 'settings.content_warnings.regexp', defaultMessage: 'Regular expression' },
|
regexp: { id: 'settings.content_warnings.regexp', defaultMessage: 'Regular expression' },
|
||||||
|
filters_drop: { id: 'settings.filtering_behavior.drop', defaultMessage: 'Hide filtered toots completely' },
|
||||||
|
filters_upstream: { id: 'settings.filtering_behavior.upstream', defaultMessage: 'Show "filtered" like vanilla Mastodon' },
|
||||||
|
filters_hide: { id: 'settings.filtering_behavior.hide', defaultMessage: 'Show "filtered" and add a button to display why' },
|
||||||
|
filters_cw: { id: 'settings.filtering_behavior.cw', defaultMessage: 'Still display the post, and add filtered words to content warning' },
|
||||||
});
|
});
|
||||||
|
|
||||||
@injectIntl
|
@injectIntl
|
||||||
|
@ -223,6 +227,25 @@ export default class LocalSettingsPage extends React.PureComponent {
|
||||||
</LocalSettingsPageItem>
|
</LocalSettingsPageItem>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
({ intl, onChange, settings }) => (
|
||||||
|
<div className='glitch local-settings__page filters'>
|
||||||
|
<h1><FormattedMessage id='settings.filters' defaultMessage='Filters' /></h1>
|
||||||
|
<LocalSettingsPageItem
|
||||||
|
settings={settings}
|
||||||
|
item={['filtering_behavior']}
|
||||||
|
id='mastodon-settings--filters-behavior'
|
||||||
|
onChange={onChange}
|
||||||
|
options={[
|
||||||
|
{ value: 'drop', message: intl.formatMessage(messages.filters_drop) },
|
||||||
|
{ value: 'upstream', message: intl.formatMessage(messages.filters_upstream) },
|
||||||
|
{ value: 'hide', message: intl.formatMessage(messages.filters_hide) },
|
||||||
|
{ value: 'content_warning', message: intl.formatMessage(messages.filters_cw) }
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<FormattedMessage id='settings.filtering_behavior' defaultMessage='Filtering behavior' />
|
||||||
|
</LocalSettingsPageItem>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
({ onChange, settings }) => (
|
({ onChange, settings }) => (
|
||||||
<div className='glitch local-settings__page collapsed'>
|
<div className='glitch local-settings__page collapsed'>
|
||||||
<h1><FormattedMessage id='settings.collapsed_statuses' defaultMessage='Collapsed toots' /></h1>
|
<h1><FormattedMessage id='settings.collapsed_statuses' defaultMessage='Collapsed toots' /></h1>
|
||||||
|
|
|
@ -21,6 +21,7 @@ const initialState = ImmutableMap({
|
||||||
inline_preview_cards: true,
|
inline_preview_cards: true,
|
||||||
hicolor_privacy_icons: false,
|
hicolor_privacy_icons: false,
|
||||||
show_content_type_choice: false,
|
show_content_type_choice: false,
|
||||||
|
filtering_behavior: 'hide',
|
||||||
content_warnings : ImmutableMap({
|
content_warnings : ImmutableMap({
|
||||||
auto_unfold : false,
|
auto_unfold : false,
|
||||||
filter : null,
|
filter : null,
|
||||||
|
|
Loading…
Reference in a new issue