-
Notifications
You must be signed in to change notification settings - Fork 309
@-mention markers #509
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
@-mention markers #509
Conversation
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.
Thanks @sirpengi! Generally this looks good. Small comments below.
lib/widgets/inbox.dart
Outdated
class _AtMentionMarker extends StatelessWidget { | ||
const _AtMentionMarker(); | ||
|
||
static Color markerColor = const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(); |
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.
static Color markerColor = const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(); | |
static final markerColor = const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(); |
(If we wanted to be explicit about the type, it'd be static final Color markerColor = …
.)
lib/widgets/inbox.dart
Outdated
isMentioned: isMentioned, | ||
streamCount: data.count, | ||
streamIsMentioned: data.isMentioned, |
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.
These "is mentioned" names work if the subject is implicitly taken to be the self-user — the user is mentioned — but because they're attached to objects describing a topic or a stream etc., they sound a lot more like "this topic is mentioned", "this stream is mentioned", etc.
Let's therefore say "has mention" rather than "is mentioned": so hasMention
, streamHasMention
, and so on.
lib/widgets/inbox.dart
Outdated
final isMentioned = messageIds.any((messageId) => unreadsModel!.mentions.contains(messageId)); | ||
topicItems.add((topic, countInTopic, isMentioned, messageIds.last)); | ||
countInStream += countInTopic; | ||
if (isMentioned) mentionedInStream = true; |
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.
nit:
final isMentioned = messageIds.any((messageId) => unreadsModel!.mentions.contains(messageId)); | |
topicItems.add((topic, countInTopic, isMentioned, messageIds.last)); | |
countInStream += countInTopic; | |
if (isMentioned) mentionedInStream = true; | |
final isMentioned = messageIds.any((messageId) => unreadsModel!.mentions.contains(messageId)); | |
if (isMentioned) mentionedInStream = true; | |
topicItems.add((topic, countInTopic, isMentioned, messageIds.last)); | |
countInStream += countInTopic; |
This ordering is a bit more consistent internally — mentions, then counts, rather than mention, count, mention — and also keeps this code parallel with the similar code for DMs above.
lib/widgets/inbox.dart
Outdated
header: _AllDmsHeaderItem( | ||
count: allDmsCount, | ||
isMentioned: isMentioned, |
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.
This seems wrong — it's using the is-mentioned flag for the individual DM conversation, but passing it to use for the all-DMs header.
Hmm but I can't actually trigger any symptom from that bug.
… Aha. This header has no effect! That's a pre-existing latent bug in this file. What's happening is that the items of the list view are the entire sections — all DMs, then each stream — and not the individual conversations, so the StickyHeaderItem
widgets on the individual conversations never get consulted.
I'll send a quick PR removing those StickyHeaderItem
s, to avoid causing us similar confusion in the future. Then you can rebase atop that PR, and I think it will slightly simplify some of this code.
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.
Padding(padding: const EdgeInsetsDirectional.only(end: 16), | ||
child: UnreadCountBadge(backgroundColor: subscription.colorSwatch(), | ||
count: count)), | ||
]))))); | ||
} | ||
} | ||
|
||
class _AtMentionMarker extends StatelessWidget { |
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.
These two commits are best squashed together:
ce34ec0 inbox: Show at-mention marker on topics
b6ac522 inbox [nfc]: Pull out _AtMentionMarker
because the latter basically amounts to rethinking how to arrange some of the code added by the former, and so it's simplest to go straight to the revised way of arranging it.
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.
In fact let's squash those together with the next commit, handling streams:
ce34ec0 inbox: Show at-mention marker on topics
b6ac522 inbox [nfc]: Pull out _AtMentionMarker
6e74d2a inbox: Show at-mention marker on streams
That way there isn't an intermediate state where we have @-mention markers on the individual topics but missing on the streams, which feels a little glitchy given expectations set by web. And conversely the squashed commit is still a quite reasonable size.
c57bd8a
to
1b4adc0
Compare
@gnprice ready for review again! |
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.
Thanks for the revision! Generally this all looks good now, pending #510. One nit below.
// TODO(#384) for streams, show @-mention indicator when it applies | ||
if (hasMention) const _AtMentionMarker(), |
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.
nit in commit message:
inbox: Show at-mention marker on topics
Should say "topics and streams", since the same commit does it for streams too.
1b4adc0
to
aad1988
Compare
Taken today from Figma at: https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=171-12359&mode=design&t=LQ4ZzSZnD39eDpDf-0 Exported svg was processed in inkscape to expand strokes to paths and resulting file cleaned of unnecessary markup.
This will be used later to match other types of rows.
The `hasMention` flag was added to the abstract `_HeaderItem` class so `_AllDmsHeaderItem` is affected by this change. It isn't used in the DMs header for now so will be hard-coded as False and changed in the next commit.
aad1988
to
ee99129
Compare
Thanks! Looks good, and #510 is now in, so merging. |
This PR is built on top of #510
Fixes: #384