Skip to content
Snippets Groups Projects
Commit 315a57f4 authored by Sebastian's avatar Sebastian Committed by Mikolai Gütschow
Browse files

Trim leading and trailing whitespace from message input

parent 0930d80f
No related branches found
No related tags found
1 merge request!110Trim leading and trailing whitespace from message input
Pipeline #9258 passed
......@@ -126,8 +126,10 @@ constructor(
val text = _newMessage.value
val image = _newMessageImage.value
val trimmed = text.trim()
// don't send empty or blank messages
if (text.isBlank() && image == null) return
if (trimmed.isBlank() && image == null) return
_newMessage.value = ""
_newMessageImage.value = null
......@@ -154,7 +156,7 @@ constructor(
runOnDbThreadWithTransaction(false) { txn ->
try {
val start = LogUtils.now()
val m = createMessage(txn, contactId, groupId!!, text, headers)
val m = createMessage(txn, contactId, groupId, trimmed, headers)
messagingManager.addLocalMessage(txn, m)
LOG.logDuration("Storing message", start)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment