From 1f1d6bf2a07219c9dfd04db5b98e31a0543a7427 Mon Sep 17 00:00:00 2001 From: Naoki Kosaka Date: Mon, 5 Jun 2017 21:13:20 +0900 Subject: [PATCH] Fix LoadMore in following and followers. (#3585) --- app/javascript/mastodon/features/followers/index.js | 11 +++++++++-- app/javascript/mastodon/features/following/index.js | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js index ed7119cda6..5120a5747e 100644 --- a/app/javascript/mastodon/features/followers/index.js +++ b/app/javascript/mastodon/features/followers/index.js @@ -18,6 +18,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items']), + hasMore: !!state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'next']), }); class Followers extends ImmutablePureComponent { @@ -54,7 +55,9 @@ class Followers extends ImmutablePureComponent { } render () { - const { accountIds } = this.props; + const { accountIds, hasMore } = this.props; + + let loadMore = null; if (!accountIds) { return ( @@ -64,6 +67,10 @@ class Followers extends ImmutablePureComponent { ); } + if (hasMore) { + loadMore = ; + } + return ( @@ -73,7 +80,7 @@ class Followers extends ImmutablePureComponent {
{accountIds.map(id => )} - + {loadMore}
diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js index dd7ab4d46d..e7be0f084b 100644 --- a/app/javascript/mastodon/features/following/index.js +++ b/app/javascript/mastodon/features/following/index.js @@ -18,6 +18,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items']), + hasMore: !!state.getIn(['user_lists', 'following', Number(props.params.accountId), 'next']), }); class Following extends ImmutablePureComponent { @@ -54,7 +55,9 @@ class Following extends ImmutablePureComponent { } render () { - const { accountIds } = this.props; + const { accountIds, hasMore } = this.props; + + let loadMore = null; if (!accountIds) { return ( @@ -64,6 +67,10 @@ class Following extends ImmutablePureComponent { ); } + if (hasMore) { + loadMore = ; + } + return ( @@ -73,7 +80,7 @@ class Following extends ImmutablePureComponent {
{accountIds.map(id => )} - + {loadMore}