From 6c86ec3e4cc8137116d09e9db583b43fff659d30 Mon Sep 17 00:00:00 2001 From: David Lu Date: Mon, 30 May 2016 07:00:20 -0700 Subject: changed behaviour on non-empty post/comment (#3154) Added preventDefault changed behaviour on non-empty post/comment --- webapp/components/create_comment.jsx | 4 ++-- webapp/components/create_post.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/components/create_comment.jsx b/webapp/components/create_comment.jsx index 616257f37..6cd2054a1 100644 --- a/webapp/components/create_comment.jsx +++ b/webapp/components/create_comment.jsx @@ -225,11 +225,11 @@ class CreateComment extends React.Component { } if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.keyCode === KeyCodes.UP) { - e.preventDefault(); const lastPost = PostStore.getCurrentUsersLatestPost(this.props.channelId, this.props.rootId); - if (!lastPost) { + if (!lastPost || this.state.messageText !== '') { return; } + e.preventDefault(); let message = lastPost.message; if (this.state.lastMessage !== '') { message = this.state.lastMessage; diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx index 75c75f09d..cdcaacbf3 100644 --- a/webapp/components/create_post.jsx +++ b/webapp/components/create_post.jsx @@ -374,12 +374,12 @@ class CreatePost extends React.Component { } if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.keyCode === KeyCodes.UP) { - e.preventDefault(); const channelId = ChannelStore.getCurrentId(); const lastPost = PostStore.getCurrentUsersLatestPost(channelId); - if (!lastPost) { + if (!lastPost || this.state.messageText !== '') { return; } + e.preventDefault(); let message = lastPost.message; if (this.state.lastMessage !== '') { message = this.state.lastMessage; -- cgit v1.2.3-1-g7c22