Skip to content

Commit

Permalink
Revert "Add regex filter back to firehose (glitch-soc#2266)"
Browse files Browse the repository at this point in the history
This reverts commit ed15893.
  • Loading branch information
hibiyasleep committed Jul 15, 2023
1 parent 26f8a2b commit 609e950
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
22 changes: 5 additions & 17 deletions app/javascript/flavours/glitch/features/firehose/index.jsx
Expand Up @@ -10,8 +10,7 @@ import { addColumn } from 'flavours/glitch/actions/columns';
import { changeSetting } from 'flavours/glitch/actions/settings';
import { connectPublicStream, connectCommunityStream } from 'flavours/glitch/actions/streaming';
import { expandPublicTimeline, expandCommunityTimeline } from 'flavours/glitch/actions/timelines';
import { DismissableBanner } from 'flavours/glitch/components/dismissable_banner';
import SettingText from 'flavours/glitch/components/setting_text';
import DismissableBanner from 'flavours/glitch/components/dismissable_banner';
import initialState, { domain } from 'flavours/glitch/initial_state';
import { useAppDispatch, useAppSelector } from 'flavours/glitch/store';

Expand All @@ -22,7 +21,6 @@ import StatusListContainer from '../ui/containers/status_list_container';

const messages = defineMessages({
title: { id: 'column.firehose', defaultMessage: 'Live feeds' },
filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' },
});

// TODO: use a proper React context later on
Expand All @@ -35,7 +33,6 @@ const useIdentity = () => ({
});

const ColumnSettings = () => {
const intl = useIntl();
const dispatch = useAppDispatch();
const settings = useAppSelector((state) => state.getIn(['settings', 'firehose']));
const onChange = useCallback(
Expand All @@ -58,13 +55,6 @@ const ColumnSettings = () => {
onChange={onChange}
label={<FormattedMessage id='firehose.column_settings.allow_local_only' defaultMessage='Show local-only posts in "All"' />}
/>
<span className='column-settings__section'><FormattedMessage id='home.column_settings.advanced' defaultMessage='Advanced' /></span>
<SettingText
settings={settings}
settingPath={['regex', 'body']}
onChange={onChange}
label={intl.formatMessage(messages.filter_regex)}
/>
</div>
</div>
);
Expand All @@ -80,23 +70,22 @@ const Firehose = ({ feedType, multiColumn }) => {
const hasUnread = useAppSelector((state) => state.getIn(['timelines', `${feedType}${onlyMedia ? ':media' : ''}`, 'unread'], 0) > 0);

const allowLocalOnly = useAppSelector((state) => state.getIn(['settings', 'firehose', 'allowLocalOnly']));
const regex = useAppSelector((state) => state.getIn(['settings', 'firehose', 'regex', 'body']));

const handlePin = useCallback(
() => {
switch(feedType) {
case 'community':
dispatch(addColumn('COMMUNITY', { other: { onlyMedia }, regex: { body: regex } }));
dispatch(addColumn('COMMUNITY', { other: { onlyMedia } }));
break;
case 'public':
dispatch(addColumn('PUBLIC', { other: { onlyMedia, allowLocalOnly }, regex: { body: regex } }));
dispatch(addColumn('PUBLIC', { other: { onlyMedia, allowLocalOnly } }));
break;
case 'public:remote':
dispatch(addColumn('REMOTE', { other: { onlyMedia, onlyRemote: true }, regex: { body: regex } }));
dispatch(addColumn('REMOTE', { other: { onlyMedia, onlyRemote: true } }));
break;
}
},
[dispatch, onlyMedia, feedType, allowLocalOnly, regex],
[dispatch, onlyMedia, feedType, allowLocalOnly],
);

const handleLoadMore = useCallback(
Expand Down Expand Up @@ -210,7 +199,6 @@ const Firehose = ({ feedType, multiColumn }) => {
scrollKey='firehose'
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
regex={regex}
/>
</div>

Expand Down
4 changes: 0 additions & 4 deletions app/javascript/flavours/glitch/reducers/settings.js
Expand Up @@ -87,10 +87,6 @@ const initialState = ImmutableMap({
firehose: ImmutableMap({
onlyMedia: false,
allowLocalOnly: true,

regex: ImmutableMap({
body: '',
}),
}),

community: ImmutableMap({
Expand Down

0 comments on commit 609e950

Please sign in to comment.