Skip to content

subscription_list: Show muted streams as faded in streams list #711

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

Merged

Conversation

Khader-1
Copy link
Collaborator

@Khader-1 Khader-1 commented May 30, 2024

Fixes: #424

After Before
image image

@Khader-1 Khader-1 added the buddy review GSoC buddy review needed. label May 30, 2024
@Khader-1 Khader-1 requested a review from sm-sayedi May 30, 2024 01:21
@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from f25e276 to f2b71c2 Compare May 30, 2024 06:57
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. LGTM! Just a few small comments below.

@Khader-1 Khader-1 added mentor review GSoC mentor review needed. buddy review GSoC buddy review needed. and removed buddy review GSoC buddy review needed. mentor review GSoC mentor review needed. labels May 31, 2024
@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from f2b71c2 to 72b7dae Compare May 31, 2024 09:06
@Khader-1
Copy link
Collaborator Author

Thanks @sm-sayedi! I've pushed a revision PTAL.

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 for the revision, @Khader-1. Looks great. You can now move on the the mentor review.

Upon reviewing #714, I feel the need for another small change in the code. See below.

@sm-sayedi sm-sayedi added buddy review GSoC buddy review needed. and removed buddy review GSoC buddy review needed. labels May 31, 2024
],
const SizedBox(width: 16),
])));
child: Opacity(
Copy link
Collaborator

@sm-sayedi sm-sayedi May 31, 2024

Choose a reason for hiding this comment

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

Instead of Opacity wrapping the whole Row, let's make it wrap only the icon and the stream name. This will be helpful when there is a dot marker added through #714. See 714 comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, Thanks!

@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 72b7dae to 0620510 Compare June 1, 2024 05:05
Copy link
Collaborator Author

@Khader-1 Khader-1 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 review @sm-sayedi! A new revision is pushed PTAL.

],
const SizedBox(width: 16),
])));
child: 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.

Good catch, Thanks!

@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 0620510 to cf07bf8 Compare June 1, 2024 06:07
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 for the revision @Khader-1! LGTM. Let's move on to the mentor review from @kenclary!

@sm-sayedi sm-sayedi added mentor review GSoC mentor review needed. and removed buddy review GSoC buddy review needed. labels Jun 1, 2024
@sm-sayedi sm-sayedi requested a review from kenclary June 1, 2024 06:55
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.

looks good to me.

@Khader-1 Khader-1 added maintainer review PR ready for review by Zulip maintainers and removed mentor review GSoC mentor review needed. labels Jun 2, 2024
@alya
Copy link
Collaborator

alya commented Jun 3, 2024

