-
Notifications
You must be signed in to change notification settings - Fork 315
msglist: Show recipient headers on all messages, in Mentions / Starred #1638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,8 @@ enum FetchingStatus { | |
/// | ||
/// This comprises much of the guts of [MessageListView]. | ||
mixin _MessageSequence { | ||
bool get oneMessagePerBlock; | ||
|
||
/// A sequence number for invalidating stale fetches. | ||
int generation = 0; | ||
|
||
|
@@ -435,7 +437,11 @@ mixin _MessageSequence { | |
required MessageListMessageBaseItem Function(bool canShareSender) buildItem, | ||
}) { | ||
final bool canShareSender; | ||
if (prevMessage == null || !haveSameRecipient(prevMessage, message)) { | ||
if ( | ||
prevMessage == null | ||
|| oneMessagePerBlock | ||
|| !haveSameRecipient(prevMessage, message) | ||
) { | ||
items.add(MessageListRecipientHeaderItem(message)); | ||
canShareSender = false; | ||
} else { | ||
|
@@ -613,6 +619,15 @@ class MessageListView with ChangeNotifier, _MessageSequence { | |
Anchor get anchor => _anchor; | ||
Anchor _anchor; | ||
|
||
@override bool get oneMessagePerBlock => switch (narrow) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this feels to me like it belongs after the lifecycle methods, next to _messageVisible and friends |
||
CombinedFeedNarrow() | ||
|| ChannelNarrow() | ||
|| TopicNarrow() | ||
|| DmNarrow() => false, | ||
MentionsNarrow() | ||
|| StarredMessagesNarrow() => true, | ||
Comment on lines
+622
to
+628
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic should get some dartdoc, to guide people adding cases to it in the future.
Comment on lines
+622
to
+628
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to have a test that would fail if this started being all true or all false. Maybe a quick test case for a channel narrow, and another for the mentions narrow, showing different results with the same two messages. |
||
}; | ||
|
||
void _register() { | ||
store.registerMessageList(this); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptually I think this should be private. It is convenient to use it in checkInvariants; but then let's mark it
@visibleForTesting
.