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

@@ -16,6 +16,7 @@ import {
setGroupTimelineSort,
} from '../actions/groups'
import {
MIN_UNAUTHENTICATED_PAGES,
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
} from '../constants'
import StatusList from '../components/status_list'
@@ -26,7 +27,7 @@ class GroupTimeline extends ImmutablePureComponent {
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,
}
@@ -75,7 +76,7 @@ class GroupTimeline extends ImmutablePureComponent {
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)
@@ -102,7 +103,7 @@ class GroupTimeline extends ImmutablePureComponent {
return <ColumnIndicator type='missing' />
}
const canLoadMore = page < 2 && !me || !!me
const canLoadMore = page < MIN_UNAUTHENTICATED_PAGES && !me || !!me
return (
<React.Fragment>