From a20f598049bed68db4330ac2571170e1bf51238e Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Wed, 21 Oct 2020 14:15:12 +0200 Subject: Prevent submitting empty messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/comments/src/components/Comment.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apps/comments') diff --git a/apps/comments/src/components/Comment.vue b/apps/comments/src/components/Comment.vue index edcaeafb7b6..d90d5a7fb6a 100644 --- a/apps/comments/src/components/Comment.vue +++ b/apps/comments/src/components/Comment.vue @@ -215,11 +215,16 @@ export default { * Dispatch message between edit and create */ onSubmit() { + // Do not submit if message is empty + if (this.localMessage.trim() === '') { + return + } + if (this.editor) { - this.onNewComment(this.localMessage) + this.onNewComment(this.localMessage.trim()) return } - this.onEditComment(this.localMessage) + this.onEditComment(this.localMessage.trim()) }, }, -- cgit v1.2.3