From cfb9d0f2d45ace5ad80862e038c0f366668bf50f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 3 Nov 2020 16:06:45 +0000 Subject: [PATCH] Disallow sending of empty messages --- src/components/views/rooms/SendMessageComposer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/views/rooms/SendMessageComposer.js b/src/components/views/rooms/SendMessageComposer.js index 9438cceef5..78b1dd85db 100644 --- a/src/components/views/rooms/SendMessageComposer.js +++ b/src/components/views/rooms/SendMessageComposer.js @@ -308,6 +308,9 @@ export default class SendMessageComposer extends React.Component { const startTime = CountlyAnalytics.getTimestamp(); const {roomId} = this.props.room; const content = createMessageContent(this.model, this.props.permalinkCreator, replyToEvent); + // don't bother sending an empty message + if (!content.body.trim()) return; + const prom = this.context.sendMessage(roomId, content); if (replyToEvent) { // Clear reply_to_event as we put the message into the queue