mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-20 11:51:52 +03:00
fixed unavailable post from notficiation
This commit is contained in:
parent
0a8b2cf6ff
commit
cff01500c2
@ -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 (
|
||||
<PostDisplayView
|
||||
author={author}
|
||||
isPostUnavailable={isPostUnavailable}
|
||||
currentAccount={currentAccount}
|
||||
fetchPost={this._fetchPost}
|
||||
handleOnEditPress={this._handleOnEditPress}
|
||||
|
@ -12,7 +12,9 @@ import { getTimeFromNow } from '../../../utils/time';
|
||||
|
||||
// Components
|
||||
import { PostHeaderDescription, PostBody, Tags } from '../../postElements';
|
||||
import { PostPlaceHolder, StickyBar, TextWithIcon } from '../../basicUIElements';
|
||||
import {
|
||||
PostPlaceHolder, StickyBar, TextWithIcon, NoPost,
|
||||
} from '../../basicUIElements';
|
||||
import { Upvote } from '../../upvote';
|
||||
import { IconButton } from '../../iconButton';
|
||||
import { CommentsDisplay } from '../../commentsDisplay';
|
||||
@ -122,7 +124,15 @@ class PostDisplayView extends PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { post, fetchPost, parentPost, currentAccount: { name } } = this.props;
|
||||
const {
|
||||
post,
|
||||
fetchPost,
|
||||
parentPost,
|
||||
currentAccount: { name },
|
||||
isPostUnavailable,
|
||||
author,
|
||||
intl,
|
||||
} = this.props;
|
||||
const { postHeight, scrollHeight, isLoadedComments } = this.state;
|
||||
|
||||
// const isPostEnd = scrollHeight > postHeight;
|
||||
@ -131,6 +141,17 @@ class PostDisplayView extends PureComponent {
|
||||
|
||||
if (isGetComment && !isLoadedComments) this.setState({ isLoadedComments: true });
|
||||
|
||||
if (isPostUnavailable) {
|
||||
return (
|
||||
<NoPost
|
||||
imageStyle={{ height: 200, width: 300 }}
|
||||
defaultText={`${intl.formatMessage({
|
||||
id: 'post.removed_hint',
|
||||
})} ${author}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<ScrollView style={styles.scroll} onScroll={event => this._handleOnScroll(event)}>
|
||||
@ -144,7 +165,7 @@ class PostDisplayView extends PureComponent {
|
||||
{!!post.title && <Text style={styles.title}>{post.title}</Text>}
|
||||
<PostHeaderDescription
|
||||
date={formatedTime}
|
||||
name={post.author}
|
||||
name={author || post.author}
|
||||
currentAccountUsername={name}
|
||||
reputation={post.author_reputation}
|
||||
tag={post.category}
|
||||
@ -156,7 +177,7 @@ class PostDisplayView extends PureComponent {
|
||||
<Text style={styles.footerText}>
|
||||
Posted by
|
||||
{' '}
|
||||
<Text style={styles.footerName}>{post.author}</Text>
|
||||
<Text style={styles.footerName}>{author || post.author}</Text>
|
||||
{' '}
|
||||
{formatedTime}
|
||||
</Text>
|
||||
@ -167,15 +188,15 @@ class PostDisplayView extends PureComponent {
|
||||
</View>
|
||||
{post && (isGetComment || isLoadedComments) && (
|
||||
<CommentsDisplay
|
||||
author={post.author}
|
||||
mainAuthor={post.author}
|
||||
author={author || post.author}
|
||||
mainAuthor={author || post.author}
|
||||
permlink={post.permlink}
|
||||
commentCount={post.children}
|
||||
fetchPost={fetchPost}
|
||||
/>
|
||||
)}
|
||||
</ScrollView>
|
||||
{this._getTabBar(true)}
|
||||
{post && this._getTabBar(true)}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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 {
|
||||
<PostScreen
|
||||
currentAccount={currentAccount}
|
||||
error={error}
|
||||
author={author}
|
||||
fetchPost={this._loadPost}
|
||||
isFetchComments
|
||||
isLoggedIn={isLoggedIn}
|
||||
isNewPost={isNewPost}
|
||||
parentPost={parentPost}
|
||||
post={post}
|
||||
isPostUnavailable={isPostUnavailable}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -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}
|
||||
/>
|
||||
<PostDisplay
|
||||
author={author}
|
||||
currentAccount={currentAccount}
|
||||
isPostUnavailable={isPostUnavailable}
|
||||
fetchPost={fetchPost}
|
||||
isFetchComments={isFetchComments}
|
||||
isLoggedIn={isLoggedIn}
|
||||
|
Loading…
Reference in New Issue
Block a user