[groups] Change default sorts for groups and groups collection

This commit is contained in:
Fosco Marotto 2021-01-24 15:21:09 -05:00
parent 1c647b0b06
commit 3f6e8a62fd
2 changed files with 22 additions and 14 deletions

View File

@ -39,8 +39,8 @@ class GroupCollectionTimeline extends React.PureComponent {
if (this.props.collectionType === 'featured' && sortByValue !== GROUP_TIMELINE_SORTING_TYPE_HOT) { if (this.props.collectionType === 'featured' && sortByValue !== GROUP_TIMELINE_SORTING_TYPE_HOT) {
this.props.setFeaturedTop() this.props.setFeaturedTop()
} else if (!!me && this.props.collectionType === 'member' && sortByValue !== GROUP_TIMELINE_SORTING_TYPE_NEWEST) { } else if (!!me && this.props.collectionType === 'member' && sortByValue !== GROUP_TIMELINE_SORTING_TYPE_HOT) {
this.props.setMemberNewest() this.props.setMemberHot()
} else { } else {
const sortBy = getSortBy(sortByValue, sortByTopValue) const sortBy = getSortBy(sortByValue, sortByTopValue)
this.props.onExpandGroupCollectionTimeline(collectionType, { sortBy }) this.props.onExpandGroupCollectionTimeline(collectionType, { sortBy })
@ -141,6 +141,9 @@ const mapDispatchToProps = (dispatch) => ({
setMemberNewest() { setMemberNewest() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST)) dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST))
}, },
setMemberHot() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_HOT))
},
}) })
GroupCollectionTimeline.propTypes = { GroupCollectionTimeline.propTypes = {

View File

@ -14,10 +14,12 @@ import {
} from '../actions/timelines' } from '../actions/timelines'
import { import {
setGroupTimelineSort, setGroupTimelineSort,
setGroupTimelineTopSort,
} from '../actions/groups' } from '../actions/groups'
import { import {
MIN_UNAUTHENTICATED_PAGES, MIN_UNAUTHENTICATED_PAGES,
GROUP_TIMELINE_SORTING_TYPE_NEWEST, GROUP_TIMELINE_SORTING_TYPE_NEWEST,
GROUP_TIMELINE_SORTING_TYPE_TOP_OPTION_WEEKLY,
} from '../constants' } from '../constants'
import StatusList from '../components/status_list' import StatusList from '../components/status_list'
import ColumnIndicator from '../components/column_indicator' import ColumnIndicator from '../components/column_indicator'
@ -40,8 +42,8 @@ class GroupTimeline extends ImmutablePureComponent {
isDeckConnected, isDeckConnected,
} = this.props } = this.props
if (sortByValue !== GROUP_TIMELINE_SORTING_TYPE_NEWEST) { if (sortByValue !== GROUP_TIMELINE_SORTING_TYPE_TOP_OPTION_WEEKLY) {
this.props.setMemberNewest() this.props.setMemberTopWeekly()
} else { } else {
const sortBy = getSortBy(sortByValue, sortByTopValue, onlyMedia) const sortBy = getSortBy(sortByValue, sortByTopValue, onlyMedia)
@ -146,6 +148,9 @@ const mapDispatchToProps = (dispatch) => ({
setMemberNewest() { setMemberNewest() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST)) dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST))
}, },
setMemberTopWeekly() {
dispatch(setGroupTimelineTopSort(GROUP_TIMELINE_SORTING_TYPE_TOP_OPTION_WEEKLY))
},
onExpandGroupFeaturedTimeline(groupId) { onExpandGroupFeaturedTimeline(groupId) {
dispatch(expandGroupFeaturedTimeline(groupId)) dispatch(expandGroupFeaturedTimeline(groupId))
}, },