Skip to content

Offer subscribe/unsubscribe in channel action sheet #1790

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
merged 5 commits into from
Aug 7, 2025

Conversation

chrisbobbe
Copy link
Collaborator

Fixes #1224.

Stacked atop #1789.

We'll need API bindings for subscribe/unsubscribe for #188, so might as well knock out #1224 now that we have those.

Putting the context-menu buttons in groups, with spacing in between, is new here, and follows the Figma: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6327-96691&m=dev

The Figma varies in whether to put 10px or 8px space between the sections, even within one context menu: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6098-6519&m=dev

and I've opted for 8px.

Screenshots

image image

When unsubscribing from a private channel, a confirmation dialog:

image

with a followup to say "will not" instead of "might not", blocked on being able to check the group-based can-subscribe permission (#1786, #814).

@chrisbobbe chrisbobbe added the maintainer review PR ready for review by Zulip maintainers label Aug 6, 2025
Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

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

Thanks @chrisbobbe! This LGTM, and tests well.

One (probably unrelated to this PR) thing I noticed is that currently when sending a message to an unsubscribed channel, the local echo progress bar is persistent. Even though on the Web app I notice that the message was acutally sent.

@chrisbobbe
Copy link
Collaborator Author

Yep, I've got a draft branch to address that :) foreshadowed in #1792.

@chrisbobbe chrisbobbe assigned gnprice and unassigned rajveermalviya Aug 6, 2025
@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 Aug 6, 2025
@alya
Copy link
Collaborator

alya commented Aug 6, 2025

Is the context for the "might not" warning (vs. "will not" on web) that we aren't checking the can-subscribe permission here?

@chrisbobbe
Copy link
Collaborator Author

Exactly 🙂

When unsubscribing from a private channel, a confirmation dialog:

[screenshot]

with a followup to say "will not" instead of "might not", blocked on being able to check the group-based can-subscribe permission (#1786, #814).

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 building this! Generally this all looks good.

I'm not convinced that we want this rename commit:
648ab7f action_sheet [nfc]: Renames/doc changes to fit context-menu Figma component

I think so far "context menu" has been pretty much a synonym of "action sheet" for us. The "context menu" term appears in Figma, and in the names of design variables because we keep those aligned with Figma, but everywhere else we say "action sheet".

It'd be nice to have one term instead of two, or else to identify a useful distinction and then assign the two terms consistently to two related meanings. But to get to having just one term requires doing a quite comprehensive rename. With this rename commit, it feels like we still have two terms but the boundary between where they appear is less crisp than it is in the status quo.

List<int>? principals,
}) {
return connection.post('subscribeToChannel', (_) {}, 'users/me/subscriptions', {
'subscriptions': subscriptions.map((subName) => {'name': subName}).toList(),
Copy link
Member

Choose a reason for hiding this comment

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

nit: the name "name" seems clear enough, and avoids making up a distinct name for the same thing:

Suggested change
'subscriptions': subscriptions.map((subName) => {'name': subName}).toList(),
'subscriptions': subscriptions.map((name) => {'name': name}).toList(),

@@ -34,10 +34,14 @@ import 'text.dart';
import 'theme.dart';
import 'topic_list.dart';

void _showActionSheet(
Copy link
Member

Choose a reason for hiding this comment

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

nit:

The Figma has a "context menu" component (see link in new dartdoc),
which _showBottomSheet has been a good fit for. (See e.g.

should this say "_showActionSheet"?

Comment on lines 137 to 135
/// A button in a context menu.
///
/// When built from server data, the action sheet ignores changes in that data;
Copy link
Member

Choose a reason for hiding this comment

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

I think the term "action sheet" is going to remain in some places. The term "bottom sheet" will too, since it refers to the Material concept we're using.

So if we're going to introduce this third term, it'd be good to write down somewhere how the three different terms relate to each other. Perhaps on _showContextMenu? And/or here on ContextMenuItemButton, or have a reference here.

required List<Widget> optionButtons,
required List<List<Widget>> buttonSections,
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Some context menus in the Figma have multiple groups/sections of
buttons, e.g.:
  https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6327-96694&m=dev

please mention which menu this is, too — Figma is super slow to load, so I'd rather not have to follow the link to learn the answer when it's something that could be conveyed easily in text

Navigator.push(pageContext,
TopicListPage.buildRoute(context: pageContext, streamId: channelId));
void onPressed() async {
final zulipLocalizations = ZulipLocalizations.of(pageContext);
Copy link
Member

Choose a reason for hiding this comment

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

nit: defer this lookup until we need the data (since that only happens on error)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And since it's across an async gap :)

Copy link
Member

Choose a reason for hiding this comment

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

Indeed. For localizations like this, that's basically harmless, which is why I didn't flag that reason — the potential impact is that if you changed your language settings while the request was ongoing, you'll see a message in your previously-chosen language. (Unlike the store, the old localizations object doesn't get disposed.)

But in principle that's also a good reason, and in the case of the store it'd be important.

@chrisbobbe chrisbobbe force-pushed the subscribe-unsubscribe-buttons branch from 253f4b9 to b907739 Compare August 7, 2025 00:09
@chrisbobbe
Copy link
Collaborator Author

Thanks! Revision pushed, and I removed that rename commit. I think my thought was: the Figma has a special kind of action sheet called a context menu, which is different from other action sheets, and it has these elements:

  • Optional header, with a few ways that can look
  • One or more sections of buttons, which are purple or (if destructive) red; this is our ZulipMenuItemButtonStyle.menu as opposed to .list
  • A cancel button at the bottom

And I was thinking about code organization around that pattern, just for the things that are actually meant to follow it:

  • Message, channel, topic, and DM action sheets
  • Uh, that might be it :)

@gnprice
Copy link
Member

gnprice commented Aug 7, 2025

Cool.

  • Message, channel, topic, and DM action sheets
  • Uh, that might be it :)

That seems to align with "context menu" and "action sheet" being synonyms for us, then.

the Figma has a special kind of action sheet called a context menu, which is different from other action sheets,

A context menu, aka an action sheet, is still a specific kind of bottom sheet, though.

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! All looks good now except a couple of nits below.

Comment on lines 100 to 101
"@actionSheetOptionSubscribe": {
"description": "Label in the channel context menu for subscribing to the channel."
Copy link
Member

Choose a reason for hiding this comment

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

Let's stick to "action sheet" in these descriptions (here and another below)

child: MenuButtonsShape(buttons: optionButtons)))),
child: Column(
Copy link
Member

Choose a reason for hiding this comment

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

nit:

action_sheet [nfc]: Support multiple button sections in context menu

Some context menus in the Figma have multiple groups/sections of

s/context menu/action sheet/g

@chrisbobbe chrisbobbe force-pushed the subscribe-unsubscribe-buttons branch from b907739 to 12b47e9 Compare August 7, 2025 00:32
@chrisbobbe
Copy link
Collaborator Author

Ah indeed, basically an incomplete removal of that rename commit :) revision pushed.

@gnprice
Copy link
Member

gnprice commented Aug 7, 2025

Thanks! Looks good; merging.

@gnprice gnprice force-pushed the subscribe-unsubscribe-buttons branch from 12b47e9 to 7f7aa98 Compare August 7, 2025 00:42
@gnprice gnprice merged commit 7f7aa98 into zulip:main Aug 7, 2025
1 check failed
@chrisbobbe chrisbobbe deleted the subscribe-unsubscribe-buttons branch August 7, 2025 01:43
gnprice added a commit to gnprice/zulip-flutter that referenced this pull request Aug 8, 2025
These were added yesterday in 7f7aa98 (zulip#1790).  The descriptions
changed in the last revision before the PR was merged; but the edit
apparently didn't make it to the generated file, causing CI to fail.
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.

Offer subscribe/unsubscribe in channel action sheet
4 participants