@ -41,6 +41,8 @@ export default class Status extends ImmutablePureComponent {
autoPlayGif : PropTypes . bool ,
autoPlayGif : PropTypes . bool ,
muted : PropTypes . bool ,
muted : PropTypes . bool ,
intersectionObserverWrapper : PropTypes . object ,
intersectionObserverWrapper : PropTypes . object ,
index : PropTypes . oneOf ( PropTypes . string , PropTypes . number ) ,
listLength : PropTypes . oneOf ( PropTypes . string , PropTypes . number ) ,
} ;
} ;
state = {
state = {
@ -59,6 +61,7 @@ export default class Status extends ImmutablePureComponent {
'boostModal' ,
'boostModal' ,
'autoPlayGif' ,
'autoPlayGif' ,
'muted' ,
'muted' ,
'listLength' ,
]
]
updateOnStates = [ 'isExpanded' ]
updateOnStates = [ 'isExpanded' ]
@ -67,8 +70,8 @@ export default class Status extends ImmutablePureComponent {
if ( ! nextState . isIntersecting && nextState . isHidden ) {
if ( ! nextState . isIntersecting && nextState . isHidden ) {
// It's only if we're not intersecting (i.e. offscreen) and isHidden is true
// It's only if we're not intersecting (i.e. offscreen) and isHidden is true
// that either "isIntersecting" or "isHidden" matter, and then they're
// that either "isIntersecting" or "isHidden" matter, and then they're
// the only things that matter .
// the only things that matter (and updated ARIA attributes) .
return this . state . isIntersecting || ! this . state . isHidden ;
return this . state . isIntersecting || ! this . state . isHidden || nextProps . listLength !== this . props . listLength ;
} else if ( nextState . isIntersecting && ! this . state . isIntersecting ) {
} else if ( nextState . isIntersecting && ! this . state . isIntersecting ) {
// If we're going from a non-intersecting state to an intersecting state,
// If we're going from a non-intersecting state to an intersecting state,
// (i.e. offscreen to onscreen), then we definitely need to re-render
// (i.e. offscreen to onscreen), then we definitely need to re-render
@ -169,7 +172,7 @@ export default class Status extends ImmutablePureComponent {
// Exclude intersectionObserverWrapper from `other` variable
// Exclude intersectionObserverWrapper from `other` variable
// because intersection is managed in here.
// because intersection is managed in here.
const { status , account , intersectionObserverWrapper , ... other } = this . props ;
const { status , account , intersectionObserverWrapper , index , listLength , ... other } = this . props ;
const { isExpanded , isIntersecting , isHidden } = this . state ;
const { isExpanded , isIntersecting , isHidden } = this . state ;
if ( status === null ) {
if ( status === null ) {
@ -178,10 +181,10 @@ export default class Status extends ImmutablePureComponent {
if ( ! isIntersecting && isHidden ) {
if ( ! isIntersecting && isHidden ) {
return (
return (
< div ref = { this . handleRef } data - id = { status . get ( 'id' ) } style = { { height : ` ${ this . height } px ` , opacity : 0 , overflow : 'hidden' } } >
< article ref = { this . handleRef } data - id = { status . get ( 'id' ) } aria - posinset = { index } aria - setsize = { listLength } style = { { height : ` ${ this . height } px ` , opacity : 0 , overflow : 'hidden' } } >
{ status . getIn ( [ 'account' , 'display_name' ] ) || status . getIn ( [ 'account' , 'username' ] ) }
{ status . getIn ( [ 'account' , 'display_name' ] ) || status . getIn ( [ 'account' , 'username' ] ) }
{ status . get ( 'content' ) }
{ status . get ( 'content' ) }
< / di v >
< / ar t i c l e >
) ;
) ;
}
}
@ -195,14 +198,14 @@ export default class Status extends ImmutablePureComponent {
const displayNameHTML = { _ _html : emojify ( escapeTextContentForBrowser ( displayName ) ) } ;
const displayNameHTML = { _ _html : emojify ( escapeTextContentForBrowser ( displayName ) ) } ;
return (
return (
< div className = 'status__wrapper' ref = { this . handleRef } data - id = { status . get ( 'id' ) } >
< article className = 'status__wrapper' ref = { this . handleRef } data - id = { status . get ( 'id' ) } aria - posinset = { index } aria - setsize = { listLength } >
< div className = 'status__prepend' >
< div className = 'status__prepend' >
< div className = 'status__prepend-icon-wrapper' > < i className = 'fa fa-fw fa-retweet status__prepend-icon' / > < / d i v >
< div className = 'status__prepend-icon-wrapper' > < i className = 'fa fa-fw fa-retweet status__prepend-icon' / > < / d i v >
< FormattedMessage id = 'status.reblogged_by' defaultMessage = '{name} boosted' values = { { name : < a onClick = { this . handleAccountClick } data - id = { status . getIn ( [ 'account' , 'id' ] ) } href = { status . getIn ( [ 'account' , 'url' ] ) } className = 'status__display-name muted' > < strong dangerouslySetInnerHTML = { displayNameHTML } / > < /a> }} / >
< FormattedMessage id = 'status.reblogged_by' defaultMessage = '{name} boosted' values = { { name : < a onClick = { this . handleAccountClick } data - id = { status . getIn ( [ 'account' , 'id' ] ) } href = { status . getIn ( [ 'account' , 'url' ] ) } className = 'status__display-name muted' > < strong dangerouslySetInnerHTML = { displayNameHTML } / > < /a> }} / >
< / d i v >
< / d i v >
< Status { ... other } wrapped status = { status . get ( 'reblog' ) } account = { status . get ( 'account' ) } / >
< Status { ... other } wrapped status = { status . get ( 'reblog' ) } account = { status . get ( 'account' ) } / >
< / di v >
< / ar t i c l e >
) ;
) ;
}
}
@ -231,7 +234,7 @@ export default class Status extends ImmutablePureComponent {
}
}
return (
return (
< div className = { ` status ${ this . props . muted ? 'muted' : '' } status- ${ status . get ( 'visibility' ) } ` } data - id = { status . get ( 'id' ) } ref = { this . handleRef } >
< article aria - posinset = { index } aria - setsize = { listLength } className = { ` status ${ this . props . muted ? 'muted' : '' } status- ${ status . get ( 'visibility' ) } ` } data - id = { status . get ( 'id' ) } ref = { this . handleRef } >
< div className = 'status__info' >
< div className = 'status__info' >
< a href = { status . get ( 'url' ) } className = 'status__relative-time' target = '_blank' rel = 'noopener' > < RelativeTimestamp timestamp = { status . get ( 'created_at' ) } / > < / a >
< a href = { status . get ( 'url' ) } className = 'status__relative-time' target = '_blank' rel = 'noopener' > < RelativeTimestamp timestamp = { status . get ( 'created_at' ) } / > < / a >
@ -249,7 +252,7 @@ export default class Status extends ImmutablePureComponent {
{ media }
{ media }
< StatusActionBar { ... this . props } / >
< StatusActionBar { ... this . props } / >
< / di v >
< / ar t i c l e >
) ;
) ;
}
}