From 8cd179e4bdf56804c89c05cd5e373b955a9615d3 Mon Sep 17 00:00:00 2001 From: u-e Date: Sat, 11 May 2019 17:16:00 +0300 Subject: [PATCH] disabled own profile press --- src/components/comment/view/commentView.js | 1 + .../view/postHeaderDescription.js | 31 ++++++++++++------- .../container/postDisplayContainer.js | 2 +- .../postView/view/postDisplayView.js | 3 +- src/components/posts/view/postsView.js | 2 +- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/components/comment/view/commentView.js b/src/components/comment/view/commentView.js index adc05bc87..cfb7af1a5 100644 --- a/src/components/comment/view/commentView.js +++ b/src/components/comment/view/commentView.js @@ -67,6 +67,7 @@ class CommentView extends PureComponent { name={comment.author} reputation={comment.author_reputation} size={avatarSize || 24} + currentAccountUsername={currentAccountUsername} isShowOwnerIndicator={currentAccountUsername === comment.author} /> diff --git a/src/components/postElements/headerDescription/view/postHeaderDescription.js b/src/components/postElements/headerDescription/view/postHeaderDescription.js index 8aa64b526..b5429fb58 100644 --- a/src/components/postElements/headerDescription/view/postHeaderDescription.js +++ b/src/components/postElements/headerDescription/view/postHeaderDescription.js @@ -33,19 +33,26 @@ class PostHeaderDescription extends PureComponent { // Component Functions _handleOnUserPress = (username) => { - const { navigation, profileOnPress, reputation } = this.props; + const { + navigation, + profileOnPress, + reputation, + currentAccountUsername, + } = this.props; - if (profileOnPress) { - profileOnPress(username); - } else { - navigation.navigate({ - routeName: ROUTES.SCREENS.PROFILE, - params: { - username, - reputation, - }, - key: username, - }); + if (currentAccountUsername !== username) { + if (profileOnPress) { + profileOnPress(username); + } else { + navigation.navigate({ + routeName: ROUTES.SCREENS.PROFILE, + params: { + username, + reputation, + }, + key: username, + }); + } } }; diff --git a/src/components/postView/container/postDisplayContainer.js b/src/components/postView/container/postDisplayContainer.js index 85be1f46b..4c00d99d9 100644 --- a/src/components/postView/container/postDisplayContainer.js +++ b/src/components/postView/container/postDisplayContainer.js @@ -73,7 +73,7 @@ class PostDisplayContainer extends Component { _fetchPost = async () => { const { post, fetchPost } = this.props; - fetchPost(post.author, post.permlink); + if (post) fetchPost(post.author, post.permlink); }; render() { diff --git a/src/components/postView/view/postDisplayView.js b/src/components/postView/view/postDisplayView.js index 2b215709d..782396933 100644 --- a/src/components/postView/view/postDisplayView.js +++ b/src/components/postView/view/postDisplayView.js @@ -122,7 +122,7 @@ class PostDisplayView extends PureComponent { }; render() { - const { post, fetchPost, parentPost } = this.props; + const { post, fetchPost, parentPost, currentAccount: { name } } = this.props; const { postHeight, scrollHeight, isLoadedComments } = this.state; // const isPostEnd = scrollHeight > postHeight; @@ -145,6 +145,7 @@ class PostDisplayView extends PureComponent { -)} + )} ref={(ref) => { this.flatList = ref; }}