[Glitch] Fix mutes, blocks, domain blocks and follow requests not paginating

Port ea7ad59af2  to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
master
Eugen Rochko 6 years ago committed by ThibG
parent bd7b1538f1
commit e58af04287
  1. 5
      app/javascript/flavours/glitch/features/blocks/index.js
  2. 5
      app/javascript/flavours/glitch/features/domain_blocks/index.js
  3. 5
      app/javascript/flavours/glitch/features/follow_requests/index.js
  4. 5
      app/javascript/flavours/glitch/features/mutes/index.js

@ -18,6 +18,7 @@ const messages = defineMessages({
const mapStateToProps = state => ({ const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'blocks', 'items']), accountIds: state.getIn(['user_lists', 'blocks', 'items']),
hasMore: !!state.getIn(['user_lists', 'blocks', 'next']),
}); });
@connect(mapStateToProps) @connect(mapStateToProps)
@ -28,6 +29,7 @@ export default class Blocks extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -45,7 +47,7 @@ export default class Blocks extends ImmutablePureComponent {
} }
render () { render () {
const { intl, accountIds } = this.props; const { intl, accountIds, hasMore } = this.props;
if (!accountIds) { if (!accountIds) {
return ( return (
@ -63,6 +65,7 @@ export default class Blocks extends ImmutablePureComponent {
<ScrollableList <ScrollableList
scrollKey='blocks' scrollKey='blocks'
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
hasMore={hasMore}
shouldUpdateScroll={this.shouldUpdateScroll} shouldUpdateScroll={this.shouldUpdateScroll}
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
> >

@ -19,6 +19,7 @@ const messages = defineMessages({
const mapStateToProps = state => ({ const mapStateToProps = state => ({
domains: state.getIn(['domain_lists', 'blocks', 'items']), domains: state.getIn(['domain_lists', 'blocks', 'items']),
hasMore: !!state.getIn(['domain_lists', 'blocks', 'next']),
}); });
@connect(mapStateToProps) @connect(mapStateToProps)
@ -28,6 +29,7 @@ export default class Blocks extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
hasMore: PropTypes.bool,
domains: ImmutablePropTypes.list, domains: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -41,7 +43,7 @@ export default class Blocks extends ImmutablePureComponent {
}, 300, { leading: true }); }, 300, { leading: true });
render () { render () {
const { intl, domains } = this.props; const { intl, domains, hasMore } = this.props;
if (!domains) { if (!domains) {
return ( return (
@ -59,6 +61,7 @@ export default class Blocks extends ImmutablePureComponent {
<ScrollableList <ScrollableList
scrollKey='domain_blocks' scrollKey='domain_blocks'
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
hasMore={hasMore}
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
> >
{domains.map(domain => {domains.map(domain =>

@ -18,6 +18,7 @@ const messages = defineMessages({
const mapStateToProps = state => ({ const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'follow_requests', 'items']), accountIds: state.getIn(['user_lists', 'follow_requests', 'items']),
hasMore: !!state.getIn(['user_lists', 'follow_requests', 'next']),
}); });
@connect(mapStateToProps) @connect(mapStateToProps)
@ -27,6 +28,7 @@ export default class FollowRequests extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
hasMore: PropTypes.bool,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -45,7 +47,7 @@ export default class FollowRequests extends ImmutablePureComponent {
} }
render () { render () {
const { intl, accountIds } = this.props; const { intl, accountIds, hasMore } = this.props;
if (!accountIds) { if (!accountIds) {
return ( return (
@ -64,6 +66,7 @@ export default class FollowRequests extends ImmutablePureComponent {
<ScrollableList <ScrollableList
scrollKey='follow_requests' scrollKey='follow_requests'
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
hasMore={hasMore}
shouldUpdateScroll={this.shouldUpdateScroll} shouldUpdateScroll={this.shouldUpdateScroll}
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
> >

@ -18,6 +18,7 @@ const messages = defineMessages({
const mapStateToProps = state => ({ const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'mutes', 'items']), accountIds: state.getIn(['user_lists', 'mutes', 'items']),
hasMore: !!state.getIn(['user_lists', 'mutes', 'next']),
}); });
@connect(mapStateToProps) @connect(mapStateToProps)
@ -27,6 +28,7 @@ export default class Mutes extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
hasMore: PropTypes.bool,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -45,7 +47,7 @@ export default class Mutes extends ImmutablePureComponent {
} }
render () { render () {
const { intl, accountIds } = this.props; const { intl, accountIds, hasMore } = this.props;
if (!accountIds) { if (!accountIds) {
return ( return (
@ -63,6 +65,7 @@ export default class Mutes extends ImmutablePureComponent {
<ScrollableList <ScrollableList
scrollKey='mutes' scrollKey='mutes'
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
hasMore={hasMore}
shouldUpdateScroll={this.shouldUpdateScroll} shouldUpdateScroll={this.shouldUpdateScroll}
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
> >

Loading…
Cancel
Save