Skip to content

Commit c47538c

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 1fd544b commit c47538c

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
@@ -277,7 +277,6 @@ void main() {
277277
void checkButtons() {
278278
check(actionSheetFinder).findsOne();
279279
checkButton('Mark channel as read');
280-
checkButton('List of topics');
281280
checkButton('Copy link to channel');
282281
}
283282

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

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

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

429436
group('ChannelFeedButton', () {

0 commit comments

Comments
 (0)