Fixed issue with account follow button not displaying properly

• Fixed:
- issue with account follow button not displaying properly (after removing relationship fetching in notifications and timelines)
This commit is contained in:
mgabdev
2021-01-09 03:25:54 -05:00
parent 5e82d71a9f
commit 19a7d2f31a
2 changed files with 50 additions and 1 deletions

View File

@@ -12,6 +12,9 @@ import {
MODAL_EDIT_PROFILE,
BREAKPOINT_EXTRA_SMALL,
} from '../constants'
import {
fetchRelationships,
} from '../actions/accounts'
import {
addShortcut,
removeShortcut,
@@ -41,6 +44,24 @@ class ProfileHeader extends ImmutablePureComponent {
stickied: false,
}
componentDidMount() {
this.checkRelationships(this.props.account)
}
componentDidUpdate(prevProps) {
const { account } = this.props
if (prevProps.account !== account) {
this.checkRelationships(account)
}
}
checkRelationships = (account) => {
if (!account) return
if (!account.get('relationship')) {
this.props.onFetchRelationships(account.get('id'))
}
}
handleOnEditProfile = () => {
this.props.onEditProfile()
}
@@ -447,6 +468,9 @@ const mapDispatchToProps = (dispatch) => ({
onCreateChatConversation(accountId, routerHistory) {
dispatch(createChatConversation(accountId, routerHistory))
},
onFetchRelationships(accountId) {
dispatch(fetchRelationships([accountId]))
},
});
ProfileHeader.propTypes = {