From 64c9d9a5d1608e7ce186be28617977fc61b83493 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Fri, 25 Jan 2019 15:00:18 +0300 Subject: [PATCH] Added new feature to profile page: get comments instead of replies for other user --- .../profile/container/profileContainer.js | 18 ++++++++++++++---- src/screens/profile/screen/profileScreen.js | 13 ++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/screens/profile/container/profileContainer.js b/src/screens/profile/container/profileContainer.js index 41339c0ee..1ddc23e31 100644 --- a/src/screens/profile/container/profileContainer.js +++ b/src/screens/profile/container/profileContainer.js @@ -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) => { diff --git a/src/screens/profile/screen/profileScreen.js b/src/screens/profile/screen/profileScreen.js index a4d3c0e17..50f152ebc 100644 --- a/src/screens/profile/screen/profileScreen.js +++ b/src/screens/profile/screen/profileScreen.js @@ -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 ( @@ -192,9 +192,12 @@ class ProfileScreen extends PureComponent { /> {comments && comments.length > 0 ? (