Do not scroll up when modal is opened (#8095)
This commit is contained in:
		
							parent
							
								
									0a3cc246ac
								
							
						
					
					
						commit
						06c83527f5
					
				| @ -1,12 +1,12 @@ | |||||||
| import { debounce } from 'lodash'; | import { debounce } from 'lodash'; | ||||||
| import React from 'react'; | import React from 'react'; | ||||||
|  | import { FormattedMessage } from 'react-intl'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import StatusContainer from '../containers/status_container'; | import StatusContainer from '../containers/status_container'; | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import LoadGap from './load_gap'; | import LoadGap from './load_gap'; | ||||||
| import ScrollableList from './scrollable_list'; | import ScrollableList from './scrollable_list'; | ||||||
| import { FormattedMessage } from 'react-intl'; |  | ||||||
| 
 | 
 | ||||||
| export default class StatusList extends ImmutablePureComponent { | export default class StatusList extends ImmutablePureComponent { | ||||||
| 
 | 
 | ||||||
| @ -71,7 +71,7 @@ export default class StatusList extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { statusIds, featuredStatusIds, onLoadMore, timelineId, ...other }  = this.props; |     const { statusIds, featuredStatusIds, shouldUpdateScroll, onLoadMore, timelineId, ...other }  = this.props; | ||||||
|     const { isLoading, isPartial } = other; |     const { isLoading, isPartial } = other; | ||||||
| 
 | 
 | ||||||
|     if (isPartial) { |     if (isPartial) { | ||||||
| @ -122,7 +122,7 @@ export default class StatusList extends ImmutablePureComponent { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
|       <ScrollableList {...other} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}> |       <ScrollableList {...other} onLoadMore={onLoadMore && this.handleLoadOlder} shouldUpdateScroll={shouldUpdateScroll} ref={this.setRef}> | ||||||
|         {scrollableContent} |         {scrollableContent} | ||||||
|       </ScrollableList> |       </ScrollableList> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -23,6 +23,7 @@ const mapStateToProps = (state, props) => ({ | |||||||
| class LoadMoreMedia extends ImmutablePureComponent { | class LoadMoreMedia extends ImmutablePureComponent { | ||||||
| 
 | 
 | ||||||
|   static propTypes = { |   static propTypes = { | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     maxId: PropTypes.string, |     maxId: PropTypes.string, | ||||||
|     onLoadMore: PropTypes.func.isRequired, |     onLoadMore: PropTypes.func.isRequired, | ||||||
|   }; |   }; | ||||||
| @ -90,7 +91,7 @@ export default class AccountGallery extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { medias, isLoading, hasMore } = this.props; |     const { medias, shouldUpdateScroll, isLoading, hasMore } = this.props; | ||||||
| 
 | 
 | ||||||
|     let loadOlder = null; |     let loadOlder = null; | ||||||
| 
 | 
 | ||||||
| @ -110,7 +111,7 @@ export default class AccountGallery extends ImmutablePureComponent { | |||||||
|       <Column> |       <Column> | ||||||
|         <ColumnBackButton /> |         <ColumnBackButton /> | ||||||
| 
 | 
 | ||||||
|         <ScrollContainer scrollKey='account_gallery'> |         <ScrollContainer scrollKey='account_gallery' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable' onScroll={this.handleScroll}> |           <div className='scrollable' onScroll={this.handleScroll}> | ||||||
|             <HeaderContainer accountId={this.props.params.accountId} /> |             <HeaderContainer accountId={this.props.params.accountId} /> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -29,6 +29,7 @@ export default class AccountTimeline extends ImmutablePureComponent { | |||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     params: PropTypes.object.isRequired, |     params: PropTypes.object.isRequired, | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     statusIds: ImmutablePropTypes.list, |     statusIds: ImmutablePropTypes.list, | ||||||
|     featuredStatusIds: ImmutablePropTypes.list, |     featuredStatusIds: ImmutablePropTypes.list, | ||||||
|     isLoading: PropTypes.bool, |     isLoading: PropTypes.bool, | ||||||
| @ -61,7 +62,7 @@ export default class AccountTimeline extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { statusIds, featuredStatusIds, isLoading, hasMore } = this.props; |     const { shouldUpdateScroll, statusIds, featuredStatusIds, isLoading, hasMore } = this.props; | ||||||
| 
 | 
 | ||||||
|     if (!statusIds && isLoading) { |     if (!statusIds && isLoading) { | ||||||
|       return ( |       return ( | ||||||
| @ -83,6 +84,7 @@ export default class AccountTimeline extends ImmutablePureComponent { | |||||||
|           isLoading={isLoading} |           isLoading={isLoading} | ||||||
|           hasMore={hasMore} |           hasMore={hasMore} | ||||||
|           onLoadMore={this.handleLoadMore} |           onLoadMore={this.handleLoadMore} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -1,5 +1,7 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
|  | import { defineMessages, injectIntl } from 'react-intl'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| @ -8,8 +10,6 @@ import Column from '../ui/components/column'; | |||||||
| import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | ||||||
| import AccountContainer from '../../containers/account_container'; | import AccountContainer from '../../containers/account_container'; | ||||||
| import { fetchBlocks, expandBlocks } from '../../actions/blocks'; | import { fetchBlocks, expandBlocks } from '../../actions/blocks'; | ||||||
| import { defineMessages, injectIntl } from 'react-intl'; |  | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| 
 | 
 | ||||||
| const messages = defineMessages({ | const messages = defineMessages({ | ||||||
|   heading: { id: 'column.blocks', defaultMessage: 'Blocked users' }, |   heading: { id: 'column.blocks', defaultMessage: 'Blocked users' }, | ||||||
| @ -26,6 +26,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, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     accountIds: ImmutablePropTypes.list, |     accountIds: ImmutablePropTypes.list, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|   }; |   }; | ||||||
| @ -43,7 +44,7 @@ export default class Blocks extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, accountIds } = this.props; |     const { intl, accountIds, shouldUpdateScroll } = this.props; | ||||||
| 
 | 
 | ||||||
|     if (!accountIds) { |     if (!accountIds) { | ||||||
|       return ( |       return ( | ||||||
| @ -56,7 +57,7 @@ export default class Blocks extends ImmutablePureComponent { | |||||||
|     return ( |     return ( | ||||||
|       <Column icon='ban' heading={intl.formatMessage(messages.heading)}> |       <Column icon='ban' heading={intl.formatMessage(messages.heading)}> | ||||||
|         <ColumnBackButtonSlim /> |         <ColumnBackButtonSlim /> | ||||||
|         <ScrollContainer scrollKey='blocks'> |         <ScrollContainer scrollKey='blocks' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable' onScroll={this.handleScroll}> |           <div className='scrollable' onScroll={this.handleScroll}> | ||||||
|             {accountIds.map(id => |             {accountIds.map(id => | ||||||
|               <AccountContainer key={id} id={id} /> |               <AccountContainer key={id} id={id} /> | ||||||
|  | |||||||
| @ -39,6 +39,7 @@ export default class CommunityTimeline extends React.PureComponent { | |||||||
| 
 | 
 | ||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     columnId: PropTypes.string, |     columnId: PropTypes.string, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|     hasUnread: PropTypes.bool, |     hasUnread: PropTypes.bool, | ||||||
| @ -100,7 +101,7 @@ export default class CommunityTimeline extends React.PureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, hasUnread, columnId, multiColumn, onlyMedia } = this.props; |     const { intl, shouldUpdateScroll, hasUnread, columnId, multiColumn, onlyMedia } = this.props; | ||||||
|     const pinned = !!columnId; |     const pinned = !!columnId; | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
| @ -124,6 +125,7 @@ export default class CommunityTimeline extends React.PureComponent { | |||||||
|           timelineId={`community${onlyMedia ? ':media' : ''}`} |           timelineId={`community${onlyMedia ? ':media' : ''}`} | ||||||
|           onLoadMore={this.handleLoadMore} |           onLoadMore={this.handleLoadMore} | ||||||
|           emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The local timeline is empty. Write something publicly to get the ball rolling!' />} |           emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The local timeline is empty. Write something publicly to get the ball rolling!' />} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -23,6 +23,7 @@ export default class DirectTimeline extends React.PureComponent { | |||||||
| 
 | 
 | ||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     columnId: PropTypes.string, |     columnId: PropTypes.string, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|     hasUnread: PropTypes.bool, |     hasUnread: PropTypes.bool, | ||||||
| @ -71,7 +72,7 @@ export default class DirectTimeline extends React.PureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, hasUnread, columnId, multiColumn } = this.props; |     const { intl, shouldUpdateScroll, hasUnread, columnId, multiColumn } = this.props; | ||||||
|     const pinned = !!columnId; |     const pinned = !!columnId; | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
| @ -93,6 +94,7 @@ export default class DirectTimeline extends React.PureComponent { | |||||||
|           timelineId='direct' |           timelineId='direct' | ||||||
|           onLoadMore={this.handleLoadMore} |           onLoadMore={this.handleLoadMore} | ||||||
|           emptyMessage={<FormattedMessage id='empty_column.direct' defaultMessage="You don't have any direct messages yet. When you send or receive one, it will show up here." />} |           emptyMessage={<FormattedMessage id='empty_column.direct' defaultMessage="You don't have any direct messages yet. When you send or receive one, it will show up here." />} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -1,15 +1,15 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import { defineMessages, injectIntl } from 'react-intl'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
|  | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
|  | import { debounce } from 'lodash'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| import Column from '../ui/components/column'; | import Column from '../ui/components/column'; | ||||||
| import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | ||||||
| import DomainContainer from '../../containers/domain_container'; | import DomainContainer from '../../containers/domain_container'; | ||||||
| import { fetchDomainBlocks, expandDomainBlocks } from '../../actions/domain_blocks'; | import { fetchDomainBlocks, expandDomainBlocks } from '../../actions/domain_blocks'; | ||||||
| import { defineMessages, injectIntl } from 'react-intl'; |  | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| import { debounce } from 'lodash'; |  | ||||||
| import ScrollableList from '../../components/scrollable_list'; | import ScrollableList from '../../components/scrollable_list'; | ||||||
| 
 | 
 | ||||||
| const messages = defineMessages({ | const messages = defineMessages({ | ||||||
| @ -28,6 +28,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, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     domains: ImmutablePropTypes.orderedSet, |     domains: ImmutablePropTypes.orderedSet, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|   }; |   }; | ||||||
| @ -41,7 +42,7 @@ export default class Blocks extends ImmutablePureComponent { | |||||||
|   }, 300, { leading: true }); |   }, 300, { leading: true }); | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, domains } = this.props; |     const { intl, domains, shouldUpdateScroll } = this.props; | ||||||
| 
 | 
 | ||||||
|     if (!domains) { |     if (!domains) { | ||||||
|       return ( |       return ( | ||||||
| @ -54,7 +55,7 @@ export default class Blocks extends ImmutablePureComponent { | |||||||
|     return ( |     return ( | ||||||
|       <Column icon='minus-circle' heading={intl.formatMessage(messages.heading)}> |       <Column icon='minus-circle' heading={intl.formatMessage(messages.heading)}> | ||||||
|         <ColumnBackButtonSlim /> |         <ColumnBackButtonSlim /> | ||||||
|         <ScrollableList scrollKey='domain_blocks' onLoadMore={this.handleLoadMore}> |         <ScrollableList scrollKey='domain_blocks' onLoadMore={this.handleLoadMore} shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           {domains.map(domain => |           {domains.map(domain => | ||||||
|             <DomainContainer key={domain} domain={domain} /> |             <DomainContainer key={domain} domain={domain} /> | ||||||
|           )} |           )} | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ export default class Favourites extends ImmutablePureComponent { | |||||||
| 
 | 
 | ||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     statusIds: ImmutablePropTypes.list.isRequired, |     statusIds: ImmutablePropTypes.list.isRequired, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|     columnId: PropTypes.string, |     columnId: PropTypes.string, | ||||||
| @ -67,7 +68,7 @@ export default class Favourites extends ImmutablePureComponent { | |||||||
|   }, 300, { leading: true }) |   }, 300, { leading: true }) | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props; |     const { intl, shouldUpdateScroll, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props; | ||||||
|     const pinned = !!columnId; |     const pinned = !!columnId; | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
| @ -90,6 +91,7 @@ export default class Favourites extends ImmutablePureComponent { | |||||||
|           hasMore={hasMore} |           hasMore={hasMore} | ||||||
|           isLoading={isLoading} |           isLoading={isLoading} | ||||||
|           onLoadMore={this.handleLoadMore} |           onLoadMore={this.handleLoadMore} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| @ -8,7 +9,6 @@ import { ScrollContainer } from 'react-router-scroll-4'; | |||||||
| import AccountContainer from '../../containers/account_container'; | import AccountContainer from '../../containers/account_container'; | ||||||
| import Column from '../ui/components/column'; | import Column from '../ui/components/column'; | ||||||
| import ColumnBackButton from '../../components/column_back_button'; | import ColumnBackButton from '../../components/column_back_button'; | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| 
 | 
 | ||||||
| const mapStateToProps = (state, props) => ({ | const mapStateToProps = (state, props) => ({ | ||||||
|   accountIds: state.getIn(['user_lists', 'favourited_by', props.params.statusId]), |   accountIds: state.getIn(['user_lists', 'favourited_by', props.params.statusId]), | ||||||
| @ -20,6 +20,7 @@ export default class Favourites extends ImmutablePureComponent { | |||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     params: PropTypes.object.isRequired, |     params: PropTypes.object.isRequired, | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     accountIds: ImmutablePropTypes.list, |     accountIds: ImmutablePropTypes.list, | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
| @ -34,7 +35,7 @@ export default class Favourites extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { accountIds } = this.props; |     const { shouldUpdateScroll, accountIds } = this.props; | ||||||
| 
 | 
 | ||||||
|     if (!accountIds) { |     if (!accountIds) { | ||||||
|       return ( |       return ( | ||||||
| @ -48,7 +49,7 @@ export default class Favourites extends ImmutablePureComponent { | |||||||
|       <Column> |       <Column> | ||||||
|         <ColumnBackButton /> |         <ColumnBackButton /> | ||||||
| 
 | 
 | ||||||
|         <ScrollContainer scrollKey='favourites'> |         <ScrollContainer scrollKey='favourites' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable'> |           <div className='scrollable'> | ||||||
|             {accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)} |             {accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)} | ||||||
|           </div> |           </div> | ||||||
|  | |||||||
| @ -1,5 +1,7 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
|  | import { defineMessages, injectIntl } from 'react-intl'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| @ -8,8 +10,6 @@ import Column from '../ui/components/column'; | |||||||
| import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | ||||||
| import AccountAuthorizeContainer from './containers/account_authorize_container'; | import AccountAuthorizeContainer from './containers/account_authorize_container'; | ||||||
| import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts'; | import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts'; | ||||||
| import { defineMessages, injectIntl } from 'react-intl'; |  | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| 
 | 
 | ||||||
| const messages = defineMessages({ | const messages = defineMessages({ | ||||||
|   heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' }, |   heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' }, | ||||||
| @ -26,6 +26,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, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     accountIds: ImmutablePropTypes.list, |     accountIds: ImmutablePropTypes.list, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|   }; |   }; | ||||||
| @ -43,7 +44,7 @@ export default class FollowRequests extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, accountIds } = this.props; |     const { intl, shouldUpdateScroll, accountIds } = this.props; | ||||||
| 
 | 
 | ||||||
|     if (!accountIds) { |     if (!accountIds) { | ||||||
|       return ( |       return ( | ||||||
| @ -57,7 +58,7 @@ export default class FollowRequests extends ImmutablePureComponent { | |||||||
|       <Column icon='users' heading={intl.formatMessage(messages.heading)}> |       <Column icon='users' heading={intl.formatMessage(messages.heading)}> | ||||||
|         <ColumnBackButtonSlim /> |         <ColumnBackButtonSlim /> | ||||||
| 
 | 
 | ||||||
|         <ScrollContainer scrollKey='follow_requests'> |         <ScrollContainer scrollKey='follow_requests' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable' onScroll={this.handleScroll}> |           <div className='scrollable' onScroll={this.handleScroll}> | ||||||
|             {accountIds.map(id => |             {accountIds.map(id => | ||||||
|               <AccountAuthorizeContainer key={id} id={id} /> |               <AccountAuthorizeContainer key={id} id={id} /> | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| @ -14,7 +15,6 @@ import Column from '../ui/components/column'; | |||||||
| import HeaderContainer from '../account_timeline/containers/header_container'; | import HeaderContainer from '../account_timeline/containers/header_container'; | ||||||
| import LoadMore from '../../components/load_more'; | import LoadMore from '../../components/load_more'; | ||||||
| import ColumnBackButton from '../../components/column_back_button'; | import ColumnBackButton from '../../components/column_back_button'; | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| 
 | 
 | ||||||
| const mapStateToProps = (state, props) => ({ | const mapStateToProps = (state, props) => ({ | ||||||
|   accountIds: state.getIn(['user_lists', 'followers', props.params.accountId, 'items']), |   accountIds: state.getIn(['user_lists', 'followers', props.params.accountId, 'items']), | ||||||
| @ -27,6 +27,7 @@ export default class Followers extends ImmutablePureComponent { | |||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     params: PropTypes.object.isRequired, |     params: PropTypes.object.isRequired, | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     accountIds: ImmutablePropTypes.list, |     accountIds: ImmutablePropTypes.list, | ||||||
|     hasMore: PropTypes.bool, |     hasMore: PropTypes.bool, | ||||||
|   }; |   }; | ||||||
| @ -57,7 +58,7 @@ export default class Followers extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { accountIds, hasMore } = this.props; |     const { shouldUpdateScroll, accountIds, hasMore } = this.props; | ||||||
| 
 | 
 | ||||||
|     let loadMore = null; |     let loadMore = null; | ||||||
| 
 | 
 | ||||||
| @ -77,7 +78,7 @@ export default class Followers extends ImmutablePureComponent { | |||||||
|       <Column> |       <Column> | ||||||
|         <ColumnBackButton /> |         <ColumnBackButton /> | ||||||
| 
 | 
 | ||||||
|         <ScrollContainer scrollKey='followers'> |         <ScrollContainer scrollKey='followers' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable' onScroll={this.handleScroll}> |           <div className='scrollable' onScroll={this.handleScroll}> | ||||||
|             <div className='followers'> |             <div className='followers'> | ||||||
|               <HeaderContainer accountId={this.props.params.accountId} hideTabs /> |               <HeaderContainer accountId={this.props.params.accountId} hideTabs /> | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| @ -14,7 +15,6 @@ import Column from '../ui/components/column'; | |||||||
| import HeaderContainer from '../account_timeline/containers/header_container'; | import HeaderContainer from '../account_timeline/containers/header_container'; | ||||||
| import LoadMore from '../../components/load_more'; | import LoadMore from '../../components/load_more'; | ||||||
| import ColumnBackButton from '../../components/column_back_button'; | import ColumnBackButton from '../../components/column_back_button'; | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| 
 | 
 | ||||||
| const mapStateToProps = (state, props) => ({ | const mapStateToProps = (state, props) => ({ | ||||||
|   accountIds: state.getIn(['user_lists', 'following', props.params.accountId, 'items']), |   accountIds: state.getIn(['user_lists', 'following', props.params.accountId, 'items']), | ||||||
| @ -27,6 +27,7 @@ export default class Following extends ImmutablePureComponent { | |||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     params: PropTypes.object.isRequired, |     params: PropTypes.object.isRequired, | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     accountIds: ImmutablePropTypes.list, |     accountIds: ImmutablePropTypes.list, | ||||||
|     hasMore: PropTypes.bool, |     hasMore: PropTypes.bool, | ||||||
|   }; |   }; | ||||||
| @ -57,7 +58,7 @@ export default class Following extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { accountIds, hasMore } = this.props; |     const { shouldUpdateScroll, accountIds, hasMore } = this.props; | ||||||
| 
 | 
 | ||||||
|     let loadMore = null; |     let loadMore = null; | ||||||
| 
 | 
 | ||||||
| @ -77,7 +78,7 @@ export default class Following extends ImmutablePureComponent { | |||||||
|       <Column> |       <Column> | ||||||
|         <ColumnBackButton /> |         <ColumnBackButton /> | ||||||
| 
 | 
 | ||||||
|         <ScrollContainer scrollKey='following'> |         <ScrollContainer scrollKey='following' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable' onScroll={this.handleScroll}> |           <div className='scrollable' onScroll={this.handleScroll}> | ||||||
|             <div className='following'> |             <div className='following'> | ||||||
|               <HeaderContainer accountId={this.props.params.accountId} hideTabs /> |               <HeaderContainer accountId={this.props.params.accountId} hideTabs /> | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ export default class HashtagTimeline extends React.PureComponent { | |||||||
|     params: PropTypes.object.isRequired, |     params: PropTypes.object.isRequired, | ||||||
|     columnId: PropTypes.string, |     columnId: PropTypes.string, | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     hasUnread: PropTypes.bool, |     hasUnread: PropTypes.bool, | ||||||
|     multiColumn: PropTypes.bool, |     multiColumn: PropTypes.bool, | ||||||
|   }; |   }; | ||||||
| @ -83,7 +84,7 @@ export default class HashtagTimeline extends React.PureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { hasUnread, columnId, multiColumn } = this.props; |     const { shouldUpdateScroll, hasUnread, columnId, multiColumn } = this.props; | ||||||
|     const { id } = this.props.params; |     const { id } = this.props.params; | ||||||
|     const pinned = !!columnId; |     const pinned = !!columnId; | ||||||
| 
 | 
 | ||||||
| @ -107,6 +108,7 @@ export default class HashtagTimeline extends React.PureComponent { | |||||||
|           timelineId={`hashtag:${id}`} |           timelineId={`hashtag:${id}`} | ||||||
|           onLoadMore={this.handleLoadMore} |           onLoadMore={this.handleLoadMore} | ||||||
|           emptyMessage={<FormattedMessage id='empty_column.hashtag' defaultMessage='There is nothing in this hashtag yet.' />} |           emptyMessage={<FormattedMessage id='empty_column.hashtag' defaultMessage='There is nothing in this hashtag yet.' />} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -25,6 +25,7 @@ export default class HomeTimeline extends React.PureComponent { | |||||||
| 
 | 
 | ||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|     hasUnread: PropTypes.bool, |     hasUnread: PropTypes.bool, | ||||||
|     isPartial: PropTypes.bool, |     isPartial: PropTypes.bool, | ||||||
| @ -93,7 +94,7 @@ export default class HomeTimeline extends React.PureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, hasUnread, columnId, multiColumn } = this.props; |     const { intl, shouldUpdateScroll, hasUnread, columnId, multiColumn } = this.props; | ||||||
|     const pinned = !!columnId; |     const pinned = !!columnId; | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
| @ -117,6 +118,7 @@ export default class HomeTimeline extends React.PureComponent { | |||||||
|           onLoadMore={this.handleLoadMore} |           onLoadMore={this.handleLoadMore} | ||||||
|           timelineId='home' |           timelineId='home' | ||||||
|           emptyMessage={<FormattedMessage id='empty_column.home' defaultMessage='Your home timeline is empty! Visit {public} or use search to get started and meet other users.' values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />} |           emptyMessage={<FormattedMessage id='empty_column.home' defaultMessage='Your home timeline is empty! Visit {public} or use search to get started and meet other users.' values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -35,6 +35,7 @@ export default class ListTimeline extends React.PureComponent { | |||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     params: PropTypes.object.isRequired, |     params: PropTypes.object.isRequired, | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     columnId: PropTypes.string, |     columnId: PropTypes.string, | ||||||
|     hasUnread: PropTypes.bool, |     hasUnread: PropTypes.bool, | ||||||
|     multiColumn: PropTypes.bool, |     multiColumn: PropTypes.bool, | ||||||
| @ -112,7 +113,7 @@ export default class ListTimeline extends React.PureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { hasUnread, columnId, multiColumn, list } = this.props; |     const { shouldUpdateScroll, hasUnread, columnId, multiColumn, list } = this.props; | ||||||
|     const { id } = this.props.params; |     const { id } = this.props.params; | ||||||
|     const pinned = !!columnId; |     const pinned = !!columnId; | ||||||
|     const title  = list ? list.get('title') : id; |     const title  = list ? list.get('title') : id; | ||||||
| @ -166,6 +167,7 @@ export default class ListTimeline extends React.PureComponent { | |||||||
|           timelineId={`list:${id}`} |           timelineId={`list:${id}`} | ||||||
|           onLoadMore={this.handleLoadMore} |           onLoadMore={this.handleLoadMore} | ||||||
|           emptyMessage={<FormattedMessage id='empty_column.list' defaultMessage='There is nothing in this list yet. When members of this list post new statuses, they will appear here.' />} |           emptyMessage={<FormattedMessage id='empty_column.list' defaultMessage='There is nothing in this list yet. When members of this list post new statuses, they will appear here.' />} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -1,5 +1,7 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
|  | import { defineMessages, injectIntl } from 'react-intl'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| @ -8,8 +10,6 @@ import Column from '../ui/components/column'; | |||||||
| import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | ||||||
| import AccountContainer from '../../containers/account_container'; | import AccountContainer from '../../containers/account_container'; | ||||||
| import { fetchMutes, expandMutes } from '../../actions/mutes'; | import { fetchMutes, expandMutes } from '../../actions/mutes'; | ||||||
| import { defineMessages, injectIntl } from 'react-intl'; |  | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| 
 | 
 | ||||||
| const messages = defineMessages({ | const messages = defineMessages({ | ||||||
|   heading: { id: 'column.mutes', defaultMessage: 'Muted users' }, |   heading: { id: 'column.mutes', defaultMessage: 'Muted users' }, | ||||||
| @ -26,6 +26,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, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     accountIds: ImmutablePropTypes.list, |     accountIds: ImmutablePropTypes.list, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|   }; |   }; | ||||||
| @ -43,7 +44,7 @@ export default class Mutes extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, accountIds } = this.props; |     const { intl, shouldUpdateScroll, accountIds } = this.props; | ||||||
| 
 | 
 | ||||||
|     if (!accountIds) { |     if (!accountIds) { | ||||||
|       return ( |       return ( | ||||||
| @ -56,7 +57,7 @@ export default class Mutes extends ImmutablePureComponent { | |||||||
|     return ( |     return ( | ||||||
|       <Column icon='volume-off' heading={intl.formatMessage(messages.heading)}> |       <Column icon='volume-off' heading={intl.formatMessage(messages.heading)}> | ||||||
|         <ColumnBackButtonSlim /> |         <ColumnBackButtonSlim /> | ||||||
|         <ScrollContainer scrollKey='mutes'> |         <ScrollContainer scrollKey='mutes' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable mutes' onScroll={this.handleScroll}> |           <div className='scrollable mutes' onScroll={this.handleScroll}> | ||||||
|             {accountIds.map(id => |             {accountIds.map(id => | ||||||
|               <AccountContainer key={id} id={id} /> |               <AccountContainer key={id} id={id} /> | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ export default class PinnedStatuses extends ImmutablePureComponent { | |||||||
| 
 | 
 | ||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     statusIds: ImmutablePropTypes.list.isRequired, |     statusIds: ImmutablePropTypes.list.isRequired, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|     hasMore: PropTypes.bool.isRequired, |     hasMore: PropTypes.bool.isRequired, | ||||||
| @ -42,7 +43,7 @@ export default class PinnedStatuses extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, statusIds, hasMore } = this.props; |     const { intl, shouldUpdateScroll, statusIds, hasMore } = this.props; | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
|       <Column icon='thumb-tack' heading={intl.formatMessage(messages.heading)} ref={this.setRef}> |       <Column icon='thumb-tack' heading={intl.formatMessage(messages.heading)} ref={this.setRef}> | ||||||
| @ -51,6 +52,7 @@ export default class PinnedStatuses extends ImmutablePureComponent { | |||||||
|           statusIds={statusIds} |           statusIds={statusIds} | ||||||
|           scrollKey='pinned_statuses' |           scrollKey='pinned_statuses' | ||||||
|           hasMore={hasMore} |           hasMore={hasMore} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -39,6 +39,7 @@ export default class PublicTimeline extends React.PureComponent { | |||||||
| 
 | 
 | ||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     intl: PropTypes.object.isRequired, |     intl: PropTypes.object.isRequired, | ||||||
|     columnId: PropTypes.string, |     columnId: PropTypes.string, | ||||||
|     multiColumn: PropTypes.bool, |     multiColumn: PropTypes.bool, | ||||||
| @ -107,7 +108,7 @@ export default class PublicTimeline extends React.PureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, columnId, hasUnread, multiColumn, onlyMedia } = this.props; |     const { intl, shouldUpdateScroll, columnId, hasUnread, multiColumn, onlyMedia } = this.props; | ||||||
|     const pinned = !!columnId; |     const pinned = !!columnId; | ||||||
| 
 | 
 | ||||||
|     return ( |     return ( | ||||||
| @ -131,6 +132,7 @@ export default class PublicTimeline extends React.PureComponent { | |||||||
|           trackScroll={!pinned} |           trackScroll={!pinned} | ||||||
|           scrollKey={`public_timeline-${columnId}`} |           scrollKey={`public_timeline-${columnId}`} | ||||||
|           emptyMessage={<FormattedMessage id='empty_column.public' defaultMessage='There is nothing here! Write something publicly, or manually follow users from other instances to fill it up' />} |           emptyMessage={<FormattedMessage id='empty_column.public' defaultMessage='There is nothing here! Write something publicly, or manually follow users from other instances to fill it up' />} | ||||||
|  |           shouldUpdateScroll={shouldUpdateScroll} | ||||||
|         /> |         /> | ||||||
|       </Column> |       </Column> | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { connect } from 'react-redux'; | import { connect } from 'react-redux'; | ||||||
|  | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
| import ImmutablePropTypes from 'react-immutable-proptypes'; | import ImmutablePropTypes from 'react-immutable-proptypes'; | ||||||
| import LoadingIndicator from '../../components/loading_indicator'; | import LoadingIndicator from '../../components/loading_indicator'; | ||||||
| @ -8,7 +9,6 @@ import { ScrollContainer } from 'react-router-scroll-4'; | |||||||
| import AccountContainer from '../../containers/account_container'; | import AccountContainer from '../../containers/account_container'; | ||||||
| import Column from '../ui/components/column'; | import Column from '../ui/components/column'; | ||||||
| import ColumnBackButton from '../../components/column_back_button'; | import ColumnBackButton from '../../components/column_back_button'; | ||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; |  | ||||||
| 
 | 
 | ||||||
| const mapStateToProps = (state, props) => ({ | const mapStateToProps = (state, props) => ({ | ||||||
|   accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]), |   accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]), | ||||||
| @ -20,6 +20,7 @@ export default class Reblogs extends ImmutablePureComponent { | |||||||
|   static propTypes = { |   static propTypes = { | ||||||
|     params: PropTypes.object.isRequired, |     params: PropTypes.object.isRequired, | ||||||
|     dispatch: PropTypes.func.isRequired, |     dispatch: PropTypes.func.isRequired, | ||||||
|  |     shouldUpdateScroll: PropTypes.func, | ||||||
|     accountIds: ImmutablePropTypes.list, |     accountIds: ImmutablePropTypes.list, | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
| @ -34,7 +35,7 @@ export default class Reblogs extends ImmutablePureComponent { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { accountIds } = this.props; |     const { shouldUpdateScroll, accountIds } = this.props; | ||||||
| 
 | 
 | ||||||
|     if (!accountIds) { |     if (!accountIds) { | ||||||
|       return ( |       return ( | ||||||
| @ -48,7 +49,7 @@ export default class Reblogs extends ImmutablePureComponent { | |||||||
|       <Column> |       <Column> | ||||||
|         <ColumnBackButton /> |         <ColumnBackButton /> | ||||||
| 
 | 
 | ||||||
|         <ScrollContainer scrollKey='reblogs'> |         <ScrollContainer scrollKey='reblogs' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className='scrollable reblogs'> |           <div className='scrollable reblogs'> | ||||||
|             {accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)} |             {accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)} | ||||||
|           </div> |           </div> | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; | |||||||
| import ImmutablePureComponent from 'react-immutable-pure-component'; | import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||||
| import { HotKeys } from 'react-hotkeys'; | import { HotKeys } from 'react-hotkeys'; | ||||||
| import { boostModal, deleteModal } from '../../initial_state'; | import { boostModal, deleteModal } from '../../initial_state'; | ||||||
| import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../../features/ui/util/fullscreen'; | import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; | ||||||
| 
 | 
 | ||||||
| const messages = defineMessages({ | const messages = defineMessages({ | ||||||
|   deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, |   deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, | ||||||
| @ -370,7 +370,7 @@ export default class Status extends ImmutablePureComponent { | |||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     let ancestors, descendants; |     let ancestors, descendants; | ||||||
|     const { status, ancestorsIds, descendantsIds, intl } = this.props; |     const { shouldUpdateScroll, status, ancestorsIds, descendantsIds, intl } = this.props; | ||||||
|     const { fullscreen } = this.state; |     const { fullscreen } = this.state; | ||||||
| 
 | 
 | ||||||
|     if (status === null) { |     if (status === null) { | ||||||
| @ -410,7 +410,7 @@ export default class Status extends ImmutablePureComponent { | |||||||
|           )} |           )} | ||||||
|         /> |         /> | ||||||
| 
 | 
 | ||||||
|         <ScrollContainer scrollKey='thread'> |         <ScrollContainer scrollKey='thread' shouldUpdateScroll={shouldUpdateScroll}> | ||||||
|           <div className={classNames('scrollable', 'detailed-status__wrapper', { fullscreen })} ref={this.setRef}> |           <div className={classNames('scrollable', 'detailed-status__wrapper', { fullscreen })} ref={this.setRef}> | ||||||
|             {ancestors} |             {ancestors} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ const messages = defineMessages({ | |||||||
|   next: { id: 'lightbox.next', defaultMessage: 'Next' }, |   next: { id: 'lightbox.next', defaultMessage: 'Next' }, | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| const previewState = 'previewMediaModal'; | export const previewState = 'previewMediaModal'; | ||||||
| 
 | 
 | ||||||
| @injectIntl | @injectIntl | ||||||
| export default class MediaModal extends ImmutablePureComponent { | export default class MediaModal extends ImmutablePureComponent { | ||||||
|  | |||||||
| @ -1,12 +1,14 @@ | |||||||
| import classNames from 'classnames'; | import classNames from 'classnames'; | ||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import NotificationsContainer from './containers/notifications_container'; | import { HotKeys } from 'react-hotkeys'; | ||||||
|  | import { defineMessages, injectIntl } from 'react-intl'; | ||||||
|  | import { connect } from 'react-redux'; | ||||||
|  | import { Redirect, withRouter } from 'react-router-dom'; | ||||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||||
|  | import NotificationsContainer from './containers/notifications_container'; | ||||||
| import LoadingBarContainer from './containers/loading_bar_container'; | import LoadingBarContainer from './containers/loading_bar_container'; | ||||||
| import TabsBar from './components/tabs_bar'; | import TabsBar from './components/tabs_bar'; | ||||||
| import ModalContainer from './containers/modal_container'; | import ModalContainer from './containers/modal_container'; | ||||||
| import { connect } from 'react-redux'; |  | ||||||
| import { Redirect, withRouter } from 'react-router-dom'; |  | ||||||
| import { isMobile } from '../../is_mobile'; | import { isMobile } from '../../is_mobile'; | ||||||
| import { debounce } from 'lodash'; | import { debounce } from 'lodash'; | ||||||
| import { uploadCompose, resetCompose } from '../../actions/compose'; | import { uploadCompose, resetCompose } from '../../actions/compose'; | ||||||
| @ -44,9 +46,8 @@ import { | |||||||
|   PinnedStatuses, |   PinnedStatuses, | ||||||
|   Lists, |   Lists, | ||||||
| } from './util/async-components'; | } from './util/async-components'; | ||||||
| import { HotKeys } from 'react-hotkeys'; |  | ||||||
| import { me } from '../../initial_state'; | import { me } from '../../initial_state'; | ||||||
| import { defineMessages, injectIntl } from 'react-intl'; | import { previewState } from './components/media_modal'; | ||||||
| 
 | 
 | ||||||
| // Dummy import, to make sure that <Status /> ends up in the application bundle.
 | // Dummy import, to make sure that <Status /> ends up in the application bundle.
 | ||||||
| // Without this it ends up in ~8 very commonly used bundles.
 | // Without this it ends up in ~8 very commonly used bundles.
 | ||||||
| @ -117,6 +118,10 @@ class SwitchingColumnsArea extends React.PureComponent { | |||||||
|     window.removeEventListener('resize', this.handleResize); |     window.removeEventListener('resize', this.handleResize); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   shouldUpdateScroll (_, { location }) { | ||||||
|  |     return location.state !== previewState; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   handleResize = debounce(() => { |   handleResize = debounce(() => { | ||||||
|     // The cached heights are no longer accurate, invalidate
 |     // The cached heights are no longer accurate, invalidate
 | ||||||
|     this.props.onLayoutChange(); |     this.props.onLayoutChange(); | ||||||
| @ -141,36 +146,36 @@ class SwitchingColumnsArea extends React.PureComponent { | |||||||
|           {redirect} |           {redirect} | ||||||
|           <WrappedRoute path='/getting-started' component={GettingStarted} content={children} /> |           <WrappedRoute path='/getting-started' component={GettingStarted} content={children} /> | ||||||
|           <WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} /> |           <WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} /> | ||||||
|           <WrappedRoute path='/timelines/home' component={HomeTimeline} content={children} /> |           <WrappedRoute path='/timelines/home' component={HomeTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/timelines/public' exact component={PublicTimeline} content={children} /> |           <WrappedRoute path='/timelines/public' exact component={PublicTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/timelines/public/media' component={PublicTimeline} content={children} componentParams={{ onlyMedia: true }} /> |           <WrappedRoute path='/timelines/public/media' component={PublicTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll, onlyMedia: true }} /> | ||||||
|           <WrappedRoute path='/timelines/public/local' exact component={CommunityTimeline} content={children} /> |           <WrappedRoute path='/timelines/public/local' exact component={CommunityTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/timelines/public/local/media' component={CommunityTimeline} content={children} componentParams={{ onlyMedia: true }} /> |           <WrappedRoute path='/timelines/public/local/media' component={CommunityTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll, onlyMedia: true }} /> | ||||||
|           <WrappedRoute path='/timelines/direct' component={DirectTimeline} content={children} /> |           <WrappedRoute path='/timelines/direct' component={DirectTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/timelines/tag/:id' component={HashtagTimeline} content={children} /> |           <WrappedRoute path='/timelines/tag/:id' component={HashtagTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/timelines/list/:id' component={ListTimeline} content={children} /> |           <WrappedRoute path='/timelines/list/:id' component={ListTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
| 
 | 
 | ||||||
|           <WrappedRoute path='/notifications' component={Notifications} content={children} /> |           <WrappedRoute path='/notifications' component={Notifications} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/favourites' component={FavouritedStatuses} content={children} /> |           <WrappedRoute path='/favourites' component={FavouritedStatuses} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/pinned' component={PinnedStatuses} content={children} /> |           <WrappedRoute path='/pinned' component={PinnedStatuses} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
| 
 | 
 | ||||||
|           <WrappedRoute path='/search' component={Compose} content={children} componentParams={{ isSearchPage: true }} /> |           <WrappedRoute path='/search' component={Compose} content={children} componentParams={{ isSearchPage: true }} /> | ||||||
| 
 | 
 | ||||||
|           <WrappedRoute path='/statuses/new' component={Compose} content={children} /> |           <WrappedRoute path='/statuses/new' component={Compose} content={children} /> | ||||||
|           <WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} /> |           <WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/statuses/:statusId/reblogs' component={Reblogs} content={children} /> |           <WrappedRoute path='/statuses/:statusId/reblogs' component={Reblogs} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/statuses/:statusId/favourites' component={Favourites} content={children} /> |           <WrappedRoute path='/statuses/:statusId/favourites' component={Favourites} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
| 
 | 
 | ||||||
|           <WrappedRoute path='/accounts/:accountId' exact component={AccountTimeline} content={children} /> |           <WrappedRoute path='/accounts/:accountId' exact component={AccountTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/accounts/:accountId/with_replies' component={AccountTimeline} content={children} componentParams={{ withReplies: true }} /> |           <WrappedRoute path='/accounts/:accountId/with_replies' component={AccountTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll, withReplies: true }} /> | ||||||
|           <WrappedRoute path='/accounts/:accountId/followers' component={Followers} content={children} /> |           <WrappedRoute path='/accounts/:accountId/followers' component={Followers} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/accounts/:accountId/following' component={Following} content={children} /> |           <WrappedRoute path='/accounts/:accountId/following' component={Following} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/accounts/:accountId/media' component={AccountGallery} content={children} /> |           <WrappedRoute path='/accounts/:accountId/media' component={AccountGallery} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
| 
 | 
 | ||||||
|           <WrappedRoute path='/follow_requests' component={FollowRequests} content={children} /> |           <WrappedRoute path='/follow_requests' component={FollowRequests} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/blocks' component={Blocks} content={children} /> |           <WrappedRoute path='/blocks' component={Blocks} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/domain_blocks' component={DomainBlocks} content={children} /> |           <WrappedRoute path='/domain_blocks' component={DomainBlocks} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/mutes' component={Mutes} content={children} /> |           <WrappedRoute path='/mutes' component={Mutes} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> | ||||||
|           <WrappedRoute path='/lists' component={Lists} content={children} /> |           <WrappedRoute path='/lists' component={Lists} content={children} /> | ||||||
| 
 | 
 | ||||||
|           <WrappedRoute component={GenericNotFound} content={children} /> |           <WrappedRoute component={GenericNotFound} content={children} /> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user