Show local-only posts in “All” by default, and add back option to toggle it

This commit is contained in:
Claire 2023-07-02 20:24:27 +02:00
parent 587ddc2c7f
commit 9f3c3f5209
3 changed files with 14 additions and 4 deletions

View file

@ -49,6 +49,12 @@ const ColumnSettings = () => {
onChange={onChange} onChange={onChange}
label={<FormattedMessage id='community.column_settings.media_only' defaultMessage='Media only' />} 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>
</div> </div>
); );
@ -63,6 +69,8 @@ const Firehose = ({ feedType, multiColumn }) => {
const onlyMedia = useAppSelector((state) => state.getIn(['settings', 'firehose', 'onlyMedia'], false)); const onlyMedia = useAppSelector((state) => state.getIn(['settings', 'firehose', 'onlyMedia'], false));
const hasUnread = useAppSelector((state) => state.getIn(['timelines', `${feedType}${onlyMedia ? ':media' : ''}`, 'unread'], 0) > 0); 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( const handlePin = useCallback(
() => { () => {
switch(feedType) { switch(feedType) {
@ -70,14 +78,14 @@ const Firehose = ({ feedType, multiColumn }) => {
dispatch(addColumn('COMMUNITY', { other: { onlyMedia } })); dispatch(addColumn('COMMUNITY', { other: { onlyMedia } }));
break; break;
case 'public': case 'public':
dispatch(addColumn('PUBLIC', { other: { onlyMedia } })); dispatch(addColumn('PUBLIC', { other: { onlyMedia, allowLocalOnly } }));
break; break;
case 'public:remote': case 'public:remote':
dispatch(addColumn('REMOTE', { other: { onlyMedia, onlyRemote: true } })); dispatch(addColumn('REMOTE', { other: { onlyMedia, onlyRemote: true } }));
break; break;
} }
}, },
[dispatch, onlyMedia, feedType], [dispatch, onlyMedia, feedType, allowLocalOnly],
); );
const handleLoadMore = useCallback( const handleLoadMore = useCallback(
@ -87,7 +95,7 @@ const Firehose = ({ feedType, multiColumn }) => {
dispatch(expandCommunityTimeline({ onlyMedia })); dispatch(expandCommunityTimeline({ onlyMedia }));
break; break;
case 'public': case 'public':
dispatch(expandPublicTimeline({ maxId, onlyMedia })); dispatch(expandPublicTimeline({ maxId, onlyMedia, allowLocalOnly }));
break; break;
case 'public:remote': case 'public:remote':
dispatch(expandPublicTimeline({ maxId, onlyMedia, onlyRemote: true })); dispatch(expandPublicTimeline({ maxId, onlyMedia, onlyRemote: true }));
@ -112,7 +120,7 @@ const Firehose = ({ feedType, multiColumn }) => {
case 'public': case 'public':
dispatch(expandPublicTimeline({ onlyMedia })); dispatch(expandPublicTimeline({ onlyMedia }));
if (signedIn) { if (signedIn) {
disconnect = dispatch(connectPublicStream({ onlyMedia })); disconnect = dispatch(connectPublicStream({ onlyMedia, allowLocalOnly }));
} }
break; break;
case 'public:remote': case 'public:remote':

View file

@ -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.", "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", "endorsed_accounts_editor.endorsed_accounts": "Featured accounts",
"favourite_modal.combo": "You can press {combo} to skip this next time", "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.done": "Done",
"follow_recommendations.heading": "Follow people you'd like to see posts from! Here are some suggestions.", "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!", "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!",

View file

@ -86,6 +86,7 @@ const initialState = ImmutableMap({
firehose: ImmutableMap({ firehose: ImmutableMap({
onlyMedia: false, onlyMedia: false,
allowLocalOnly: true,
}), }),
community: ImmutableMap({ community: ImmutableMap({