Added new feature to profile page: get comments instead of replies for other user

This commit is contained in:
Mustafa Buyukcelebi 2019-01-25 15:00:18 +03:00
parent 0200315189
commit 64c9d9a5d1
2 changed files with 22 additions and 9 deletions

View File

@ -9,6 +9,7 @@ import {
ignoreUser,
getFollows,
getRepliesByLastUpdate,
getUserComments,
getUser,
getIsFollowing,
getIsMuted,
@ -98,11 +99,20 @@ class ProfileContainer extends Component {
}
_getReplies = async (user) => {
await getRepliesByLastUpdate({ start_author: user, limit: 10 }).then((result) => {
this.setState({
comments: result,
const { isReverseHeader } = this.state;
if (isReverseHeader) {
await getUserComments({ start_author: user, limit: 10 }).then((result) => {
this.setState({
comments: result,
});
});
});
} else {
await getRepliesByLastUpdate({ start_author: user, limit: 10 }).then((result) => {
this.setState({
comments: result,
});
});
}
};
_handleFollowUnfollowUser = async (isFollowAction) => {

View File

@ -105,8 +105,8 @@ class ProfileScreen extends PureComponent {
if (about) {
_about = about.about;
coverImage = about.cover_image;
location = about.location;
website = about.website;
({ location } = about);
({ website } = about);
}
return (
<Fragment>
@ -192,9 +192,12 @@ class ProfileScreen extends PureComponent {
/>
</View>
<View
tabLabel={intl.formatMessage({
id: 'profile.replies',
})}
tabLabel={isReverseHeader
? intl.formatMessage({
id: 'profile.comments',
}) : intl.formatMessage({
id: 'profile.replies',
})}
style={styles.commentsTabBar}
>
{comments && comments.length > 0 ? (