summaryrefslogtreecommitdiffstats
path: root/web/react/components/create_post.jsx
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-07-21 16:01:30 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-07-21 16:01:30 -0400
commit0967a131a152e056c1cb971f895b2d1f8df4d0ed (patch)
tree5a0eec5b3655509a9b2d4adbb9f89cd209251ce9 /web/react/components/create_post.jsx
parentd4fd000ccfc4f9c128cf178755dd3b1df0cf3894 (diff)
downloadchat-0967a131a152e056c1cb971f895b2d1f8df4d0ed.tar.gz
chat-0967a131a152e056c1cb971f895b2d1f8df4d0ed.tar.bz2
chat-0967a131a152e056c1cb971f895b2d1f8df4d0ed.zip
Prevent users from sending empty ^ reply messages
Diffstat (limited to 'web/react/components/create_post.jsx')
-rw-r--r--web/react/components/create_post.jsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx
index efb5efd80..a2448b569 100644
--- a/web/react/components/create_post.jsx
+++ b/web/react/components/create_post.jsx
@@ -31,6 +31,11 @@ module.exports = React.createClass({
post.message = this.state.messageText;
+ // if this is a reply, trim off any carets from the beginning of a message
+ if (this.state.rootId && post.message.startsWith("^")) {
+ post.message = post.message.replace(/^\^+\s*/g, "");
+ }
+
if (post.message.trim().length === 0 && this.state.previews.length === 0) {
return;
}
@@ -71,11 +76,6 @@ module.exports = React.createClass({
post.root_id = this.state.rootId;
post.parent_id = this.state.parentId;
- // if this is a reply, trim off any carets from the beginning of a message
- if (post.root_id && post.message.startsWith("^")) {
- post.message = post.message.replace(/^\^+\s*/g, "");
- }
-
client.createPost(post, ChannelStore.getCurrent(),
function(data) {
PostStore.storeDraft(data.channel_id, data.user_id, null);