From 7eba55facee0dff1aff0069a7b9f4c3a44ab64d3 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Wed, 2 Jul 2025 18:21:29 -0700 Subject: [PATCH] msglist: Softly override mark-read-on-scroll setting in starred/mentions This isn't so "soft" right now, because we don't offer a way to undo the override -- that's #1655, as the new comment says -- but conceptually this seems correct and seems to match web. We'll do this for search, too, coming up. --- lib/widgets/message_list.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/widgets/message_list.dart b/lib/widgets/message_list.dart index 39ab1b4f04..9675f86eab 100644 --- a/lib/widgets/message_list.dart +++ b/lib/widgets/message_list.dart @@ -146,6 +146,9 @@ abstract class MessageListPageState { /// /// For example, this is set to false after pressing /// "Mark as unread from here" in the message action sheet. + // TODO(#1655) When this is false and + // [GlobalSettingsStore.markReadOnScrollForNarrow] gives true, + // show an alert and a button that lets you exit this temporary state. bool? get markReadOnScroll; set markReadOnScroll(bool? value); } @@ -235,6 +238,18 @@ class _MessageListPageState extends State implements MessageLis void initState() { super.initState(); narrow = widget.initNarrow; + + switch (narrow) { + case CombinedFeedNarrow(): + case ChannelNarrow(): + case TopicNarrow(): + case DmNarrow(): + break; + case MentionsNarrow(): + case StarredMessagesNarrow(): + // TODO(#1583) write tests for this + _markReadOnScroll = false; + } } void _narrowChanged(Narrow newNarrow) {