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

home: Sort leading emoji first in channel names #1234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lakshya1goel
Copy link

Update the channel sorting logic to ensure streams with leading emojis in their names are listed above those without emojis. The updated sorting respects pinned, muted, and unmuted streams while handling emoji precedence and maintaining alphabetical order for ties.

Fixes: #1202

@lakshya1goel
Copy link
Author

Hello, @chrisbobbe I have done the required changes. Please have a look and let me know if anything else is required.
Thanks!

@PIG208 PIG208 added the maintainer review PR ready for review by Zulip maintainers label Jan 9, 2025
@lakshya1goel
Copy link
Author

Hi @chrisbobbe @PIG208
I just wanted to kindly follow up on this PR. I have made the changes requested, and I requested a review about two weeks ago. If you could take a moment to review it, I would greatly appreciate your feedback.
Thank you for your time and support!

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! Small comments below.

lib/widgets/subscription_list.dart Outdated Show resolved Hide resolved
lib/widgets/subscription_list.dart Outdated Show resolved Hide resolved
test/widgets/subscription_list_test.dart Outdated Show resolved Hide resolved
test/widgets/subscription_list_test.dart Show resolved Hide resolved
@lakshya1goel lakshya1goel force-pushed the issue1202 branch 2 times, most recently from 6167d68 to 0c567a3 Compare January 18, 2025 03:46
@lakshya1goel
Copy link
Author

Thanks for the detailed review. I have made the required changes.
Please have a look on it.

@lakshya1goel
Copy link
Author

Pushed the changes atop #1290 for the sake of CI.

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! Small comments below.

lib/widgets/subscription_list.dart Show resolved Hide resolved
test/widgets/subscription_list_test.dart Outdated Show resolved Hide resolved
@lakshya1goel
Copy link
Author

I have updated the commit message and the description of tests. Let me know if anything else is required.
Thanks!

@chrisbobbe
Copy link
Collaborator

Thanks! Marking for Greg's review.

@chrisbobbe chrisbobbe added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Jan 22, 2025
@chrisbobbe chrisbobbe requested review from gnprice and removed request for chrisbobbe January 22, 2025 20:22
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @lakshya1goel for taking care of this, and @chrisbobbe for the previous reviews!

Generally this looks good. A couple of small comments below.

@@ -41,10 +41,22 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
});
}

final _startsWithEmojiRegex = RegExp(r'^\p{Emoji}', unicode: true);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final _startsWithEmojiRegex = RegExp(r'^\p{Emoji}', unicode: true);
static final _startsWithEmojiRegex = RegExp(r'^\p{Emoji}', unicode: true);

That way there's just one of these shared by any number of instances of this class.

Comment on lines +160 to +162
]);

check(listedStreamIds(tester)).deepEquals([3, 2, 4, 1]);
Copy link
Member

Choose a reason for hiding this comment

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

nit: similar comment to #1193 (comment) (but this one is smaller-scale): compare to the style of neighboring tests and see how you can make this one more compact by following those

// emoji-prefixed channels first; see #1202.
// For matching web's ordering completely, see:
// https://github.com/zulip/zulip-flutter/issues/1165
final aStartsWithEmoji = _startsWithEmojiRegex.hasMatch(a.name);
Copy link
Member

Choose a reason for hiding this comment

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

commit-message nit:

home: Sort leading emoji first in channel names

The prefix "home:" doesn't seem right for what this commit is doing — it's really about the subscription-list page in particular.

To see previous examples from commits that touched this file, use git log --oneline:
$ git log --oneline --no-decorate lib/widgets/subscription_list.dart
46b30f7 nav: Remove *Page widgets for page bodies that can be reached in HomePage
084cb2f nav [nfc]: Extract some *PageBody widgets
50d39ea app_bar [nfc]: Move ZulipAppBar.isLoading to within widget
a9d9ef8 ui: Extract ZulipAppBar for loading indicator.
f0b3596 subscription_list: Show a dot for unreads if channel is muted
5d80ad5 subscription_list: Ensure bold name applies for unmuted streams only
726ccb6 subscription_list [nfc]: Place provisional dark-theme colors pending design
07131d2 subscription_list: For channel text, use #222222 instead of #262626
84b64fc unreads [nfc]: Rename countInChannel from "stream", to match its twin
8cf3b6a narrow [nfc]: Rename StreamNarrow to ChannelNarrow
b0b8a50 subscription_list: Show muted streams as faded in streams list
b517593 subscription_list: Show muted streams below unmuted ones
fba909b ui: Provide [StreamColorSwatch]es via DesignVariables, not api/model/
db064a0 subscription_list [nfc]: Update a stale issue reference
ef1a876 subscription_list [nfc]: Update a stale issue reference
187ecb0 ui: Rename stream to channel in user-facing strings
d67b1f2 ui [nfc]: Comment with TODO(#95) where we need dark-theme colors
abfaed8 subscription_list [nfc]: Factor out helper for dividing line
74aa25d text: Use proportionalLetterSpacing in the few existing places that want it
51c7b69 subscription_list: Fix stream name sorting case insensitively
582bc44 nav [nfc]: Accept an explicit account ID on account page routes
6784ef9 text [nfc]: Remove some now-redundant fontFamily{,Fallback} attributes
139fc34 text [nfc]: Don't force any callers to specify wghtIfPlatformRequestsBold
51eaddd text: On Android, render emojis in message content with Noto Color Emoji
117670a text [nfc]: Pull out kDefaultFontFamily constant
0d03c8e unread: Apply stream and topic muting to unread counts
93cefca subscription_list: Handle insets with a SafeArea
0618adc subscription_list [nfc]: Remove unneeded [Center]
e4e2e88 subscription_list: Add new SubscriptionListPage

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

Successfully merging this pull request may close these issues.

Sort leading emoji first in channel names to match web
4 participants