Added MIN_UNAUTHENTICATED_PAGES for pagination of group, explore timelines

• Added:
- MIN_UNAUTHENTICATED_PAGES for pagination of group, explore timelines
This commit is contained in:
mgabdev
2021-01-13 22:49:00 -05:00
parent 0ef9d8410f
commit be38ed784c
4 changed files with 14 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ import {
setGroupTimelineSort,
} from '../actions/groups'
import {
MIN_UNAUTHENTICATED_PAGES,
GROUP_TIMELINE_SORTING_TYPE_HOT,
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
} from '../constants'
@@ -25,7 +26,7 @@ class GroupCollectionTimeline extends React.PureComponent {
state = {
//keep track of page loads for if no user,
//only allow 2 page loads before showing sign up msg
//only allow MIN_UNAUTHENTICATED_PAGES page loads before showing sign up msg
page: 1,
}
@@ -64,7 +65,7 @@ class GroupCollectionTimeline extends React.PureComponent {
const { page } = this.state
const newPage = !!maxId ? this.state.page + 1 : 1
if (!!maxId && !me && page >= 2) return false
if (!!maxId && !me && page >= MIN_UNAUTHENTICATED_PAGES) return false
this.setState({ page: newPage })
const sortBy = getSortBy(sortByValue, sortByTopValue)
@@ -90,7 +91,7 @@ class GroupCollectionTimeline extends React.PureComponent {
</div>
) : intl.formatMessage(messages.empty)
const canLoadMore = page < 2 && !me || !!me
const canLoadMore = page < MIN_UNAUTHENTICATED_PAGES && !me || !!me
return (
<React.Fragment>