summaryrefslogtreecommitdiffstats
path: root/web/react/components/create_post.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-02-18 17:34:52 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-02-18 17:34:52 -0500
commit8d807867ac09f3b01a2db66f646f1435a334936b (patch)
treed9eb66d4b874f2f4c800499dcf1f528af33bba63 /web/react/components/create_post.jsx
parent6e4c0ddef678aa5a599adc1ab92dfff4f77d0eb2 (diff)
parent2b20c3510f45cfff3b22063b81fddd29df962ecb (diff)
downloadchat-8d807867ac09f3b01a2db66f646f1435a334936b.tar.gz
chat-8d807867ac09f3b01a2db66f646f1435a334936b.tar.bz2
chat-8d807867ac09f3b01a2db66f646f1435a334936b.zip
Merge pull request #2191 from hmhealey/plt1256
PLT-1256 Ported PostDeletedModal to React-Bootstrap
Diffstat (limited to 'web/react/components/create_post.jsx')
-rw-r--r--web/react/components/create_post.jsx34
1 files changed, 25 insertions, 9 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx
index a4e60191d..48b6594a1 100644
--- a/web/react/components/create_post.jsx
+++ b/web/react/components/create_post.jsx
@@ -5,6 +5,7 @@ import MsgTyping from './msg_typing.jsx';
import Textbox from './textbox.jsx';
import FileUpload from './file_upload.jsx';
import FilePreview from './file_preview.jsx';
+import PostDeletedModal from './post_deleted_modal.jsx';
import TutorialTip from './tutorial/tutorial_tip.jsx';
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
@@ -64,6 +65,8 @@ class CreatePost extends React.Component {
this.handleKeyDown = this.handleKeyDown.bind(this);
this.sendMessage = this.sendMessage.bind(this);
this.focusTextbox = this.focusTextbox.bind(this);
+ this.showPostDeletedModal = this.showPostDeletedModal.bind(this);
+ this.hidePostDeletedModal = this.hidePostDeletedModal.bind(this);
PostStore.clearDraftUploads();
@@ -77,7 +80,8 @@ class CreatePost extends React.Component {
submitting: false,
initialText: draft.messageText,
ctrlSend: false,
- showTutorialTip: false
+ showTutorialTip: false,
+ showPostDeletedModal: false
};
}
getCurrentDraft() {
@@ -157,7 +161,6 @@ class CreatePost extends React.Component {
post.pending_post_id = `${userId}:${time}`;
post.user_id = userId;
post.create_at = time;
- post.root_id = this.state.rootId;
post.parent_id = this.state.parentId;
const channel = ChannelStore.get(this.state.channelId);
@@ -177,20 +180,19 @@ class CreatePost extends React.Component {
EventHelpers.emitPostRecievedEvent(data);
},
(err) => {
- const state = {};
-
if (err.id === 'api.post.create_post.root_id.app_error') {
- if ($('#post_deleted').length > 0) {
- $('#post_deleted').modal('show');
- }
+ // this should never actually happen since you can't reply from this textbox
+ this.showPostDeletedModal();
+
PostStore.removePendingPost(post.pending_post_id);
} else {
post.state = Constants.POST_FAILED;
PostStore.updatePendingPost(post);
}
- state.submitting = false;
- this.setState(state);
+ this.setState({
+ submitting: false
+ });
}
);
}
@@ -374,6 +376,16 @@ class CreatePost extends React.Component {
});
}
}
+ showPostDeletedModal() {
+ this.setState({
+ showPostDeletedModal: true
+ });
+ }
+ hidePostDeletedModal() {
+ this.setState({
+ showPostDeletedModal: false
+ });
+ }
createTutorialTip() {
const screens = [];
@@ -479,6 +491,10 @@ class CreatePost extends React.Component {
{serverError}
</div>
</div>
+ <PostDeletedModal
+ show={this.state.showPostDeletedModal}
+ onHide={this.hidePostDeletedModal}
+ />
</form>
);
}