Skip to content

Commit ab4bf20

Browse files
committed
compose: Show special topic input hint text for empty topics
A test is skipped because the server does not send empty topics to the client without "empty_topic_name" client capability. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 82bd1a9 commit ab4bf20

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

lib/widgets/compose_box.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ class _FixedDestinationContentInput extends StatelessWidget {
671671
// Zulip expresses channels and topics, not any normal English punctuation,
672672
// so don't make sense to translate. See:
673673
// https://github.com/zulip/zulip-flutter/pull/1148#discussion_r1941990585
674-
'#$streamName > ${topic.displayName}');
674+
// ignore: dead_null_aware_expression // null topic names soon to be enabled
675+
'#$streamName > ${topic.displayName ?? store.realmEmptyTopicDisplayName}');
675676

676677
case DmNarrow(otherRecipientIds: []): // The self-1:1 thread.
677678
return zulipLocalizations.composeBoxSelfDmContentHint;

test/widgets/compose_box_test.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,22 @@ void main() {
395395
});
396396
});
397397

398-
testWidgets('to TopicNarrow', (tester) async {
399-
await prepare(tester,
400-
narrow: TopicNarrow(channel.streamId, TopicName('topic')));
401-
checkComposeBoxHintTexts(tester,
402-
contentHintText: 'Message #${channel.name} > topic');
398+
group('to TopicNarrow', () {
399+
testWidgets('to TopicNarrow with non-empty topic', (tester) async {
400+
await prepare(tester,
401+
narrow: TopicNarrow(channel.streamId, TopicName('topic')),
402+
mandatoryTopics: false);
403+
checkComposeBoxHintTexts(tester,
404+
contentHintText: 'Message #${channel.name} > topic');
405+
});
406+
407+
testWidgets('to TopicNarrow with empty topic', (tester) async {
408+
await prepare(tester,
409+
narrow: TopicNarrow(channel.streamId, TopicName('')),
410+
mandatoryTopics: false);
411+
checkComposeBoxHintTexts(tester, contentHintText:
412+
'Message #${channel.name} > ${eg.defaultRealmEmptyTopicDisplayName}');
413+
}, skip: true); // null topic names soon to be enabled
403414
});
404415

405416
testWidgets('to DmNarrow with self', (tester) async {

0 commit comments

Comments
 (0)