Merge pull request #5390 from matrix-org/t3chguy/fix/15524

Disallow sending of empty messages
This commit is contained in:
Michael Telatynski 2020-11-11 10:23:32 +00:00 committed by GitHub
commit f73573881e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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