Skip to content

Commit e8e2f33

Browse files
committed
inbox [nfc]: Display realmEmptyTopicDisplayName where empty topic appears
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 4fdc120 commit e8e2f33

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
@@ -531,13 +531,16 @@ class _TopicItem extends StatelessWidget {
531531
child: Text(
532532
style: TextStyle(
533533
fontSize: 17,
534+
// ignore: unnecessary_null_comparison // null topic names soon to be enabled
535+
fontStyle: topic.displayName == null ? FontStyle.italic : null,
534536
height: (20 / 17),
535537
// TODO(design) check if this is the right variable
536538
color: designVariables.labelMenuButton,
537539
),
538540
maxLines: 2,
539541
overflow: TextOverflow.ellipsis,
540-
topic.displayName))),
542+
// ignore: dead_null_aware_expression // null topic names soon to be enabled
543+
topic.displayName ?? store.realmEmptyTopicDisplayName))),
541544
const SizedBox(width: 12),
542545
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
543546
// 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)