Skip to content

Commit 9ad7427

Browse files
committed
compose [nfc]: Extract _isTopicConsideredEmpty helper
This will later be useful for checking emptiness if realmEmptyTopicDisplayName is given. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 999071e commit 9ad7427

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/widgets/compose_box.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,14 @@ class ComposeTopicController extends ComposeController<TopicValidationError> {
160160
return trimmed.isEmpty ? kNoTopicTopic : trimmed;
161161
}
162162

163+
bool get _isTopicConsideredEmpty {
164+
return textNormalized.isEmpty || textNormalized == kNoTopicTopic;
165+
}
166+
163167
@override
164168
List<TopicValidationError> _computeValidationErrors() {
165169
return [
166-
if (mandatory && textNormalized == kNoTopicTopic)
170+
if (mandatory && _isTopicConsideredEmpty)
167171
TopicValidationError.mandatoryButEmpty,
168172

169173
if (

0 commit comments

Comments
 (0)