Skip to content

Commit e12673a

Browse files
committed
topic_list: Don't show topic-list button in action sheet from app bar
Similarly to how we don't show the "Channel feed" button when opening the same action sheet from a channel feed.
1 parent 8e32b3c commit e12673a

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

lib/widgets/topic_list.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ class _TopicListAppBarTitle extends StatelessWidget {
103103
child: GestureDetector(
104104
behavior: HitTestBehavior.translucent,
105105
onLongPress: () {
106-
showChannelActionSheet(context, channelId: streamId);
106+
showChannelActionSheet(context,
107+
channelId: streamId,
108+
// We're already on the topic list.
109+
showTopicListButton: false);
107110
},
108111
child: Align(alignment: alignment,
109112
child: _buildStreamRow(context))));

test/widgets/action_sheet_test.dart

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ void main() {
278278
void checkButtons() {
279279
check(actionSheetFinder).findsOne();
280280
checkButton('Mark channel as read');
281-
checkButton('List of topics');
282281
checkButton('Copy link to channel');
283282
}
284283

@@ -414,17 +413,25 @@ void main() {
414413
});
415414
});
416415

417-
testWidgets('TopicListButton', (tester) async {
418-
await prepare();
419-
await showFromMsglistAppBar(tester,
420-
narrow: ChannelNarrow(someChannel.streamId));
416+
group('TopicListButton', () {
417+
testWidgets('not visible from app bar on topic list', (tester) async {
418+
await prepare();
419+
await showFromTopicListAppBar(tester);
420+
checkNoButton('List of topics');
421+
});
421422

422-
connection.prepare(json: GetStreamTopicsResult(topics: [
423-
eg.getStreamTopicsEntry(name: 'some topic foo'),
424-
]).toJson());
425-
await tester.tap(findButtonForLabel('List of topics'));
426-
await tester.pumpAndSettle();
427-
check(find.text('some topic foo')).findsOne();
423+
testWidgets('happy path from msglist app bar', (tester) async {
424+
await prepare();
425+
await showFromMsglistAppBar(tester,
426+
narrow: ChannelNarrow(someChannel.streamId));
427+
428+
connection.prepare(json: GetStreamTopicsResult(topics: [
429+
eg.getStreamTopicsEntry(name: 'some topic foo'),
430+
]).toJson());
431+
await tester.tap(findButtonForLabel('List of topics'));
432+
await tester.pumpAndSettle();
433+
check(find.text('some topic foo')).findsOne();
434+
});
428435
});
429436

430437
group('ChannelFeedButton', () {

0 commit comments

Comments
 (0)