Skip to content

Conversation

chrisbobbe
Copy link
Collaborator

Fixes #1870.

Before After
image image

@chrisbobbe chrisbobbe added the maintainer review PR ready for review by Zulip maintainers label Sep 24, 2025
@chrisbobbe chrisbobbe force-pushed the pr-cannot-post-banner-intent branch from 32f405e to 5106d65 Compare September 24, 2025 21:44
@alya
Copy link
Collaborator

alya commented Sep 25, 2025

Hm, did we get feedback on this? We do use red in the web app, though that's when the compose box is open.

Screenshot 2025-09-25 at 15 19 50@2x

@alya
Copy link
Collaborator

alya commented Sep 25, 2025

I guess the difference here is that this notice would always be visible in a channel you can't post in? Blue/info does seem reasonable in that case.

@chrisbobbe
Copy link
Collaborator Author

chrisbobbe commented Sep 25, 2025

Yeah, it's a non-dismissable banner that we show when we're not showing the compose box, because composing isn't allowed. I think "info" is appropriate because the user didn't do anything wrong and there wasn't any action that failed: they just want to catch up on #announce for example.

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! LGTM, moving over to Greg's review.

@rajveermalviya rajveermalviya 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 Sep 26, 2025
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 fixing this! A couple of comments below.

Comment on lines -2158 to +2143
return _ErrorBanner(getLabel: (zulipLocalizations) =>
zulipLocalizations.errorBannerCannotPostInChannelLabel);
return _Banner(
intent: _BannerIntent.info,
label: zulipLocalizations.errorBannerCannotPostInChannelLabel);
Copy link
Member

Choose a reason for hiding this comment

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

Neat, I like that the label is now found in a more straightforward way.

Comment on lines 1863 to 1866
Widget build(BuildContext context) {
// (A BuildContext that's expected to remain mounted until the whole page
// disappears, which may be long after the banner disappears.)
final pageContext = PageRoot.contextOf(context);
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this seems odd, though. If the banner disappears, this widget will get unmounted. In that case what's going to end up subsequently using this pageContext value?

It looks to me like both the references below could just use context directly, and that'd be the normal Flutter thing to do.

… Aha, down at the bottom of the _handleTapSave implementation, it does actually want a longer-lasting context. (It awaits a request, and then might end up trying to display an error.) I think that's something that method should take care of, though.

Copy link
Member

Choose a reason for hiding this comment

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

Probably cleanest to have a prep commit before this make the change to have buildTrailing take the local context, and _handleTapSave take care of getting the page context.

@chrisbobbe chrisbobbe force-pushed the pr-cannot-post-banner-intent branch from 5106d65 to bf0b314 Compare September 29, 2025 19:55
@chrisbobbe
Copy link
Collaborator Author

Thanks for the reviews! Revision pushed.

@gnprice
Copy link
Member

gnprice commented Oct 1, 2025

Thanks! Looks good; merging.

@gnprice gnprice force-pushed the pr-cannot-post-banner-intent branch from bf0b314 to 38a2c63 Compare October 1, 2025 23:55
@gnprice gnprice merged commit 38a2c63 into zulip:main Oct 1, 2025
1 check passed
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.

compose: "Danger"-style banner is too aggressive when you don't have send-message permission
4 participants