Merge pull request #948 from rgarmsen2295/plt-167
PLT-167 Fixes issue with trying to comment on a deleted post
Этот коммит содержится в:
@@ -106,10 +106,11 @@ export default class CreateComment extends React.Component {
|
|||||||
let state = {};
|
let state = {};
|
||||||
|
|
||||||
if (err.message === 'Invalid RootId parameter') {
|
if (err.message === 'Invalid RootId parameter') {
|
||||||
|
PostStore.removePendingPost(post.channel_id, post.pending_post_id);
|
||||||
|
|
||||||
if ($('#post_deleted').length > 0) {
|
if ($('#post_deleted').length > 0) {
|
||||||
$('#post_deleted').modal('show');
|
$('#post_deleted').modal('show');
|
||||||
}
|
}
|
||||||
PostStore.removePendingPost(post.pending_post_id);
|
|
||||||
} else {
|
} else {
|
||||||
post.state = Constants.POST_FAILED;
|
post.state = Constants.POST_FAILED;
|
||||||
PostStore.updatePendingPost(post);
|
PostStore.updatePendingPost(post);
|
||||||
|
|||||||
@@ -2,13 +2,41 @@
|
|||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
var UserStore = require('../stores/user_store.jsx');
|
var UserStore = require('../stores/user_store.jsx');
|
||||||
|
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||||
|
var Constants = require('../utils/constants.jsx');
|
||||||
|
var ActionTypes = Constants.ActionTypes;
|
||||||
|
|
||||||
export default class PostDeletedModal extends React.Component {
|
export default class PostDeletedModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
this.handleClose = this.handleClose.bind(this);
|
||||||
|
|
||||||
this.state = {};
|
this.state = {};
|
||||||
}
|
}
|
||||||
|
componentDidMount() {
|
||||||
|
$(React.findDOMNode(this.refs.modal)).on('hidden.bs.modal', () => {
|
||||||
|
this.handleClose();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
handleClose() {
|
||||||
|
AppDispatcher.handleServerAction({
|
||||||
|
type: ActionTypes.RECIEVED_SEARCH,
|
||||||
|
results: null
|
||||||
|
});
|
||||||
|
|
||||||
|
AppDispatcher.handleServerAction({
|
||||||
|
type: ActionTypes.RECIEVED_SEARCH_TERM,
|
||||||
|
term: null,
|
||||||
|
do_search: false,
|
||||||
|
is_mention_search: false
|
||||||
|
});
|
||||||
|
|
||||||
|
AppDispatcher.handleServerAction({
|
||||||
|
type: ActionTypes.RECIEVED_POST_SELECTED,
|
||||||
|
results: null
|
||||||
|
});
|
||||||
|
}
|
||||||
render() {
|
render() {
|
||||||
var currentUser = UserStore.getCurrentUser();
|
var currentUser = UserStore.getCurrentUser();
|
||||||
|
|
||||||
@@ -31,17 +59,17 @@ export default class PostDeletedModal extends React.Component {
|
|||||||
data-dismiss='modal'
|
data-dismiss='modal'
|
||||||
aria-label='Close'
|
aria-label='Close'
|
||||||
>
|
>
|
||||||
<span aria-hidden='true'>×</span>
|
<span aria-hidden='true'>{'×'}</span>
|
||||||
</button>
|
</button>
|
||||||
<h4
|
<h4
|
||||||
className='modal-title'
|
className='modal-title'
|
||||||
id='myModalLabel'
|
id='myModalLabel'
|
||||||
>
|
>
|
||||||
Comment could not be posted
|
{'Comment could not be posted'}
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div className='modal-body'>
|
<div className='modal-body'>
|
||||||
<p>Someone deleted the message on which you tried to post a comment.</p>
|
<p>{'Someone deleted the message on which you tried to post a comment.'}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='modal-footer'>
|
<div className='modal-footer'>
|
||||||
<button
|
<button
|
||||||
@@ -49,7 +77,7 @@ export default class PostDeletedModal extends React.Component {
|
|||||||
className='btn btn-primary'
|
className='btn btn-primary'
|
||||||
data-dismiss='modal'
|
data-dismiss='modal'
|
||||||
>
|
>
|
||||||
Okay
|
{'Okay'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default class RhsThread extends React.Component {
|
|||||||
}
|
}
|
||||||
getStateFromStores() {
|
getStateFromStores() {
|
||||||
var postList = PostStore.getSelectedPost();
|
var postList = PostStore.getSelectedPost();
|
||||||
if (!postList || postList.order.length < 1) {
|
if (!postList || postList.order.length < 1 || !postList.posts[postList.order[0]]) {
|
||||||
return {postList: {}};
|
return {postList: {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,10 @@ export default class RhsThread extends React.Component {
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
componentDidUpdate() {
|
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');
|
$('.post-right__scroll').perfectScrollbar('update');
|
||||||
this.resize();
|
this.resize();
|
||||||
}
|
}
|
||||||
@@ -67,7 +70,7 @@ export default class RhsThread extends React.Component {
|
|||||||
// if something was changed in the channel like adding a
|
// if something was changed in the channel like adding a
|
||||||
// comment or post then lets refresh the sidebar list
|
// comment or post then lets refresh the sidebar list
|
||||||
var currentSelected = PostStore.getSelectedPost();
|
var currentSelected = PostStore.getSelectedPost();
|
||||||
if (!currentSelected || currentSelected.order.length === 0) {
|
if (!currentSelected || currentSelected.order.length === 0 || !currentSelected.posts[currentSelected.order[0]]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +106,7 @@ export default class RhsThread extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
var postList = this.state.postList;
|
var postList = this.state.postList;
|
||||||
|
|
||||||
if (postList == null) {
|
if (postList == null || !postList.order) {
|
||||||
return (
|
return (
|
||||||
<div></div>
|
<div></div>
|
||||||
);
|
);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user