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' },
|
blocked: { id: 'account.blocked', defaultMessage: 'Blocked' },
|
||||||
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
||||||
follows: { id: 'account.follows', defaultMessage: 'Follows' },
|
follows: { id: 'account.follows', defaultMessage: 'Follows' },
|
||||||
|
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
|
||||||
})
|
})
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@ -86,20 +87,28 @@ class AccountActionButton extends ImmutablePureComponent {
|
|||||||
|
|
||||||
if (!account) return null
|
if (!account) return null
|
||||||
|
|
||||||
// Wait until the relationship is loaded
|
const isMe = account.get('id') === me
|
||||||
if (!account.get('relationship')) return null
|
|
||||||
|
|
||||||
// Don't show if is me
|
// Wait until the relationship is loaded unless me
|
||||||
if (account.get('id') === me) return null
|
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'])
|
const isBlockedBy = account.getIn(['relationship', 'blocked_by'])
|
||||||
|
|
||||||
// Don't show
|
// Don't show
|
||||||
if (isBlockedBy) return null
|
if (isBlockedBy) return null
|
||||||
|
|
||||||
let buttonText = ''
|
|
||||||
let buttonOptions = {}
|
|
||||||
|
|
||||||
const isRequested = account.getIn(['relationship', 'requested'])
|
const isRequested = account.getIn(['relationship', 'requested'])
|
||||||
const isBlocking = account.getIn(['relationship', 'blocking'])
|
const isBlocking = account.getIn(['relationship', 'blocking'])
|
||||||
const isFollowing = account.getIn(['relationship', 'following'])
|
const isFollowing = account.getIn(['relationship', 'following'])
|
||||||
@ -134,6 +143,7 @@ class AccountActionButton extends ImmutablePureComponent {
|
|||||||
isOutline: true,
|
isOutline: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const textClassName = isSmall ? null : _s.px10
|
const textClassName = isSmall ? null : _s.px10
|
||||||
const textSize = isSmall ? 'normal' : 'medium'
|
const textSize = isSmall ? 'normal' : 'medium'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user