Skip to content

Commit

Permalink
Show local-only posts in “All” by default, and add back option to tog…
Browse files Browse the repository at this point in the history
…gle it
  • Loading branch information
ClearlyClaire committed Jul 2, 2023
1 parent 587ddc2 commit 9f3c3f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/javascript/flavours/glitch/features/firehose/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const ColumnSettings = () => {
onChange={onChange}
label={<FormattedMessage id='community.column_settings.media_only' defaultMessage='Media only' />}
/>
<SettingToggle
settings={settings}
settingPath={['allowLocalOnly']}
onChange={onChange}
label={<FormattedMessage id='firehose.column_settings.allow_local_only' defaultMessage='Show local-only posts in "All"' />}
/>
</div>
</div>
);
Expand All @@ -63,21 +69,23 @@ const Firehose = ({ feedType, multiColumn }) => {
const onlyMedia = useAppSelector((state) => state.getIn(['settings', 'firehose', 'onlyMedia'], false));
const hasUnread = useAppSelector((state) => state.getIn(['timelines', `${feedType}${onlyMedia ? ':media' : ''}`, 'unread'], 0) > 0);

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

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

const handleLoadMore = useCallback(
Expand All @@ -87,7 +95,7 @@ const Firehose = ({ feedType, multiColumn }) => {
dispatch(expandCommunityTimeline({ onlyMedia }));
break;
case 'public':
dispatch(expandPublicTimeline({ maxId, onlyMedia }));
dispatch(expandPublicTimeline({ maxId, onlyMedia, allowLocalOnly }));
break;
case 'public:remote':
dispatch(expandPublicTimeline({ maxId, onlyMedia, onlyRemote: true }));
Expand All @@ -112,7 +120,7 @@ const Firehose = ({ feedType, multiColumn }) => {
case 'public':
dispatch(expandPublicTimeline({ onlyMedia }));
if (signedIn) {
disconnect = dispatch(connectPublicStream({ onlyMedia }));
disconnect = dispatch(connectPublicStream({ onlyMedia, allowLocalOnly }));
}
break;
case 'public:remote':
Expand Down
1 change: 1 addition & 0 deletions app/javascript/flavours/glitch/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"empty_column.follow_recommendations": "Looks like no suggestions could be generated for you. You can try using search to look for people you might know or explore trending hashtags.",
"endorsed_accounts_editor.endorsed_accounts": "Featured accounts",
"favourite_modal.combo": "You can press {combo} to skip this next time",
"firehose.column_settings.allow_local_only": "Show local-only posts in \"All\"",
"follow_recommendations.done": "Done",
"follow_recommendations.heading": "Follow people you'd like to see posts from! Here are some suggestions.",
"follow_recommendations.lead": "Posts from people you follow will show up in chronological order on your home feed. Don't be afraid to make mistakes, you can unfollow people just as easily any time!",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/flavours/glitch/reducers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const initialState = ImmutableMap({

firehose: ImmutableMap({
onlyMedia: false,
allowLocalOnly: true,
}),

community: ImmutableMap({
Expand Down

0 comments on commit 9f3c3f5

Please sign in to comment.