Updated AccountActionButton to show "Edit Profile" for current user
• Updated: - AccountActionButton to show "Edit Profile" for current user
This commit is contained in:
parent
dd00db13bc
commit
be9d08d590
@ -22,6 +22,7 @@ const messages = defineMessages({
|
||||
blocked: { id: 'account.blocked', defaultMessage: 'Blocked' },
|
||||
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
||||
follows: { id: 'account.follows', defaultMessage: 'Follows' },
|
||||
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
@ -86,20 +87,28 @@ class AccountActionButton extends ImmutablePureComponent {
|
||||
|
||||
if (!account) return null
|
||||
|
||||
// Wait until the relationship is loaded
|
||||
if (!account.get('relationship')) return null
|
||||
const isMe = account.get('id') === me
|
||||
|
||||
// Don't show if is me
|
||||
if (account.get('id') === me) return null
|
||||
// Wait until the relationship is loaded unless me
|
||||
if (!account.get('relationship') && !isMe) return null
|
||||
|
||||
let buttonText = ''
|
||||
let buttonOptions = {}
|
||||
|
||||
if (isMe) {
|
||||
buttonText = intl.formatMessage(messages.edit_profile)
|
||||
buttonOptions = {
|
||||
href: '/settings/profile',
|
||||
color: 'brand',
|
||||
backgroundColor: 'none',
|
||||
isOutline: true,
|
||||
}
|
||||
} else {
|
||||
const isBlockedBy = account.getIn(['relationship', 'blocked_by'])
|
||||
|
||||
// Don't show
|
||||
if (isBlockedBy) return null
|
||||
|
||||
let buttonText = ''
|
||||
let buttonOptions = {}
|
||||
|
||||
const isRequested = account.getIn(['relationship', 'requested'])
|
||||
const isBlocking = account.getIn(['relationship', 'blocking'])
|
||||
const isFollowing = account.getIn(['relationship', 'following'])
|
||||
@ -134,6 +143,7 @@ class AccountActionButton extends ImmutablePureComponent {
|
||||
isOutline: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const textClassName = isSmall ? null : _s.px10
|
||||
const textSize = isSmall ? 'normal' : 'medium'
|
||||
|
Loading…
Reference in New Issue
Block a user