I think we should show muted channels below unmuted ones, as we do in the left sidebar in the web app, unless we specifically have reason to do otherwise. (I know that's not how it works in the RN app.)

@alya
Copy link
Collaborator

alya commented Jun 3, 2024

Could you please update the screenshots in the PR description to include more muted streams, including ones both with and without unread messages?

@Khader-1
Copy link
Collaborator Author

Thanks @alya! I agree. I've updated the sorting logic and the screenshot.
When it comes to notifications, the current behavior is to show nothing if the stream is muted, but this will be replaced with #714

@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from cf07bf8 to 97e1bbb Compare June 10, 2024 08:17
@gnprice gnprice requested a review from chrisbobbe June 10, 2024 17:22
@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 226c137 to 1e66fdf Compare June 29, 2024 12:42
Copy link
Collaborator Author

@Khader-1 Khader-1 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 review @chrisbobbe! I believe this ready now.

@Khader-1 Khader-1 requested a review from chrisbobbe June 29, 2024 12:52
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! And thanks for posting updated screenshots. I notice that the unread marker isn't faded, like it is in Vlad's draft design in the issue: #424 (comment)

Let's make it so the unread marker is also faded.

@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 1e66fdf to 24d9bc1 Compare July 3, 2024 09:10
@chrisbobbe
Copy link
Collaborator

I see you've pushed some changes; please comment here when this is ready for another review.

@Khader-1 Khader-1 requested a review from chrisbobbe July 9, 2024 15:04
@Khader-1
Copy link
Collaborator Author

Khader-1 commented Jul 9, 2024

This is now ready; I had to update the Flutter SDK, which unfortunately took quite some time.

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 @Khader-1! Small comments below, and I'll go ahead and mark for Greg's review.

Comment on lines 241 to 258
UnreadCountBadge(count: unreadCount, backgroundColor: swatch, bold: true),
Opacity(
opacity: subscription.isMuted ? 0.55 : 1,
child: UnreadCountBadge(
count: unreadCount,
backgroundColor: swatch,
bold: true)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we simplify by putting a single Opacity higher in the tree, instead of two different Opacitys?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It could be done as such and it was actually but we had to change it as it will eventually be changed when working on #714; Check Sayed's comment

@chrisbobbe chrisbobbe added the integration review Added by maintainers when PR may be ready for integration label Jul 9, 2024
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 @Khader-1, and thanks @sm-sayedi and @chrisbobbe for the previous reviews! Comments below.

Comment on lines 253 to 254
Opacity(
opacity: subscription.isMuted ? 0.55 : 1,
Copy link
Member

Choose a reason for hiding this comment

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

Can this have just one Opacity around the whole thing? Or is there something I'm missing that isn't getting the Opacity applied?

If so, then that may also enable going back to a single Row instead of a pair of them nested.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It could be done as such and it was actually but we had to change it as it will eventually be changed when working on #714; Check #711 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

I see.

In that case let's split the Opacity up further, so that it applies separately to the icon and name. That will save the extra layer of Expanded and Row, which I think makes this code a bit easier to read and understand.

Comment on lines 231 to 230
UserTopicItem(
streamId: stream1.streamId,
topicName: 'a',
lastUpdated: 1234567890,
visibilityPolicy: UserTopicVisibilityPolicy.unmuted,
Copy link
Member

Choose a reason for hiding this comment

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

This can be made a bit more compact (and with less noise from boring parts like lastUpdated) with an appropriate helper.

There's one already in model/stream_test.dart. So that can be moved to example_data.dart in a prep commit.

Copy link
Member

Choose a reason for hiding this comment

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

bump — you added that useful prep commit but then didn't actually use the new shared helper here 🙂

@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 24d9bc1 to 6bf222f Compare July 10, 2024 09:45
@Khader-1 Khader-1 requested review from gnprice and chrisbobbe July 10, 2024 09:49
@chrisbobbe chrisbobbe removed the maintainer review PR ready for review by Zulip maintainers label Jul 12, 2024
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 for the revision! This is close to merge now. Small comments below.

int _nextStreamId() => (_lastStreamId += 1 + Random().nextInt(10));
int _lastStreamId = 100;

const staticStreamId = 123;
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
const staticStreamId = 123;
const defaultStreamId = 123;

I think this name will make it a bit clearer how this stream ID relates to the rest of the data.

Copy link
Member

Choose a reason for hiding this comment

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

Or I guess that name doesn't capture it either — the meaning is actually a little complicated, in that this is the default for eg.streamMessage but not for eg.stream (which defaults to the random sequence).

Let's make it:

Suggested change
const staticStreamId = 123;
const defaultStreamMessageStreamId = 123;

and also put the definition right above streamMessage.

That name is kind of wordy, but that may actually be a good thing here — the way this works is a bit surprising and we should probably reorganize so that tests aren't referring to a shared constant stream ID like this.

The streamMessage doc should also mention that there's this default.

Copy link
Member

Choose a reason for hiding this comment

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

bump on these two aspects:

and also put the definition right above streamMessage.

The streamMessage doc should also mention that there's this default.

Comment on lines 223 to 224
eg.subscription(stream2, isMuted: false)
],
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
eg.subscription(stream2, isMuted: false)
],
eg.subscription(stream2, isMuted: false),
],

Copy link
Member

Choose a reason for hiding this comment

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

bump 🙂

Comment on lines 231 to 230
UserTopicItem(
streamId: stream1.streamId,
topicName: 'a',
lastUpdated: 1234567890,
visibilityPolicy: UserTopicVisibilityPolicy.unmuted,
Copy link
Member

Choose a reason for hiding this comment

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

bump — you added that useful prep commit but then didn't actually use the new shared helper here 🙂

Comment on lines 253 to 254
Opacity(
opacity: subscription.isMuted ? 0.55 : 1,
Copy link
Member

Choose a reason for hiding this comment

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

I see.

In that case let's split the Opacity up further, so that it applies separately to the icon and name. That will save the extra layer of Expanded and Row, which I think makes this code a bit easier to read and understand.

@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 6bf222f to 32e3bf6 Compare July 13, 2024 10:53
@Khader-1
Copy link
Collaborator Author

Thanks Greg! Sorry about the lack of focus.. I believe This is ready now.

Comment on lines 223 to 224
eg.subscription(stream2, isMuted: false)
],
Copy link
Member

Choose a reason for hiding this comment

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

bump 🙂

Comment on lines 229 to 231
iconDataForStream(subscription)),
),
),
Copy link
Member

Choose a reason for hiding this comment

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

nit: follow the existing style for formatting these close-parens

Suggested change
iconDataForStream(subscription)),
),
),
iconDataForStream(subscription)))),

Comment on lines 251 to 252
subscription.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: similarly here

int _nextStreamId() => (_lastStreamId += 1 + Random().nextInt(10));
int _lastStreamId = 100;

const staticStreamId = 123;
Copy link
Member

Choose a reason for hiding this comment

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

bump on these two aspects:

and also put the definition right above streamMessage.

The streamMessage doc should also mention that there's this default.

@gnprice
Copy link
Member

gnprice commented Jul 14, 2024

Thanks @Khader-1 for the revision! Just a couple of small things still open, and a few nits new in this revision; details above.

@Khader-1 Khader-1 force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 32e3bf6 to 19b53b0 Compare July 15, 2024 08:05
@Khader-1 Khader-1 requested a review from gnprice July 15, 2024 08:06
@Khader-1
Copy link
Collaborator Author

Thanks @gnprice for the review! I've made a new revision PTAL.

Khader-1 added 4 commits July 15, 2024 12:43
This allows `eg.stream` to be used in contexts where it's important
that the stream IDs don't collide or even that they're increasing,
without the test having to explicitly give specific stream IDs when
no other fact about them is relevant.

Some tests are dependent on the stream IDs being static. Those are
updated to use `eg.defaultStreamMessageStreamId` explicitly.
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 @Khader-1 for all your work on this! Looks good — merging.

I fixed the one nit below, and also tweaked the eg.streamMessage doc slightly:

-/// If the message stream `stream` is not given, an example stream with
-/// `defaultStreamMessageStreamId` will be used.
+/// The message will be in `stream` if given.  Otherwise,
+/// an example stream with ID `defaultStreamMessageStreamId` will be used.

@gnprice gnprice force-pushed the ui-show-muted-streams-as-faded-in-streams-list branch from 19b53b0 to b0b8a50 Compare July 15, 2024 19:45
@gnprice gnprice merged commit b0b8a50 into zulip:main Jul 15, 2024
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.

Show muted streams as faded in streams list
6 participants