Skip to content

Commit 14597e7

Browse files
committed
inbox: Display realmEmptyTopicDisplayName on empty topic
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 8553903 commit 14597e7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/widgets/inbox.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,16 @@ class _TopicItem extends StatelessWidget {
526526
child: Text(
527527
style: TextStyle(
528528
fontSize: 17,
529+
// ignore: unnecessary_null_comparison // null topic names soon to be enabled
530+
fontStyle: (topic.displayName == null) ? FontStyle.italic : null,
529531
height: (20 / 17),
530532
// TODO(design) check if this is the right variable
531533
color: designVariables.labelMenuButton,
532534
),
533535
maxLines: 2,
534536
overflow: TextOverflow.ellipsis,
535-
topic.displayName))),
537+
// ignore: dead_null_aware_expression // null topic names soon to be enabled
538+
topic.displayName ?? store.realmEmptyTopicDisplayName))),
536539
const SizedBox(width: 12),
537540
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
538541
// TODO(design) copies the "@" marker color; is there a better color?

test/widgets/inbox_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,16 @@ void main() {
307307
});
308308
});
309309

310+
testWidgets('empty topic', (tester) async {
311+
final channel = eg.stream();
312+
await setupPage(tester,
313+
streams: [channel],
314+
subscriptions: [(eg.subscription(channel))],
315+
unreadMessages: [eg.streamMessage(stream: channel, topic: '')]);
316+
317+
check(find.text(eg.defaultRealmEmptyTopicDisplayName)).findsOne();
318+
}, skip: true); // null topic names soon to be enabled
319+
310320
group('topic visibility', () {
311321
final channel = eg.stream();
312322
const topic = 'topic';

0 commit comments

Comments
 (0)