@ -195,6 +195,12 @@ const expandMentions = status => {
return fragment . innerHTML ;
return fragment . innerHTML ;
} ;
} ;
const expiresInFromExpiresAt = expires _at => {
if ( ! expires _at ) return 24 * 3600 ;
const delta = ( new Date ( expires _at ) . getTime ( ) - Date . now ( ) ) / 1000 ;
return [ 300 , 1800 , 3600 , 21600 , 86400 , 259200 , 604800 ] . find ( expires _in => expires _in >= delta ) || 24 * 3600 ;
} ;
export default function compose ( state = initialState , action ) {
export default function compose ( state = initialState , action ) {
switch ( action . type ) {
switch ( action . type ) {
case STORE _HYDRATE :
case STORE _HYDRATE :
@ -353,7 +359,7 @@ export default function compose(state = initialState, action) {
map . set ( 'poll' , ImmutableMap ( {
map . set ( 'poll' , ImmutableMap ( {
options : action . status . getIn ( [ 'poll' , 'options' ] ) . map ( x => x . get ( 'title' ) ) ,
options : action . status . getIn ( [ 'poll' , 'options' ] ) . map ( x => x . get ( 'title' ) ) ,
multiple : action . status . getIn ( [ 'poll' , 'multiple' ] ) ,
multiple : action . status . getIn ( [ 'poll' , 'multiple' ] ) ,
expires _in : 24 * 3600 ,
expires _in : expiresInFromExpiresAt ( action . status . getIn ( [ 'poll' , 'expires_at' ] ) ) ,
} ) ) ;
} ) ) ;
}
}
} ) ;
} ) ;