Now handles commenting on a deleted post gracefully, and checks for any areas where data may no longer exist once a post has been deleted
Этот коммит содержится в:
@@ -23,7 +23,7 @@ export default class RhsThread extends React.Component {
|
||||
}
|
||||
getStateFromStores() {
|
||||
var postList = PostStore.getSelectedPost();
|
||||
if (!postList || postList.order.length < 1) {
|
||||
if (!postList || postList.order.length < 1 || !postList.posts[postList.order[0]]) {
|
||||
return {postList: {}};
|
||||
}
|
||||
|
||||
@@ -49,7 +49,10 @@ export default class RhsThread extends React.Component {
|
||||
}.bind(this));
|
||||
}
|
||||
componentDidUpdate() {
|
||||
$('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight);
|
||||
if ($('.post-right__scroll')[0]) {
|
||||
$('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight);
|
||||
}
|
||||
|
||||
$('.post-right__scroll').perfectScrollbar('update');
|
||||
this.resize();
|
||||
}
|
||||
@@ -67,17 +70,10 @@ export default class RhsThread extends React.Component {
|
||||
// if something was changed in the channel like adding a
|
||||
// comment or post then lets refresh the sidebar list
|
||||
var currentSelected = PostStore.getSelectedPost();
|
||||
if (!currentSelected || currentSelected.order.length === 0) {
|
||||
if (!currentSelected || currentSelected.order.length === 0 || !currentSelected.posts[currentSelected.order[0]]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!currentSelected.posts[currentSelected.order[0]]) {
|
||||
if ($('#post_deleted').length > 0) {
|
||||
$('#post_deleted').modal('show');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var currentPosts = PostStore.getPosts(currentSelected.posts[currentSelected.order[0]].channel_id);
|
||||
|
||||
if (!currentPosts || currentPosts.order.length === 0) {
|
||||
@@ -110,7 +106,7 @@ export default class RhsThread extends React.Component {
|
||||
render() {
|
||||
var postList = this.state.postList;
|
||||
|
||||
if (postList == null) {
|
||||
if (postList == null || !postList.order) {
|
||||
return (
|
||||
<div></div>
|
||||
);
|
||||
|
||||
Ссылка в новой задаче
Block a user