mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-30 00:52:42 +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() {
|
render() {
|
||||||
const {
|
const {
|
||||||
currentAccount, isLoggedIn, isNewPost, parentPost, post,
|
currentAccount, isLoggedIn, isNewPost, parentPost, post, isPostUnavailable, author,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PostDisplayView
|
<PostDisplayView
|
||||||
|
author={author}
|
||||||
|
isPostUnavailable={isPostUnavailable}
|
||||||
currentAccount={currentAccount}
|
currentAccount={currentAccount}
|
||||||
fetchPost={this._fetchPost}
|
fetchPost={this._fetchPost}
|
||||||
handleOnEditPress={this._handleOnEditPress}
|
handleOnEditPress={this._handleOnEditPress}
|
||||||
|
@ -12,7 +12,9 @@ import { getTimeFromNow } from '../../../utils/time';
|
|||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { PostHeaderDescription, PostBody, Tags } from '../../postElements';
|
import { PostHeaderDescription, PostBody, Tags } from '../../postElements';
|
||||||
import { PostPlaceHolder, StickyBar, TextWithIcon } from '../../basicUIElements';
|
import {
|
||||||
|
PostPlaceHolder, StickyBar, TextWithIcon, NoPost,
|
||||||
|
} from '../../basicUIElements';
|
||||||
import { Upvote } from '../../upvote';
|
import { Upvote } from '../../upvote';
|
||||||
import { IconButton } from '../../iconButton';
|
import { IconButton } from '../../iconButton';
|
||||||
import { CommentsDisplay } from '../../commentsDisplay';
|
import { CommentsDisplay } from '../../commentsDisplay';
|
||||||
@ -122,7 +124,15 @@ class PostDisplayView extends PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
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 { postHeight, scrollHeight, isLoadedComments } = this.state;
|
||||||
|
|
||||||
// const isPostEnd = scrollHeight > postHeight;
|
// const isPostEnd = scrollHeight > postHeight;
|
||||||
@ -131,6 +141,17 @@ class PostDisplayView extends PureComponent {
|
|||||||
|
|
||||||
if (isGetComment && !isLoadedComments) this.setState({ isLoadedComments: true });
|
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 (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<ScrollView style={styles.scroll} onScroll={event => this._handleOnScroll(event)}>
|
<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>}
|
{!!post.title && <Text style={styles.title}>{post.title}</Text>}
|
||||||
<PostHeaderDescription
|
<PostHeaderDescription
|
||||||
date={formatedTime}
|
date={formatedTime}
|
||||||
name={post.author}
|
name={author || post.author}
|
||||||
currentAccountUsername={name}
|
currentAccountUsername={name}
|
||||||
reputation={post.author_reputation}
|
reputation={post.author_reputation}
|
||||||
tag={post.category}
|
tag={post.category}
|
||||||
@ -156,7 +177,7 @@ class PostDisplayView extends PureComponent {
|
|||||||
<Text style={styles.footerText}>
|
<Text style={styles.footerText}>
|
||||||
Posted by
|
Posted by
|
||||||
{' '}
|
{' '}
|
||||||
<Text style={styles.footerName}>{post.author}</Text>
|
<Text style={styles.footerName}>{author || post.author}</Text>
|
||||||
{' '}
|
{' '}
|
||||||
{formatedTime}
|
{formatedTime}
|
||||||
</Text>
|
</Text>
|
||||||
@ -167,15 +188,15 @@ class PostDisplayView extends PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
{post && (isGetComment || isLoadedComments) && (
|
{post && (isGetComment || isLoadedComments) && (
|
||||||
<CommentsDisplay
|
<CommentsDisplay
|
||||||
author={post.author}
|
author={author || post.author}
|
||||||
mainAuthor={post.author}
|
mainAuthor={author || post.author}
|
||||||
permlink={post.permlink}
|
permlink={post.permlink}
|
||||||
commentCount={post.children}
|
commentCount={post.children}
|
||||||
fetchPost={fetchPost}
|
fetchPost={fetchPost}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
{this._getTabBar(true)}
|
{post && this._getTabBar(true)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,8 @@
|
|||||||
"confirm": "Confirm"
|
"confirm": "Confirm"
|
||||||
},
|
},
|
||||||
"post": {
|
"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": {
|
"drafts": {
|
||||||
"title": "Drafts",
|
"title": "Drafts",
|
||||||
|
@ -22,6 +22,7 @@ class PostContainer extends Component {
|
|||||||
isNewPost: false,
|
isNewPost: false,
|
||||||
isHasParentPost: false,
|
isHasParentPost: false,
|
||||||
parentPost: null,
|
parentPost: null,
|
||||||
|
isPostUnavailable: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ class PostContainer extends Component {
|
|||||||
this.setState({ post: content });
|
this.setState({ post: content });
|
||||||
} else if (author && permlink) {
|
} else if (author && permlink) {
|
||||||
this._loadPost(author, permlink);
|
this._loadPost(author, permlink);
|
||||||
|
this.setState({ author });
|
||||||
if (isHasParentPost) this.setState({ isHasParentPost });
|
if (isHasParentPost) this.setState({ isHasParentPost });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,12 +66,14 @@ class PostContainer extends Component {
|
|||||||
|
|
||||||
await getPost(_author, _permlink, isLoggedIn && currentAccount.username)
|
await getPost(_author, _permlink, isLoggedIn && currentAccount.username)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result) {
|
if (result && result.id > 0) {
|
||||||
if (isParentPost) {
|
if (isParentPost) {
|
||||||
this.setState({ parentPost: result });
|
this.setState({ parentPost: result });
|
||||||
} else {
|
} else {
|
||||||
this.setState({ post: result });
|
this.setState({ post: result });
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.setState({ isPostUnavailable: true });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@ -81,7 +84,7 @@ class PostContainer extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const { currentAccount, isLoggedIn } = this.props;
|
const { currentAccount, isLoggedIn } = this.props;
|
||||||
const {
|
const {
|
||||||
error, isNewPost, parentPost, post, isHasParentPost,
|
error, isNewPost, parentPost, post, isHasParentPost, isPostUnavailable, author,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
if (isHasParentPost && post) this._loadPost(post.parent_author, post.parent_permlink, true);
|
if (isHasParentPost && post) this._loadPost(post.parent_author, post.parent_permlink, true);
|
||||||
@ -90,12 +93,14 @@ class PostContainer extends Component {
|
|||||||
<PostScreen
|
<PostScreen
|
||||||
currentAccount={currentAccount}
|
currentAccount={currentAccount}
|
||||||
error={error}
|
error={error}
|
||||||
|
author={author}
|
||||||
fetchPost={this._loadPost}
|
fetchPost={this._loadPost}
|
||||||
isFetchComments
|
isFetchComments
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
isNewPost={isNewPost}
|
isNewPost={isNewPost}
|
||||||
parentPost={parentPost}
|
parentPost={parentPost}
|
||||||
post={post}
|
post={post}
|
||||||
|
isPostUnavailable={isPostUnavailable}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ class PostScreen extends PureComponent {
|
|||||||
isNewPost,
|
isNewPost,
|
||||||
parentPost,
|
parentPost,
|
||||||
post,
|
post,
|
||||||
|
isPostUnavailable,
|
||||||
|
author,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -43,7 +45,9 @@ class PostScreen extends PureComponent {
|
|||||||
isNewPost={isNewPost}
|
isNewPost={isNewPost}
|
||||||
/>
|
/>
|
||||||
<PostDisplay
|
<PostDisplay
|
||||||
|
author={author}
|
||||||
currentAccount={currentAccount}
|
currentAccount={currentAccount}
|
||||||
|
isPostUnavailable={isPostUnavailable}
|
||||||
fetchPost={fetchPost}
|
fetchPost={fetchPost}
|
||||||
isFetchComments={isFetchComments}
|
isFetchComments={isFetchComments}
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
|
Loading…
Reference in New Issue
Block a user