Skip to content

Commit 581e377

Browse files
committed
compose [nfc]: Unhoist a self-user lookup
Also add some blank lines to make the structure of this switch a bit easier to see.
1 parent c077a45 commit 581e377

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/widgets/compose_box.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,23 +1419,25 @@ class _ComposeBoxState extends State<ComposeBox> with PerAccountStoreAwareStateM
14191419

14201420
Widget? _errorBanner(BuildContext context) {
14211421
final store = PerAccountStoreWidget.of(context);
1422-
final selfUser = store.users[store.selfUserId]!;
14231422
switch (widget.narrow) {
14241423
case ChannelNarrow(:final streamId):
14251424
case TopicNarrow(:final streamId):
14261425
final channel = store.streams[streamId];
1426+
final selfUser = store.users[store.selfUserId]!;
14271427
if (channel == null || !store.hasPostingPermission(inChannel: channel,
14281428
user: selfUser, byDate: DateTime.now())) {
14291429
return _ErrorBanner(label:
14301430
ZulipLocalizations.of(context).errorBannerCannotPostInChannelLabel);
14311431
}
1432+
14321433
case DmNarrow(:final otherRecipientIds):
14331434
final hasDeactivatedUser = otherRecipientIds.any((id) =>
14341435
!(store.users[id]?.isActive ?? true));
14351436
if (hasDeactivatedUser) {
14361437
return _ErrorBanner(label:
14371438
ZulipLocalizations.of(context).errorBannerDeactivatedDmLabel);
14381439
}
1440+
14391441
case CombinedFeedNarrow():
14401442
case MentionsNarrow():
14411443
case StarredMessagesNarrow():

0 commit comments

Comments
 (0)