Skip to content

Commit de46396

Browse files
committed
compose [nfc]: Handle empty topics for fixed destination input hint text
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 89291a0 commit de46396

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
@@ -658,7 +658,8 @@ class _FixedDestinationContentInput extends StatelessWidget {
658658
// Zulip expresses channels and topics, not any normal English punctuation,
659659
// so don't make sense to translate. See:
660660
// https://github.com/zulip/zulip-flutter/pull/1148#discussion_r1941990585
661-
'#$streamName > ${topic.displayName}');
661+
// ignore: dead_null_aware_expression // null topic names soon to be enabled
662+
'#$streamName > ${topic.displayName ?? store.realmEmptyTopicDisplayName}');
662663

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

test/widgets/compose_box_test.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,22 @@ void main() {
371371
});
372372
});
373373

374-
testWidgets('to TopicNarrow', (tester) async {
375-
await prepare(tester,
376-
narrow: TopicNarrow(channel.streamId, TopicName('topic')));
377-
checkComposeBoxHintTexts(tester,
378-
contentHintText: 'Message #${channel.name} > topic');
374+
group('to TopicNarrow', () {
375+
testWidgets('to TopicNarrow with non-empty topic', (tester) async {
376+
await prepare(tester,
377+
narrow: TopicNarrow(channel.streamId, TopicName('topic')),
378+
mandatoryTopics: false);
379+
checkComposeBoxHintTexts(tester,
380+
contentHintText: 'Message #${channel.name} > topic');
381+
});
382+
383+
testWidgets('to TopicNarrow with empty topic', (tester) async {
384+
await prepare(tester,
385+
narrow: TopicNarrow(channel.streamId, TopicName('')),
386+
mandatoryTopics: false);
387+
checkComposeBoxHintTexts(tester, contentHintText:
388+
'Message #${channel.name} > ${eg.defaultRealmEmptyTopicDisplayName}');
389+
}, skip: true); // null topic names soon to be enabled
379390
});
380391

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

0 commit comments

Comments
 (0)