Merge pull request #241 from glitch-soc/no-dm-option

Add option to remove DMs from home (#126)
This commit is contained in:
David Yip 2017-12-06 22:20:55 -06:00 committed by GitHub
commit 935c1944e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 0 deletions

View file

@ -34,6 +34,10 @@ export default class ColumnSettings extends React.PureComponent {
<SettingToggle prefix='home_timeline' settings={settings} settingKey={['shows', 'reply']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />} /> <SettingToggle prefix='home_timeline' settings={settings} settingKey={['shows', 'reply']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />} />
</div> </div>
<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingKey={['shows', 'direct']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_direct' defaultMessage='Show DMs' />} />
</div>
<span className='column-settings__section'><FormattedMessage id='home.column_settings.advanced' defaultMessage='Advanced' /></span> <span className='column-settings__section'><FormattedMessage id='home.column_settings.advanced' defaultMessage='Advanced' /></span>
<div className='column-settings__row'> <div className='column-settings__row'>

View file

@ -32,6 +32,10 @@ const makeGetStatusIds = () => createSelector([
showStatus = showStatus && (statusForId.get('in_reply_to_id') === null || statusForId.get('in_reply_to_account_id') === me); showStatus = showStatus && (statusForId.get('in_reply_to_id') === null || statusForId.get('in_reply_to_account_id') === me);
} }
if (columnSettings.getIn(['shows', 'direct']) === false) {
showStatus = showStatus && statusForId.get('visibility') !== 'direct';
}
if (showStatus && regex && statusForId.get('account') !== me) { if (showStatus && regex && statusForId.get('account') !== me) {
const searchIndex = statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index'); const searchIndex = statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index');
showStatus = !regex.test(searchIndex); showStatus = !regex.test(searchIndex);

View file

@ -17,6 +17,7 @@ const initialState = ImmutableMap({
shows: ImmutableMap({ shows: ImmutableMap({
reblog: true, reblog: true,
reply: true, reply: true,
direct: true,
}), }),
regex: ImmutableMap({ regex: ImmutableMap({

View file

@ -32,6 +32,8 @@
"status.collapse": "Collapse", "status.collapse": "Collapse",
"status.uncollapse": "Uncollapse", "status.uncollapse": "Uncollapse",
"home.column_settings.show_direct": "Show DMs",
"notification.markForDeletion": "Mark for deletion", "notification.markForDeletion": "Mark for deletion",
"notifications.clear": "Clear all my notifications", "notifications.clear": "Clear all my notifications",
"notifications.marked_clear_confirmation": "Are you sure you want to permanently clear all selected notifications?", "notifications.marked_clear_confirmation": "Are you sure you want to permanently clear all selected notifications?",