diff --git a/lib/widgets/inbox.dart b/lib/widgets/inbox.dart index 0f84a4373d..a8c70bee53 100644 --- a/lib/widgets/inbox.dart +++ b/lib/widgets/inbox.dart @@ -514,6 +514,8 @@ class _TopicItem extends StatelessWidget { final subscription = store.subscriptions[streamId]!; final designVariables = DesignVariables.of(context); + final visibilityIcon = iconDataForTopicVisibilityPolicy( + store.topicVisibilityPolicy(streamId, topic)); return Material( color: designVariables.background, // TODO(design) check if this is the right variable @@ -540,6 +542,8 @@ class _TopicItem extends StatelessWidget { topic))), const SizedBox(width: 12), if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign), + // TODO(design) copies the "@" marker color; is there a better color? + if (visibilityIcon != null) _IconMarker(icon: visibilityIcon), Padding(padding: const EdgeInsetsDirectional.only(end: 16), child: UnreadCountBadge( backgroundColor: colorSwatchFor(context, subscription), diff --git a/test/widgets/inbox_test.dart b/test/widgets/inbox_test.dart index 82cc216189..33b4f00999 100644 --- a/test/widgets/inbox_test.dart +++ b/test/widgets/inbox_test.dart @@ -305,6 +305,56 @@ void main() { }); }); + group('topic visibility', () { + final channel = eg.stream(); + const topic = 'topic'; + final message = eg.streamMessage(stream: channel, topic: topic); + + testWidgets('followed', (tester) async { + await setupPage(tester, + users: [eg.selfUser, eg.otherUser], + streams: [channel], + subscriptions: [eg.subscription(channel)], + unreadMessages: [message]); + await store.addUserTopic(channel, topic, UserTopicVisibilityPolicy.followed); + await tester.pump(); + check(hasIcon(tester, + parent: findRowByLabel(tester, topic), + icon: ZulipIcons.follow)).isTrue(); + }); + + testWidgets('followed and mentioned', (tester) async { + await setupPage(tester, + users: [eg.selfUser, eg.otherUser], + streams: [channel], + subscriptions: [eg.subscription(channel)], + unreadMessages: [eg.streamMessage(stream: channel, topic: topic, + flags: [MessageFlag.mentioned])]); + await store.addUserTopic(channel, topic, UserTopicVisibilityPolicy.followed); + await tester.pump(); + check(hasIcon(tester, + parent: findRowByLabel(tester, topic), + icon: ZulipIcons.follow)).isTrue(); + check(hasIcon(tester, + parent: findRowByLabel(tester, topic), + icon: ZulipIcons.at_sign)).isTrue(); + }); + + + testWidgets('unmuted', (tester) async { + await setupPage(tester, + users: [eg.selfUser, eg.otherUser], + streams: [channel], + subscriptions: [eg.subscription(channel, isMuted: true)], + unreadMessages: [message]); + await store.addUserTopic(channel, topic, UserTopicVisibilityPolicy.unmuted); + await tester.pump(); + check(hasIcon(tester, + parent: findRowByLabel(tester, topic), + icon: ZulipIcons.unmute)).isTrue(); + }); + }); + group('collapsing', () { Icon findHeaderCollapseIcon(WidgetTester tester, Widget headerRow) { return tester.widget(