diff --git a/src/components/postView/container/postDisplayContainer.js b/src/components/postView/container/postDisplayContainer.js index 4c00d99d9..aa4dc31f0 100644 --- a/src/components/postView/container/postDisplayContainer.js +++ b/src/components/postView/container/postDisplayContainer.js @@ -78,11 +78,13 @@ class PostDisplayContainer extends Component { render() { const { - currentAccount, isLoggedIn, isNewPost, parentPost, post, + currentAccount, isLoggedIn, isNewPost, parentPost, post, isPostUnavailable, author, } = this.props; return ( postHeight; @@ -131,6 +141,17 @@ class PostDisplayView extends PureComponent { if (isGetComment && !isLoadedComments) this.setState({ isLoadedComments: true }); + if (isPostUnavailable) { + return ( + + ); + } + return ( this._handleOnScroll(event)}> @@ -144,7 +165,7 @@ class PostDisplayView extends PureComponent { {!!post.title && {post.title}} Posted by {' '} - {post.author} + {author || post.author} {' '} {formatedTime} @@ -167,15 +188,15 @@ class PostDisplayView extends PureComponent { {post && (isGetComment || isLoadedComments) && ( )} - {this._getTabBar(true)} + {post && this._getTabBar(true)} ); } diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index e7f4a8610..0ff93096e 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -197,7 +197,8 @@ "confirm": "Confirm" }, "post": { - "reblog_alert": "Are you sure you want to reblog?" + "reblog_alert": "Are you sure you want to reblog?", + "removed_hint": "The post was removed by" }, "drafts": { "title": "Drafts", diff --git a/src/screens/post/container/postContainer.js b/src/screens/post/container/postContainer.js index 8c5b22cb4..7c6a0c440 100644 --- a/src/screens/post/container/postContainer.js +++ b/src/screens/post/container/postContainer.js @@ -22,6 +22,7 @@ class PostContainer extends Component { isNewPost: false, isHasParentPost: false, parentPost: null, + isPostUnavailable: false, }; } @@ -38,7 +39,7 @@ class PostContainer extends Component { this.setState({ post: content }); } else if (author && permlink) { this._loadPost(author, permlink); - + this.setState({ author }); if (isHasParentPost) this.setState({ isHasParentPost }); } } @@ -65,12 +66,14 @@ class PostContainer extends Component { await getPost(_author, _permlink, isLoggedIn && currentAccount.username) .then((result) => { - if (result) { + if (result && result.id > 0) { if (isParentPost) { this.setState({ parentPost: result }); } else { this.setState({ post: result }); } + } else { + this.setState({ isPostUnavailable: true }); } }) .catch((err) => { @@ -81,7 +84,7 @@ class PostContainer extends Component { render() { const { currentAccount, isLoggedIn } = this.props; const { - error, isNewPost, parentPost, post, isHasParentPost, + error, isNewPost, parentPost, post, isHasParentPost, isPostUnavailable, author, } = this.state; if (isHasParentPost && post) this._loadPost(post.parent_author, post.parent_permlink, true); @@ -90,12 +93,14 @@ class PostContainer extends Component { ); } diff --git a/src/screens/post/screen/postScreen.js b/src/screens/post/screen/postScreen.js index a97e470da..9062488e6 100644 --- a/src/screens/post/screen/postScreen.js +++ b/src/screens/post/screen/postScreen.js @@ -31,6 +31,8 @@ class PostScreen extends PureComponent { isNewPost, parentPost, post, + isPostUnavailable, + author, } = this.props; return ( @@ -43,7 +45,9 @@ class PostScreen extends PureComponent { isNewPost={isNewPost} />