Skip to content

Commit 319a3d5

Browse files
committed
msglist: Show visibility policy on recipient headers
This design was inspired by the legacy mobile app. Reference: https://github.com/zulip/zulip-mobile/blob/a115df1f71c9dc31e9b41060a8d57b51c017d786/src/streams/TopicItem.js#L47-L51 Signed-off-by: Zixuan James Li <[email protected]>
1 parent 24b5baf commit 319a3d5

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

lib/widgets/message_list.dart

+16-5
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
10201020
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=538%3A20849&mode=dev
10211021
// https://github.com/zulip/zulip-mobile/issues/5511
10221022
final store = PerAccountStoreWidget.of(context);
1023+
final designVariables = DesignVariables.of(context);
10231024

10241025
final topic = message.topic;
10251026

@@ -1093,11 +1094,21 @@ class StreamMessageRecipientHeader extends StatelessWidget {
10931094
Expanded(
10941095
child: Padding(
10951096
padding: const EdgeInsets.symmetric(vertical: 11),
1096-
child: Text(topic,
1097-
// TODO: Give a way to see the whole topic (maybe a
1098-
// long-press interaction?)
1099-
overflow: TextOverflow.ellipsis,
1100-
style: recipientHeaderTextStyle(context)))),
1097+
child: Row(
1098+
children: [
1099+
Flexible(
1100+
child: Text(topic,
1101+
// TODO: Give a way to see the whole topic (maybe a
1102+
// long-press interaction?)
1103+
overflow: TextOverflow.ellipsis,
1104+
style: recipientHeaderTextStyle(context))),
1105+
const SizedBox(width: 4),
1106+
// TODO(design) copies the recipient header in web; is there a better color?
1107+
Icon(size: 14, color: designVariables.colorMessageHeaderIconInteractive,
1108+
// A null [Icon.icon] makes a blank space.
1109+
iconDataForTopicVisibilityPolicy(
1110+
store.topicVisibilityPolicy(message.streamId, topic))),
1111+
]))),
11011112
// TODO topic links?
11021113
// Then web also has edit/resolve/mute buttons. Skip those for mobile.
11031114
RecipientHeaderDate(message: message),

test/widgets/message_list_test.dart

+24
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,30 @@ void main() {
803803
check(findInMessageList('topic name')).length.equals(1);
804804
});
805805

806+
testWidgets('show topic visibility icon when followed', (tester) async {
807+
await setupMessageListPage(tester,
808+
narrow: const CombinedFeedNarrow(),
809+
messages: [message], subscriptions: [eg.subscription(stream)]);
810+
await store.handleEvent(eg.userTopicEvent(
811+
stream.streamId, message.topic, UserTopicVisibilityPolicy.followed));
812+
await tester.pump();
813+
check(find.descendant(
814+
of: find.byType(MessageList),
815+
matching: find.byIcon(ZulipIcons.follow))).findsOne();
816+
});
817+
818+
testWidgets('show topic visibility icon when unmuted', (tester) async {
819+
await setupMessageListPage(tester,
820+
narrow: TopicNarrow.ofMessage(message),
821+
messages: [message], subscriptions: [eg.subscription(stream, isMuted: true)]);
822+
await store.handleEvent(eg.userTopicEvent(
823+
stream.streamId, message.topic, UserTopicVisibilityPolicy.unmuted));
824+
await tester.pump();
825+
check(find.descendant(
826+
of: find.byType(MessageList),
827+
matching: find.byIcon(ZulipIcons.unmute))).findsOne();
828+
});
829+
806830
testWidgets('color of recipient header background', (tester) async {
807831
final subscription = eg.subscription(stream, color: Colors.red.argbInt);
808832
final swatch = ChannelColorSwatch.light(subscription.color);

0 commit comments

Comments
 (0)