Close Thread view when the root post has been deleted (#1114)
This commit is contained in:
parent
58efa5863b
commit
2a6b49cdfa
2 changed files with 9 additions and 1 deletions
|
|
@ -133,7 +133,7 @@ class Post extends PureComponent {
|
|||
|
||||
handlePostDelete = () => {
|
||||
const {formatMessage} = this.props.intl;
|
||||
const {post, actions} = this.props;
|
||||
const {actions, currentUserId, post} = this.props;
|
||||
|
||||
Alert.alert(
|
||||
formatMessage({id: 'mobile.post.delete_title', defaultMessage: 'Delete Post'}),
|
||||
|
|
@ -147,6 +147,9 @@ class Post extends PureComponent {
|
|||
onPress: () => {
|
||||
this.editDisableAction.cancel();
|
||||
actions.deletePost(post);
|
||||
if (post.user_id === currentUserId) {
|
||||
actions.removePost(post);
|
||||
}
|
||||
}
|
||||
}]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@ class Thread extends PureComponent {
|
|||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (this.props.postIds !== nextProps.postIds && !nextProps.postIds.length) {
|
||||
this.props.navigator.pop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.state.lastViewedAt) {
|
||||
this.setState({lastViewedAt: nextProps.myMember.last_viewed_at});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue