Merge branch 'feed-settings' into 'develop'

Make all timelines use "home" timeline settings

Closes #1230

See merge request soapbox-pub/soapbox!2030
environments/review-develop-3zknud/deployments/1832
Alex Gleason 2022-12-23 19:23:30 +00:00
commit 472af420c0
4 zmienionych plików z 8 dodań i 9 usunięć

Wyświetl plik

@ -45,6 +45,7 @@ const CommunityTimeline = () => {
<Timeline
scrollKey={`${timelineId}_timeline`}
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
prefix='home'
onLoadMore={handleLoadMore}
emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The local timeline is empty. Write something publicly to get the ball rolling!' />}
divideType='space'

Wyświetl plik

@ -121,17 +121,11 @@ const Preferences = () => {
return (
<Form>
<List>
<ListItem
label={<FormattedMessage id='home.column_settings.show_reblogs' defaultMessage='Show reposts' />}
hint={<FormattedMessage id='preferences.hints.feed' defaultMessage='In your home feed' />}
>
<ListItem label={<FormattedMessage id='home.column_settings.show_reblogs' defaultMessage='Show reposts' />}>
<SettingToggle settings={settings} settingPath={['home', 'shows', 'reblog']} onChange={onToggleChange} />
</ListItem>
<ListItem
label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />}
hint={<FormattedMessage id='preferences.hints.feed' defaultMessage='In your home feed' />}
>
<ListItem label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />}>
<SettingToggle settings={settings} settingPath={['home', 'shows', 'reply']} onChange={onToggleChange} />
</ListItem>
</List>

Wyświetl plik

@ -92,6 +92,7 @@ const CommunityTimeline = () => {
<Timeline
scrollKey={`${timelineId}_timeline`}
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
prefix='home'
onLoadMore={handleLoadMore}
emptyMessage={<FormattedMessage id='empty_column.public' defaultMessage='There is nothing here! Write something publicly, or manually follow users from other servers to fill it up' />}
divideType='space'

Wyświetl plik

@ -16,19 +16,22 @@ const messages = defineMessages({
interface ITimeline extends Omit<IStatusList, 'statusIds' | 'isLoading' | 'hasMore'> {
/** ID of the timeline in Redux. */
timelineId: string,
/** Settings path to use instead of the timelineId. */
prefix?: string,
}
/** Scrollable list of statuses from a timeline in the Redux store. */
const Timeline: React.FC<ITimeline> = ({
timelineId,
onLoadMore,
prefix,
...rest
}) => {
const dispatch = useAppDispatch();
const getStatusIds = useCallback(makeGetStatusIds(), []);
const lastStatusId = useAppSelector(state => (state.timelines.get(timelineId)?.items || ImmutableOrderedSet()).last() as string | undefined);
const statusIds = useAppSelector(state => getStatusIds(state, { type: timelineId }));
const statusIds = useAppSelector(state => getStatusIds(state, { type: timelineId, prefix }));
const isLoading = useAppSelector(state => (state.timelines.get(timelineId) || { isLoading: true }).isLoading === true);
const isPartial = useAppSelector(state => (state.timelines.get(timelineId)?.isPartial || false) === true);
const hasMore = useAppSelector(state => state.timelines.get(timelineId)?.hasMore === true);