Skip to content

Commit a02341b

Browse files
subscription_list [nfc]: Add a flag to hide channels where the user can't post
This will be used soon to avoid showing conversations from the channel list where the current user can't post, specifically when they don't have the permission.
1 parent 9b1a741 commit a02341b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/widgets/subscription_list.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ class SubscriptionListPageBody extends StatefulWidget {
1818
const SubscriptionListPageBody({
1919
super.key,
2020
this.disableChannelActionSheet = false,
21+
this.hideChannelsIfUserCantPost = false,
2122
});
2223

2324
final bool disableChannelActionSheet;
25+
final bool hideChannelsIfUserCantPost;
2426

2527
@override
2628
State<SubscriptionListPageBody> createState() => _SubscriptionListPageBodyState();
@@ -91,6 +93,12 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
9193
final List<Subscription> pinned = [];
9294
final List<Subscription> unpinned = [];
9395
for (final subscription in store.subscriptions.values) {
96+
if (widget.hideChannelsIfUserCantPost) {
97+
if (!store.hasPostingPermission(inChannel: subscription,
98+
user: store.selfUser, byDate: DateTime.now())) {
99+
continue;
100+
}
101+
}
94102
if (subscription.pinToTop) {
95103
pinned.add(subscription);
96104
} else {

0 commit comments

Comments
 (0)