Skip to content

Commit 65e0d4a

Browse files
PIG208gnprice
authored andcommitted
inbox [nfc]: Display realmEmptyTopicDisplayName where empty topic appears
While this appears to be a user facing change, it's not visible yet, not until TopicName.displayName becomes nullable. This is a part of a series of changes to handle empty topics. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 0ba9b44 commit 65e0d4a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/widgets/inbox.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,15 @@ class _TopicItem extends StatelessWidget {
532532
style: TextStyle(
533533
fontSize: 17,
534534
height: (20 / 17),
535+
// ignore: unnecessary_null_comparison // null topic names soon to be enabled
536+
fontStyle: topic.displayName == null ? FontStyle.italic : null,
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ 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+
check(find.text(eg.defaultRealmEmptyTopicDisplayName)).findsOne();
317+
}, skip: true); // null topic names soon to be enabled
318+
310319
group('topic visibility', () {
311320
final channel = eg.stream();
312321
const topic = 'topic';

0 commit comments

Comments
 (0)