Skip to content

Commit 71a9de9

Browse files
committed
compose [nfc]: Pull out code for a case that deserves a TODO
1 parent e03f5c1 commit 71a9de9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/widgets/compose_box.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,8 +2136,17 @@ class _ComposeBoxState extends State<ComposeBox> with PerAccountStoreAwareStateM
21362136
case ChannelNarrow(:final streamId):
21372137
case TopicNarrow(:final streamId):
21382138
final channel = store.streams[streamId];
2139-
if (channel == null || !store.selfCanSendMessage(inChannel: channel,
2140-
byDate: DateTime.now())) {
2139+
if (channel == null) {
2140+
return _Banner(
2141+
intent: _BannerIntent.info,
2142+
// TODO this doesn't seem like exactly the right message --
2143+
// it makes it sound like the channel exists, which might not be
2144+
// true. (We'll get here if the channel doesn't exist or if it
2145+
// exists but we don't have permission to know about it.)
2146+
label: zulipLocalizations.errorBannerCannotPostInChannelLabel);
2147+
}
2148+
2149+
if (!store.selfCanSendMessage(inChannel: channel, byDate: DateTime.now())) {
21412150
return _Banner(
21422151
intent: _BannerIntent.info,
21432152
label: zulipLocalizations.errorBannerCannotPostInChannelLabel);

0 commit comments

Comments
 (0)