From e9f88f40058a510da9d36feb57f5edf1d98908d9 Mon Sep 17 00:00:00 2001 From: Jakub Mendyk Date: Sun, 26 Aug 2018 16:39:37 +0200 Subject: [Glitch] Add messages informing that collections are empty Port 5129f6f2aa56afb21708aec552a798d062ccaff9 to glitch-soc Signed-off-by: Thibaut Girka --- .../flavours/glitch/features/blocks/index.js | 34 +++++++++--------- .../glitch/features/domain_blocks/index.js | 14 +++++--- .../glitch/features/favourited_statuses/index.js | 7 ++-- .../flavours/glitch/features/favourites/index.js | 21 ++++++----- .../glitch/features/follow_requests/index.js | 34 +++++++++--------- .../flavours/glitch/features/followers/index.js | 37 +++++++++---------- .../flavours/glitch/features/following/index.js | 42 ++++++++++------------ .../flavours/glitch/features/lists/index.js | 13 ++++--- .../flavours/glitch/features/mutes/index.js | 34 +++++++++--------- .../flavours/glitch/features/reblogs/index.js | 20 +++++++---- 10 files changed, 141 insertions(+), 115 deletions(-) diff --git a/app/javascript/flavours/glitch/features/blocks/index.js b/app/javascript/flavours/glitch/features/blocks/index.js index 386a0ce63..e995fb31f 100644 --- a/app/javascript/flavours/glitch/features/blocks/index.js +++ b/app/javascript/flavours/glitch/features/blocks/index.js @@ -1,14 +1,15 @@ import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import PropTypes from 'prop-types'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { ScrollContainer } from 'react-router-scroll-4'; +import ScrollableList from '../../components/scrollable_list'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; import AccountContainer from 'flavours/glitch/containers/account_container'; import { fetchBlocks, expandBlocks } from 'flavours/glitch/actions/blocks'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ @@ -34,13 +35,9 @@ export default class Blocks extends ImmutablePureComponent { this.props.dispatch(fetchBlocks()); } - handleScroll = (e) => { - const { scrollTop, scrollHeight, clientHeight } = e.target; - - if (scrollTop === scrollHeight - clientHeight) { - this.props.dispatch(expandBlocks()); - } - } + handleLoadMore = debounce(() => { + this.props.dispatch(expandBlocks()); + }, 300, { leading: true }); shouldUpdateScroll = (prevRouterProps, { location }) => { if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; @@ -58,16 +55,21 @@ export default class Blocks extends ImmutablePureComponent { ); } + const emptyMessage = ; + return ( - -
- {accountIds.map(id => - - )} -
-
+ + {accountIds.map(id => + + )} +
); } diff --git a/app/javascript/flavours/glitch/features/domain_blocks/index.js b/app/javascript/flavours/glitch/features/domain_blocks/index.js index 3b29e2a26..8b5496139 100644 --- a/app/javascript/flavours/glitch/features/domain_blocks/index.js +++ b/app/javascript/flavours/glitch/features/domain_blocks/index.js @@ -1,16 +1,16 @@ import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import PropTypes from 'prop-types'; import LoadingIndicator from '../../components/loading_indicator'; import Column from '../ui/components/column'; import ColumnBackButtonSlim from '../../components/column_back_button_slim'; import DomainContainer from '../../containers/domain_container'; import { fetchDomainBlocks, expandDomainBlocks } from '../../actions/domain_blocks'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { debounce } from 'lodash'; -import ScrollableList from '../../components/scrollable_list'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; const messages = defineMessages({ heading: { id: 'column.domain_blocks', defaultMessage: 'Hidden domains' }, @@ -51,10 +51,16 @@ export default class Blocks extends ImmutablePureComponent { ); } + const emptyMessage = ; + return ( - + {domains.map(domain => )} diff --git a/app/javascript/flavours/glitch/features/favourited_statuses/index.js b/app/javascript/flavours/glitch/features/favourited_statuses/index.js index 32bf4e71a..0dae7dd53 100644 --- a/app/javascript/flavours/glitch/features/favourited_statuses/index.js +++ b/app/javascript/flavours/glitch/features/favourited_statuses/index.js @@ -2,14 +2,14 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import { fetchFavouritedStatuses, expandFavouritedStatuses } from 'flavours/glitch/actions/favourites'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import StatusList from 'flavours/glitch/components/status_list'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { debounce } from 'lodash'; const messages = defineMessages({ heading: { id: 'column.favourites', defaultMessage: 'Favourites' }, @@ -70,6 +70,8 @@ export default class Favourites extends ImmutablePureComponent { const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props; const pinned = !!columnId; + const emptyMessage = ; + return ( ); diff --git a/app/javascript/flavours/glitch/features/favourites/index.js b/app/javascript/flavours/glitch/features/favourites/index.js index eb86636c3..16ce6ed10 100644 --- a/app/javascript/flavours/glitch/features/favourites/index.js +++ b/app/javascript/flavours/glitch/features/favourites/index.js @@ -4,12 +4,12 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import { fetchFavourites } from 'flavours/glitch/actions/interactions'; -import { ScrollContainer } from 'react-router-scroll-4'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import ScrollableList from '../../components/scrollable_list'; const messages = defineMessages({ heading: { id: 'column.favourited_by', defaultMessage: 'Favourited by' }, @@ -64,6 +64,8 @@ export default class Favourites extends ImmutablePureComponent { ); } + const emptyMessage = ; + return ( - - -
- {accountIds.map(id => )} -
-
+ + {accountIds.map(id => + + )} +
); } diff --git a/app/javascript/flavours/glitch/features/follow_requests/index.js b/app/javascript/flavours/glitch/features/follow_requests/index.js index d0845769e..8c2e70ca4 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/index.js +++ b/app/javascript/flavours/glitch/features/follow_requests/index.js @@ -2,14 +2,15 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { ScrollContainer } from 'react-router-scroll-4'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; import AccountAuthorizeContainer from './containers/account_authorize_container'; import { fetchFollowRequests, expandFollowRequests } from 'flavours/glitch/actions/accounts'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; const messages = defineMessages({ heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' }, @@ -34,13 +35,9 @@ export default class FollowRequests extends ImmutablePureComponent { this.props.dispatch(fetchFollowRequests()); } - handleScroll = (e) => { - const { scrollTop, scrollHeight, clientHeight } = e.target; - - if (scrollTop === scrollHeight - clientHeight) { - this.props.dispatch(expandFollowRequests()); - } - } + handleLoadMore = debounce(() => { + this.props.dispatch(expandFollowRequests()); + }, 300, { leading: true }); shouldUpdateScroll = (prevRouterProps, { location }) => { if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; @@ -58,17 +55,22 @@ export default class FollowRequests extends ImmutablePureComponent { ); } + const emptyMessage = ; + return ( - -
- {accountIds.map(id => - - )} -
-
+ + {accountIds.map(id => + + )} +
); } diff --git a/app/javascript/flavours/glitch/features/followers/index.js b/app/javascript/flavours/glitch/features/followers/index.js index 2e47ab9b9..0f50b727d 100644 --- a/app/javascript/flavours/glitch/features/followers/index.js +++ b/app/javascript/flavours/glitch/features/followers/index.js @@ -2,20 +2,21 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import { fetchAccount, fetchFollowers, expandFollowers, } from 'flavours/glitch/actions/accounts'; -import { ScrollContainer } from 'react-router-scroll-4'; +import { FormattedMessage } from 'react-intl'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; -import LoadMore from 'flavours/glitch/components/load_more'; import ImmutablePureComponent from 'react-immutable-pure-component'; import MissingIndicator from 'flavours/glitch/components/missing_indicator'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; const mapStateToProps = (state, props) => ({ isAccount: !!state.getIn(['accounts', props.params.accountId]), @@ -58,10 +59,10 @@ export default class Followers extends ImmutablePureComponent { } } - handleLoadMore = (e) => { + handleLoadMore = debounce(() => { e.preventDefault(); this.props.dispatch(expandFollowers(this.props.params.accountId)); - } + }, 300, { leading: true }); shouldUpdateScroll = (prevRouterProps, { location }) => { if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; @@ -83,8 +84,6 @@ export default class Followers extends ImmutablePureComponent { ); } - let loadMore = null; - if (!accountIds) { return ( @@ -93,23 +92,25 @@ export default class Followers extends ImmutablePureComponent { ); } - if (hasMore) { - loadMore = ; - } + const emptyMessage = ; return ( - -
-
- - {accountIds.map(id => )} - {loadMore} -
-
-
+ + + + {accountIds.map(id => + + )} +
); } diff --git a/app/javascript/flavours/glitch/features/following/index.js b/app/javascript/flavours/glitch/features/following/index.js index ad1445f3a..b69358890 100644 --- a/app/javascript/flavours/glitch/features/following/index.js +++ b/app/javascript/flavours/glitch/features/following/index.js @@ -2,20 +2,21 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import { fetchAccount, fetchFollowing, expandFollowing, } from 'flavours/glitch/actions/accounts'; -import { ScrollContainer } from 'react-router-scroll-4'; +import { FormattedMessage } from 'react-intl'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; import ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header'; import HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container'; -import LoadMore from 'flavours/glitch/components/load_more'; import ImmutablePureComponent from 'react-immutable-pure-component'; import MissingIndicator from 'flavours/glitch/components/missing_indicator'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; const mapStateToProps = (state, props) => ({ isAccount: !!state.getIn(['accounts', props.params.accountId]), @@ -58,15 +59,10 @@ export default class Following extends ImmutablePureComponent { } } - handleLoadMore = (e) => { + handleLoadMore = debounce(() => { e.preventDefault(); this.props.dispatch(expandFollowing(this.props.params.accountId)); - } - - shouldUpdateScroll = (prevRouterProps, { location }) => { - if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; - return !(location.state && location.state.mastodonModalOpen); - } + }, 300, { leading: true }); setRef = c => { this.column = c; @@ -83,8 +79,6 @@ export default class Following extends ImmutablePureComponent { ); } - let loadMore = null; - if (!accountIds) { return ( @@ -93,23 +87,25 @@ export default class Following extends ImmutablePureComponent { ); } - if (hasMore) { - loadMore = ; - } + const emptyMessage = ; return ( - -
-
- - {accountIds.map(id => )} - {loadMore} -
-
-
+ + + + {accountIds.map(id => + + )} +
); } diff --git a/app/javascript/flavours/glitch/features/lists/index.js b/app/javascript/flavours/glitch/features/lists/index.js index 8b0470c92..bf1b410bb 100644 --- a/app/javascript/flavours/glitch/features/lists/index.js +++ b/app/javascript/flavours/glitch/features/lists/index.js @@ -6,12 +6,13 @@ import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; import { fetchLists } from 'flavours/glitch/actions/lists'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ColumnLink from 'flavours/glitch/features/ui/components/column_link'; import ColumnSubheading from 'flavours/glitch/features/ui/components/column_subheading'; import NewListForm from './components/new_list_form'; import { createSelector } from 'reselect'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; const messages = defineMessages({ heading: { id: 'column.lists', defaultMessage: 'Lists' }, @@ -62,13 +63,15 @@ export default class Lists extends ImmutablePureComponent { -
- - + + {lists.map(list => )} -
+
); } diff --git a/app/javascript/flavours/glitch/features/mutes/index.js b/app/javascript/flavours/glitch/features/mutes/index.js index bbcbea701..c398395e8 100644 --- a/app/javascript/flavours/glitch/features/mutes/index.js +++ b/app/javascript/flavours/glitch/features/mutes/index.js @@ -1,15 +1,16 @@ import React from 'react'; import { connect } from 'react-redux'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; -import { ScrollContainer } from 'react-router-scroll-4'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim'; import AccountContainer from 'flavours/glitch/containers/account_container'; import { fetchMutes, expandMutes } from 'flavours/glitch/actions/mutes'; -import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; const messages = defineMessages({ heading: { id: 'column.mutes', defaultMessage: 'Muted users' }, @@ -34,13 +35,9 @@ export default class Mutes extends ImmutablePureComponent { this.props.dispatch(fetchMutes()); } - handleScroll = (e) => { - const { scrollTop, scrollHeight, clientHeight } = e.target; - - if (scrollTop === scrollHeight - clientHeight) { - this.props.dispatch(expandMutes()); - } - } + handleLoadMore = debounce(() => { + this.props.dispatch(expandMutes()); + }, 300, { leading: true }); shouldUpdateScroll = (prevRouterProps, { location }) => { if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; @@ -58,16 +55,21 @@ export default class Mutes extends ImmutablePureComponent { ); } + const emptyMessage = ; + return ( - -
- {accountIds.map(id => - - )} -
-
+ + {accountIds.map(id => + + )} +
); } diff --git a/app/javascript/flavours/glitch/features/reblogs/index.js b/app/javascript/flavours/glitch/features/reblogs/index.js index e007506b7..cb1dc5c29 100644 --- a/app/javascript/flavours/glitch/features/reblogs/index.js +++ b/app/javascript/flavours/glitch/features/reblogs/index.js @@ -4,12 +4,12 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import { fetchReblogs } from 'flavours/glitch/actions/interactions'; -import { ScrollContainer } from 'react-router-scroll-4'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import ScrollableList from 'flavours/glitch/components/scrollable_list'; const messages = defineMessages({ heading: { id: 'column.reblogged_by', defaultMessage: 'Boosted by' }, @@ -64,6 +64,8 @@ export default class Reblogs extends ImmutablePureComponent { ); } + const emptyMessage = ; + return ( - -
- {accountIds.map(id => )} -
-
+ + {accountIds.map(id => + + )} +
); } -- cgit From b294b5956bf15c8c18c75d01c57ddfeb07270ff7 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sat, 20 Jul 2019 15:07:24 +0200 Subject: Add empty column message to bookmarks column --- .../flavours/glitch/features/bookmarked_statuses/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/features/bookmarked_statuses/index.js b/app/javascript/flavours/glitch/features/bookmarked_statuses/index.js index 9468ad81d..c57aba37b 100644 --- a/app/javascript/flavours/glitch/features/bookmarked_statuses/index.js +++ b/app/javascript/flavours/glitch/features/bookmarked_statuses/index.js @@ -2,14 +2,14 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { debounce } from 'lodash'; import { fetchBookmarkedStatuses, expandBookmarkedStatuses } from 'flavours/glitch/actions/bookmarks'; import Column from 'flavours/glitch/features/ui/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import StatusList from 'flavours/glitch/components/status_list'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { debounce } from 'lodash'; const messages = defineMessages({ heading: { id: 'column.bookmarks', defaultMessage: 'Bookmarks' }, @@ -70,6 +70,8 @@ export default class Bookmarks extends ImmutablePureComponent { const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props; const pinned = !!columnId; + const emptyMessage = ; + return ( ); -- cgit From c614abb95dcb226edd60df52bd987adbe83d7b30 Mon Sep 17 00:00:00 2001 From: Jakub Mendyk Date: Wed, 29 Aug 2018 01:19:58 +0200 Subject: [Glitch] Fix followers/follows layout issues from #8418 Port ceed1ebe5b308a95f9c167c93d3bc0976937fb58 to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/features/followers/index.js | 5 +++-- app/javascript/flavours/glitch/features/following/index.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/features/followers/index.js b/app/javascript/flavours/glitch/features/followers/index.js index 0f50b727d..b0a9efc21 100644 --- a/app/javascript/flavours/glitch/features/followers/index.js +++ b/app/javascript/flavours/glitch/features/followers/index.js @@ -98,13 +98,14 @@ export default class Followers extends ImmutablePureComponent { - - } + alwaysPrepend + alwaysShowScrollbar emptyMessage={emptyMessage} > {accountIds.map(id => diff --git a/app/javascript/flavours/glitch/features/following/index.js b/app/javascript/flavours/glitch/features/following/index.js index b69358890..baf3730d9 100644 --- a/app/javascript/flavours/glitch/features/following/index.js +++ b/app/javascript/flavours/glitch/features/following/index.js @@ -93,13 +93,14 @@ export default class Following extends ImmutablePureComponent { - - } + alwaysPrepend + alwaysShowScrollbar emptyMessage={emptyMessage} > {accountIds.map(id => -- cgit From bd7b1538f17f3aa5b73a691044cf64068f23a231 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 12 Dec 2018 22:32:44 +0100 Subject: [Glitch] Fix followers and followings on account profiles Partial fix from 55abff8af75b9a8ab541ec68a3603c77e1339e23 Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/features/followers/index.js | 1 - app/javascript/flavours/glitch/features/following/index.js | 1 - 2 files changed, 2 deletions(-) diff --git a/app/javascript/flavours/glitch/features/followers/index.js b/app/javascript/flavours/glitch/features/followers/index.js index b0a9efc21..704e0c92e 100644 --- a/app/javascript/flavours/glitch/features/followers/index.js +++ b/app/javascript/flavours/glitch/features/followers/index.js @@ -105,7 +105,6 @@ export default class Followers extends ImmutablePureComponent { shouldUpdateScroll={this.shouldUpdateScroll} prepend={} alwaysPrepend - alwaysShowScrollbar emptyMessage={emptyMessage} > {accountIds.map(id => diff --git a/app/javascript/flavours/glitch/features/following/index.js b/app/javascript/flavours/glitch/features/following/index.js index baf3730d9..46cc773e7 100644 --- a/app/javascript/flavours/glitch/features/following/index.js +++ b/app/javascript/flavours/glitch/features/following/index.js @@ -100,7 +100,6 @@ export default class Following extends ImmutablePureComponent { shouldUpdateScroll={this.shouldUpdateScroll} prepend={} alwaysPrepend - alwaysShowScrollbar emptyMessage={emptyMessage} > {accountIds.map(id => -- cgit From e58af0428775d6e8f98ce86cbb626e0abf6fa78b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 16 Feb 2019 11:56:09 +0100 Subject: [Glitch] Fix mutes, blocks, domain blocks and follow requests not paginating Port ea7ad59af20af2aa6817b3b40dca34c8fba3373a to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/features/blocks/index.js | 5 ++++- app/javascript/flavours/glitch/features/domain_blocks/index.js | 5 ++++- app/javascript/flavours/glitch/features/follow_requests/index.js | 5 ++++- app/javascript/flavours/glitch/features/mutes/index.js | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/features/blocks/index.js b/app/javascript/flavours/glitch/features/blocks/index.js index e995fb31f..1a7206f80 100644 --- a/app/javascript/flavours/glitch/features/blocks/index.js +++ b/app/javascript/flavours/glitch/features/blocks/index.js @@ -18,6 +18,7 @@ const messages = defineMessages({ const mapStateToProps = state => ({ accountIds: state.getIn(['user_lists', 'blocks', 'items']), + hasMore: !!state.getIn(['user_lists', 'blocks', 'next']), }); @connect(mapStateToProps) @@ -28,6 +29,7 @@ export default class Blocks extends ImmutablePureComponent { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, + hasMore: PropTypes.bool, intl: PropTypes.object.isRequired, }; @@ -45,7 +47,7 @@ export default class Blocks extends ImmutablePureComponent { } render () { - const { intl, accountIds } = this.props; + const { intl, accountIds, hasMore } = this.props; if (!accountIds) { return ( @@ -63,6 +65,7 @@ export default class Blocks extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/domain_blocks/index.js b/app/javascript/flavours/glitch/features/domain_blocks/index.js index 8b5496139..f7d93a48e 100644 --- a/app/javascript/flavours/glitch/features/domain_blocks/index.js +++ b/app/javascript/flavours/glitch/features/domain_blocks/index.js @@ -19,6 +19,7 @@ const messages = defineMessages({ const mapStateToProps = state => ({ domains: state.getIn(['domain_lists', 'blocks', 'items']), + hasMore: !!state.getIn(['domain_lists', 'blocks', 'next']), }); @connect(mapStateToProps) @@ -28,6 +29,7 @@ export default class Blocks extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, + hasMore: PropTypes.bool, domains: ImmutablePropTypes.list, intl: PropTypes.object.isRequired, }; @@ -41,7 +43,7 @@ export default class Blocks extends ImmutablePureComponent { }, 300, { leading: true }); render () { - const { intl, domains } = this.props; + const { intl, domains, hasMore } = this.props; if (!domains) { return ( @@ -59,6 +61,7 @@ export default class Blocks extends ImmutablePureComponent { {domains.map(domain => diff --git a/app/javascript/flavours/glitch/features/follow_requests/index.js b/app/javascript/flavours/glitch/features/follow_requests/index.js index 8c2e70ca4..eacf1e0ac 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/index.js +++ b/app/javascript/flavours/glitch/features/follow_requests/index.js @@ -18,6 +18,7 @@ const messages = defineMessages({ const mapStateToProps = state => ({ accountIds: state.getIn(['user_lists', 'follow_requests', 'items']), + hasMore: !!state.getIn(['user_lists', 'follow_requests', 'next']), }); @connect(mapStateToProps) @@ -27,6 +28,7 @@ export default class FollowRequests extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, + hasMore: PropTypes.bool, accountIds: ImmutablePropTypes.list, intl: PropTypes.object.isRequired, }; @@ -45,7 +47,7 @@ export default class FollowRequests extends ImmutablePureComponent { } render () { - const { intl, accountIds } = this.props; + const { intl, accountIds, hasMore } = this.props; if (!accountIds) { return ( @@ -64,6 +66,7 @@ export default class FollowRequests extends ImmutablePureComponent { diff --git a/app/javascript/flavours/glitch/features/mutes/index.js b/app/javascript/flavours/glitch/features/mutes/index.js index c398395e8..35c15deec 100644 --- a/app/javascript/flavours/glitch/features/mutes/index.js +++ b/app/javascript/flavours/glitch/features/mutes/index.js @@ -18,6 +18,7 @@ const messages = defineMessages({ const mapStateToProps = state => ({ accountIds: state.getIn(['user_lists', 'mutes', 'items']), + hasMore: !!state.getIn(['user_lists', 'mutes', 'next']), }); @connect(mapStateToProps) @@ -27,6 +28,7 @@ export default class Mutes extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, + hasMore: PropTypes.bool, accountIds: ImmutablePropTypes.list, intl: PropTypes.object.isRequired, }; @@ -45,7 +47,7 @@ export default class Mutes extends ImmutablePureComponent { } render () { - const { intl, accountIds } = this.props; + const { intl, accountIds, hasMore } = this.props; if (!accountIds) { return ( @@ -63,6 +65,7 @@ export default class Mutes extends ImmutablePureComponent { -- cgit From 6db5669818cce459b9bb916665541b7b8f5d5155 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sat, 20 Jul 2019 16:07:55 +0200 Subject: Clean up redundant shouldUpdateScroll definitions --- app/javascript/flavours/glitch/features/blocks/index.js | 6 ------ app/javascript/flavours/glitch/features/community_timeline/index.js | 5 ----- app/javascript/flavours/glitch/features/favourites/index.js | 6 ------ app/javascript/flavours/glitch/features/follow_requests/index.js | 6 ------ app/javascript/flavours/glitch/features/followers/index.js | 6 ------ app/javascript/flavours/glitch/features/following/index.js | 1 - app/javascript/flavours/glitch/features/mutes/index.js | 6 ------ app/javascript/flavours/glitch/features/public_timeline/index.js | 4 ---- app/javascript/flavours/glitch/features/reblogs/index.js | 6 ------ 9 files changed, 46 deletions(-) diff --git a/app/javascript/flavours/glitch/features/blocks/index.js b/app/javascript/flavours/glitch/features/blocks/index.js index 1a7206f80..2d0f10ae7 100644 --- a/app/javascript/flavours/glitch/features/blocks/index.js +++ b/app/javascript/flavours/glitch/features/blocks/index.js @@ -41,11 +41,6 @@ export default class Blocks extends ImmutablePureComponent { this.props.dispatch(expandBlocks()); }, 300, { leading: true }); - shouldUpdateScroll = (prevRouterProps, { location }) => { - if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; - return !(location.state && location.state.mastodonModalOpen); - } - render () { const { intl, accountIds, hasMore } = this.props; @@ -66,7 +61,6 @@ export default class Blocks extends ImmutablePureComponent { scrollKey='blocks' onLoadMore={this.handleLoadMore} hasMore={hasMore} - shouldUpdateScroll={this.shouldUpdateScroll} emptyMessage={emptyMessage} > {accountIds.map(id => diff --git a/app/javascript/flavours/glitch/features/community_timeline/index.js b/app/javascript/flavours/glitch/features/community_timeline/index.js index 2c0fbff36..24126e5bc 100644 --- a/app/javascript/flavours/glitch/features/community_timeline/index.js +++ b/app/javascript/flavours/glitch/features/community_timeline/index.js @@ -99,10 +99,6 @@ export default class CommunityTimeline extends React.PureComponent { dispatch(expandCommunityTimeline({ maxId, onlyMedia })); } - shouldUpdateScroll = (prevRouterProps, { location }) => { - return !(location.state && location.state.mastodonModalOpen) - } - render () { const { intl, hasUnread, columnId, multiColumn, onlyMedia } = this.props; const pinned = !!columnId; @@ -125,7 +121,6 @@ export default class CommunityTimeline extends React.PureComponent { } diff --git a/app/javascript/flavours/glitch/features/favourites/index.js b/app/javascript/flavours/glitch/features/favourites/index.js index 16ce6ed10..81f0b24c4 100644 --- a/app/javascript/flavours/glitch/features/favourites/index.js +++ b/app/javascript/flavours/glitch/features/favourites/index.js @@ -40,11 +40,6 @@ export default class Favourites extends ImmutablePureComponent { } } - shouldUpdateScroll = (prevRouterProps, { location }) => { - if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; - return !(location.state && location.state.mastodonModalOpen); - } - handleHeaderClick = () => { this.column.scrollTop(); } @@ -76,7 +71,6 @@ export default class Favourites extends ImmutablePureComponent { /> {accountIds.map(id => diff --git a/app/javascript/flavours/glitch/features/follow_requests/index.js b/app/javascript/flavours/glitch/features/follow_requests/index.js index eacf1e0ac..89340320e 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/index.js +++ b/app/javascript/flavours/glitch/features/follow_requests/index.js @@ -41,11 +41,6 @@ export default class FollowRequests extends ImmutablePureComponent { this.props.dispatch(expandFollowRequests()); }, 300, { leading: true }); - shouldUpdateScroll = (prevRouterProps, { location }) => { - if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; - return !(location.state && location.state.mastodonModalOpen); - } - render () { const { intl, accountIds, hasMore } = this.props; @@ -67,7 +62,6 @@ export default class FollowRequests extends ImmutablePureComponent { scrollKey='follow_requests' onLoadMore={this.handleLoadMore} hasMore={hasMore} - shouldUpdateScroll={this.shouldUpdateScroll} emptyMessage={emptyMessage} > {accountIds.map(id => diff --git a/app/javascript/flavours/glitch/features/followers/index.js b/app/javascript/flavours/glitch/features/followers/index.js index 704e0c92e..c57a2b1a2 100644 --- a/app/javascript/flavours/glitch/features/followers/index.js +++ b/app/javascript/flavours/glitch/features/followers/index.js @@ -64,11 +64,6 @@ export default class Followers extends ImmutablePureComponent { this.props.dispatch(expandFollowers(this.props.params.accountId)); }, 300, { leading: true }); - shouldUpdateScroll = (prevRouterProps, { location }) => { - if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; - return !(location.state && location.state.mastodonModalOpen); - } - setRef = c => { this.column = c; } @@ -102,7 +97,6 @@ export default class Followers extends ImmutablePureComponent { scrollKey='followers' hasMore={hasMore} onLoadMore={this.handleLoadMore} - shouldUpdateScroll={this.shouldUpdateScroll} prepend={} alwaysPrepend emptyMessage={emptyMessage} diff --git a/app/javascript/flavours/glitch/features/following/index.js b/app/javascript/flavours/glitch/features/following/index.js index 46cc773e7..b61f83988 100644 --- a/app/javascript/flavours/glitch/features/following/index.js +++ b/app/javascript/flavours/glitch/features/following/index.js @@ -97,7 +97,6 @@ export default class Following extends ImmutablePureComponent { scrollKey='following' hasMore={hasMore} onLoadMore={this.handleLoadMore} - shouldUpdateScroll={this.shouldUpdateScroll} prepend={} alwaysPrepend emptyMessage={emptyMessage} diff --git a/app/javascript/flavours/glitch/features/mutes/index.js b/app/javascript/flavours/glitch/features/mutes/index.js index 35c15deec..e5b5bb46d 100644 --- a/app/javascript/flavours/glitch/features/mutes/index.js +++ b/app/javascript/flavours/glitch/features/mutes/index.js @@ -41,11 +41,6 @@ export default class Mutes extends ImmutablePureComponent { this.props.dispatch(expandMutes()); }, 300, { leading: true }); - shouldUpdateScroll = (prevRouterProps, { location }) => { - if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; - return !(location.state && location.state.mastodonModalOpen); - } - render () { const { intl, accountIds, hasMore } = this.props; @@ -66,7 +61,6 @@ export default class Mutes extends ImmutablePureComponent { scrollKey='mutes' onLoadMore={this.handleLoadMore} hasMore={hasMore} - shouldUpdateScroll={this.shouldUpdateScroll} emptyMessage={emptyMessage} > {accountIds.map(id => diff --git a/app/javascript/flavours/glitch/features/public_timeline/index.js b/app/javascript/flavours/glitch/features/public_timeline/index.js index 7fe472202..e5f5171aa 100644 --- a/app/javascript/flavours/glitch/features/public_timeline/index.js +++ b/app/javascript/flavours/glitch/features/public_timeline/index.js @@ -99,10 +99,6 @@ export default class PublicTimeline extends React.PureComponent { dispatch(expandPublicTimeline({ maxId, onlyMedia })); } - shouldUpdateScroll = (prevRouterProps, { location }) => { - return !(location.state && location.state.mastodonModalOpen) - } - render () { const { intl, columnId, hasUnread, multiColumn, onlyMedia } = this.props; const pinned = !!columnId; diff --git a/app/javascript/flavours/glitch/features/reblogs/index.js b/app/javascript/flavours/glitch/features/reblogs/index.js index cb1dc5c29..14f44a20a 100644 --- a/app/javascript/flavours/glitch/features/reblogs/index.js +++ b/app/javascript/flavours/glitch/features/reblogs/index.js @@ -40,11 +40,6 @@ export default class Reblogs extends ImmutablePureComponent { } } - shouldUpdateScroll = (prevRouterProps, { location }) => { - if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; - return !(location.state && location.state.mastodonModalOpen); - } - handleHeaderClick = () => { this.column.scrollTop(); } @@ -77,7 +72,6 @@ export default class Reblogs extends ImmutablePureComponent { {accountIds.map(id => -- cgit