@ -124,6 +124,7 @@ class Header extends ImmutablePureComponent {
render ( ) {
render ( ) {
const { account , hidden , intl , domain } = this . props ;
const { account , hidden , intl , domain } = this . props ;
const { signedIn } = this . context . identity ;
if ( ! account ) {
if ( ! account ) {
return null ;
return null ;
@ -157,12 +158,12 @@ class Header extends ImmutablePureComponent {
}
}
if ( me !== account . get ( 'id' ) ) {
if ( me !== account . get ( 'id' ) ) {
if ( ! account . get ( 'relationship' ) ) { // Wait until the relationship is loaded
if ( signedIn && ! account . get ( 'relationship' ) ) { // Wait until the relationship is loaded
actionBtn = '' ;
actionBtn = '' ;
} else if ( account . getIn ( [ 'relationship' , 'requested' ] ) ) {
} else if ( account . getIn ( [ 'relationship' , 'requested' ] ) ) {
actionBtn = < Button className = { classNames ( 'logo-button' , { 'button--with-bell' : bellBtn !== '' } ) } text = { intl . formatMessage ( messages . cancel_follow_request ) } title = { intl . formatMessage ( messages . requested ) } onClick = { this . props . onFollow } / > ;
actionBtn = < Button className = { classNames ( 'logo-button' , { 'button--with-bell' : bellBtn !== '' } ) } text = { intl . formatMessage ( messages . cancel_follow_request ) } title = { intl . formatMessage ( messages . requested ) } onClick = { this . props . onFollow } / > ;
} else if ( ! account . getIn ( [ 'relationship' , 'blocking' ] ) ) {
} else if ( ! account . getIn ( [ 'relationship' , 'blocking' ] ) ) {
actionBtn = < Button className = { classNames ( 'logo-button' , { 'button--destructive' : account . getIn ( [ 'relationship' , 'following' ] ) , 'button--with-bell' : bellBtn !== '' } ) } text = { intl . formatMessage ( account . getIn ( [ 'relationship' , 'following' ] ) ? messages . unfollow : messages . follow ) } onClick = { this . props . onFollow } / > ;
actionBtn = < Button className = { classNames ( 'logo-button' , { 'button--destructive' : account . getIn ( [ 'relationship' , 'following' ] ) , 'button--with-bell' : bellBtn !== '' } ) } text = { intl . formatMessage ( account . getIn ( [ 'relationship' , 'following' ] ) ? messages . unfollow : messages . follow ) } onClick = { signedIn ? this . props . onFollow : undefined } / > ;
} else if ( account . getIn ( [ 'relationship' , 'blocking' ] ) ) {
} else if ( account . getIn ( [ 'relationship' , 'blocking' ] ) ) {
actionBtn = < Button className = 'logo-button' text = { intl . formatMessage ( messages . unblock , { name : account . get ( 'username' ) } ) } onClick = { this . props . onBlock } / > ;
actionBtn = < Button className = 'logo-button' text = { intl . formatMessage ( messages . unblock , { name : account . get ( 'username' ) } ) } onClick = { this . props . onBlock } / > ;
}
}
@ -182,7 +183,7 @@ class Header extends ImmutablePureComponent {
lockedIcon = < Icon id = 'lock' title = { intl . formatMessage ( messages . account_locked ) } / > ;
lockedIcon = < Icon id = 'lock' title = { intl . formatMessage ( messages . account_locked ) } / > ;
}
}
if ( account . get ( 'id' ) !== me && ! suspended ) {
if ( signedIn && account. get ( 'id' ) !== me && ! suspended ) {
menu . push ( { text : intl . formatMessage ( messages . mention , { name : account . get ( 'username' ) } ) , action : this . props . onMention } ) ;
menu . push ( { text : intl . formatMessage ( messages . mention , { name : account . get ( 'username' ) } ) , action : this . props . onMention } ) ;
menu . push ( { text : intl . formatMessage ( messages . direct , { name : account . get ( 'username' ) } ) , action : this . props . onDirect } ) ;
menu . push ( { text : intl . formatMessage ( messages . direct , { name : account . get ( 'username' ) } ) , action : this . props . onDirect } ) ;
menu . push ( null ) ;
menu . push ( null ) ;
@ -209,7 +210,7 @@ class Header extends ImmutablePureComponent {
menu . push ( { text : intl . formatMessage ( messages . mutes ) , to : '/mutes' } ) ;
menu . push ( { text : intl . formatMessage ( messages . mutes ) , to : '/mutes' } ) ;
menu . push ( { text : intl . formatMessage ( messages . blocks ) , to : '/blocks' } ) ;
menu . push ( { text : intl . formatMessage ( messages . blocks ) , to : '/blocks' } ) ;
menu . push ( { text : intl . formatMessage ( messages . domain_blocks ) , to : '/domain_blocks' } ) ;
menu . push ( { text : intl . formatMessage ( messages . domain_blocks ) , to : '/domain_blocks' } ) ;
} else {
} else if ( signedIn ) {
if ( account . getIn ( [ 'relationship' , 'following' ] ) ) {
if ( account . getIn ( [ 'relationship' , 'following' ] ) ) {
if ( ! account . getIn ( [ 'relationship' , 'muting' ] ) ) {
if ( ! account . getIn ( [ 'relationship' , 'muting' ] ) ) {
if ( account . getIn ( [ 'relationship' , 'showing_reblogs' ] ) ) {
if ( account . getIn ( [ 'relationship' , 'showing_reblogs' ] ) ) {
@ -242,7 +243,7 @@ class Header extends ImmutablePureComponent {
menu . push ( { text : intl . formatMessage ( messages . report , { name : account . get ( 'username' ) } ) , action : this . props . onReport } ) ;
menu . push ( { text : intl . formatMessage ( messages . report , { name : account . get ( 'username' ) } ) , action : this . props . onReport } ) ;
}
}
if ( account . get ( 'acct' ) !== account . get ( 'username' ) ) {
if ( signedIn && account. get ( 'acct' ) !== account . get ( 'username' ) ) {
const domain = account . get ( 'acct' ) . split ( '@' ) [ 1 ] ;
const domain = account . get ( 'acct' ) . split ( '@' ) [ 1 ] ;
menu . push ( null ) ;
menu . push ( null ) ;
@ -301,7 +302,7 @@ class Header extends ImmutablePureComponent {
< / R e a c t . F r a g m e n t >
< / R e a c t . F r a g m e n t >
) }
) }
< DropdownMenuContainer items = { menu } icon = 'ellipsis-v' size = { 24 } direction = 'right' / >
< DropdownMenuContainer disabled = { menu . length === 0 } items= { menu } icon = 'ellipsis-v' size = { 24 } direction = 'right' / >
< / d i v >
< / d i v >
) }
) }
< / d i v >
< / d i v >
@ -313,7 +314,7 @@ class Header extends ImmutablePureComponent {
< / h 1 >
< / h 1 >
< / d i v >
< / d i v >
< AccountNoteContainer account = { account } / >
{ signedIn && < AccountNoteContainer account = { account } / > }
{ ! ( suspended || hidden ) && (
{ ! ( suspended || hidden ) && (
< div className = 'account__header__extra' >
< div className = 'account__header__extra' >