Skip to content

Commit d6cf34a

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

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
@@ -537,13 +537,16 @@ class _TopicItem extends StatelessWidget {
537537
child: Text(
538538
style: TextStyle(
539539
fontSize: 17,
540+
// ignore: unnecessary_null_comparison // null topic names soon to be enabled
541+
fontStyle: topic.displayName == null ? FontStyle.italic : null,
540542
height: (20 / 17),
541543
// TODO(design) check if this is the right variable
542544
color: designVariables.labelMenuButton,
543545
),
544546
maxLines: 2,
545547
overflow: TextOverflow.ellipsis,
546-
topic.displayName))),
548+
// ignore: dead_null_aware_expression // null topic names soon to be enabled
549+
topic.displayName ?? store.realmEmptyTopicDisplayName))),
547550
const SizedBox(width: 12),
548551
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
549552
// 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)