Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIS-1038] Fix composer allowing whitespace only messages to be sent #1293

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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