Skip to content

Commit

Permalink
Fix composer allowing whitespace only messages to be sent
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahadir Oncel authored and b-onc committed Jul 20, 2021
1 parent 11ed592 commit 89732b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### 🐞 Fixed
- Fix an issue where member role sent from backend was not recognized by the SDK [#1288](https://github.com/GetStream/stream-chat-swift/pull/1288)
- Fix crash in `ChannelListUpdater` caused by the lifetime not aligned with `ChatClient` [#1289](https://github.com/GetStream/stream-chat-swift/pull/1289)
- Fix composer allowing sending whitespace only messages [#1293](https://github.com/GetStream/stream-chat-swift/issues/1293)

### 🔄 Changed

Expand Down
4 changes: 2 additions & 2 deletions Sources/StreamChatUI/Composer/ComposerVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ open class _ComposerVC<ExtraData: ExtraDataTypes>: _ViewController,

/// A boolean that checks if the message contains any content.
public var isEmpty: Bool {
text.isEmpty && attachments.isEmpty
text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty && attachments.isEmpty
}

/// A boolean that checks if the composer is replying in a thread
Expand Down Expand Up @@ -386,7 +386,7 @@ open class _ComposerVC<ExtraData: ExtraDataTypes>: _ViewController,
if let command = content.command {
text = "/\(command.name) " + content.text
} else {
text = content.text
text = content.text.trimmingCharacters(in: .whitespacesAndNewlines)
}

if let editingMessage = content.editingMessage {
Expand Down

0 comments on commit 89732b5

Please sign in to comment.