Skip to content
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

subscription_list: Show @-mention indicator when that applies #875

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Khader-1
Copy link
Collaborator

@Khader-1 Khader-1 commented Aug 9, 2024

Fixes: #747

unreads changes here are reflections of what web has at unread.ts

image

@Khader-1 Khader-1 force-pushed the subscription-list-mention branch 2 times, most recently from 838e874 to 2656d84 Compare August 9, 2024 20:30
@Khader-1 Khader-1 marked this pull request as ready for review August 9, 2024 20:31
@Khader-1 Khader-1 requested a review from sm-sayedi August 9, 2024 20:31
@Khader-1 Khader-1 added the buddy review GSoC buddy review needed. label Aug 9, 2024
Copy link
Collaborator

@sm-sayedi sm-sayedi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Khader-1 for this. LGTM! Moving on to the mentor review! cc @kenclary

@sm-sayedi sm-sayedi added mentor review GSoC mentor review needed. and removed buddy review GSoC buddy review needed. labels Aug 10, 2024
@Khader-1 Khader-1 force-pushed the subscription-list-mention branch 2 times, most recently from 99d2413 to e159b22 Compare August 10, 2024 20:23
@Khader-1 Khader-1 requested a review from kenclary August 10, 2024 20:24
Copy link
Collaborator

@kenclary kenclary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Khader-1 Khader-1 added maintainer review PR ready for review by Zulip maintainers and removed mentor review GSoC mentor review needed. labels Aug 11, 2024
@Khader-1 Khader-1 force-pushed the subscription-list-mention branch 2 times, most recently from 39188fd to d7a742d Compare August 13, 2024 09:26
@Khader-1
Copy link
Collaborator Author

Khader-1 commented Aug 14, 2024

Thanks @sm-sayedi and @kenclary for the reviews!
I figured that there are more cases that still need handling..
Specifically, the unread count / muted unread badge are related have more complex cases when there are mentions, I'll make more investigation on zulip/zulip and update this comment.

And currently, we don't have a record for muted mentions which should be is fixed in this PR by:
e5945bb msglist: Add message to mentions if mentioned.
So marking this as a draft for now until it is ready.

@Khader-1 Khader-1 force-pushed the subscription-list-mention branch 2 times, most recently from 9874510 to e4b4101 Compare August 14, 2024 17:00
@chrisbobbe
Copy link
Collaborator

GitHub is showing there's a conflict in lib/widgets/theme.dart, could you resolve that please?

@Khader-1
Copy link
Collaborator Author

Sure! just fixed PTAL @chrisbobbe.

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've read through the first six commits:

69abbbc msglist: Add message to mentions if mentioned
200129e unreads [nfc]: Introduce _reverseStreamsLookup data structure
674c4ad unreads [nfc]: Enhance performance in _isPresentInStreams
6e9afd5 unreads [nfc]: Enhance performance in _removeAllInStreams
195c1de inbox [nfc]: Move AtMentionMarker to unread_count_badge
2e18afd inbox [nfc]: Introduce muted property to AtMentionMarker

with the last two left for next time:

0c52009 subscription_list: Show @-mention marker when that applies
64ac89e subscription_list: Show unread count when hasOnlyMutedMentions

because it looks like there's something to be straightened out in that sixth commit, as noted below. (All of AtMentionMarker's callers passing muted: true, which I think doesn't make sense intuitively.)

lib/model/message_list.dart Outdated Show resolved Hide resolved
lib/model/unreads.dart Outdated Show resolved Hide resolved
lib/model/unreads.dart Outdated Show resolved Hide resolved
lib/model/unreads.dart Outdated Show resolved Hide resolved
lib/model/unreads.dart Outdated Show resolved Hide resolved
lib/widgets/inbox.dart Outdated Show resolved Hide resolved
lib/widgets/unread_count_badge.dart Show resolved Hide resolved
lib/widgets/theme.dart Outdated Show resolved Hide resolved
Comment on lines 117 to 120
atMentionMarker: const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(),
atMentionMarker: const HSLColor.fromAHSL(0.7, 0, 0, 0.2).toColor(),
mutedAtMentionMarker: const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain how you chose both of these colors? I see `atMentionMarker was changed from its previous value, but I don't understand why.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I've tried to copy the values from the web app.. here is my inspector values:
for unmuted mentions and mentions in inbox screen
hsl(0, 0, 0.2) or #333 with an opacity 0.7

And for muted mentions:

hsla(0, 0%, 20%, .5) with an opacity 0.7

Which could be simplified as: hsla(0, 0%, 20%, 0.35)

Please let me know if I am missing something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will probably be helpful to link (in the commit message) the lines containing the CSS styles in effect.

@Khader-1 Khader-1 force-pushed the subscription-list-mention branch 4 times, most recently from 2d1e718 to 74a010b Compare September 11, 2024 08:22
@gnprice gnprice requested review from PIG208 and removed request for chrisbobbe September 12, 2024 18:49
Copy link
Member

@PIG208 PIG208 left a 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! Left some comments.

When testing this manually, I observed that the @-mention marker shows up for all channels with unreads in the subscription list, even if those channels do not contain unread mentions. So that's something we can cover in tests as well.

@@ -236,6 +234,19 @@ class Unreads extends ChangeNotifier {
notifyListeners();
}

void onMessagesFetched(List<Message> messages) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: onSomething typically names a parameter that takes a callback function. reconcileMessages might be a better name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Logically, the new method is different from the group of handleFooEvents methods, so perhaps we should move it before handleMessageEvent. This way the implementation matches the current order in tests too.

lib/model/unreads.dart Outdated Show resolved Hide resolved
lib/model/unreads.dart Outdated Show resolved Hide resolved
lib/model/unreads.dart Show resolved Hide resolved
test/model/unreads_test.dart Outdated Show resolved Hide resolved
test/model/unreads_test.dart Show resolved Hide resolved
test/model/unreads_test.dart Show resolved Hide resolved
lib/model/unreads.dart Outdated Show resolved Hide resolved
@@ -230,7 +235,8 @@ class SubscriptionItem extends StatelessWidget {

final swatch = colorSwatchFor(context, subscription);
final hasUnreads = (unreadCount > 0);
final opacity = subscription.isMuted ? 0.55 : 1.0;
const mutedOpacity = 0.55;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to link the source of the opacity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if I got it correctly; I just used the same one that we've used before for the channel name and unread count badge.

Are you suggesting to link it to zulip mobile or web design?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. Yeah 0.55 is not new here; it was added in b0b8a50. The design came from Vlad here. Perhaps we can link to that GitHub comment in an NFC commit.

test/widgets/subscription_list_test.dart Show resolved Hide resolved
Comment on lines +198 to +201
final hasOnlyMutedMentions = !subscription.isMuted && hasMentions
&& !channelsWithUnmutedMentions.contains(subscription.streamId);
final mutedUnreadCount = hasOnlyMutedMentions && unreadCount == 0 ?
unreadsModel!.countAll(subscription.streamId) : 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like there's a lot of different conditions that are interacting here, which means there are a lot of different cases for how this can end up behaving. I can't easily tell from reading this code what all those cases are and what its behavior is in all of them, which makes it hard to tell if the behavior is what we want.

Can you try laying out (just in text, in this thread) what you believe the different cases are for a given channel, and how you believe this screen should behave in each case? Then we can discuss at that level what behavior we want, and then go back to the code and make sure the code reflects that behavior.

(Ultimately I suspect we can express the desired behavior with somewhat simpler logic than this.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer review PR ready for review by Zulip maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SubscriptionListPage: Show @-mention indicator beside channel unread-count badge
6 participants