chore: hide invite all in space button if everyone from space is already in room (#5340)

This commit is contained in:
ggurdin 2026-01-22 12:13:24 -05:00 committed by GitHub
parent aa855bcc71
commit 6cfdd35f58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View file

@ -148,6 +148,20 @@ class PangeaInvitationSelectionController
return parents.first;
}
bool get showInviteAllInSpaceButton {
final roomParticipants = participants;
if (roomParticipants == null ||
filter != InvitationFilter.space ||
spaceParent == null) {
return false;
}
final spaceParticipants = spaceParent!.getParticipants();
return spaceParticipants.any(
(participant) => !roomParticipants.any((p) => p.id == participant.id),
);
}
List<InvitationFilter> get availableFilters => InvitationFilter.values
.where(
(f) => switch (f) {

View file

@ -184,9 +184,7 @@ class PangeaInvitationSelectionView extends StatelessWidget {
itemCount: contacts.length + 2,
itemBuilder: (BuildContext context, int i) {
if (i == 0) {
return controller.filter ==
InvitationFilter.space &&
controller.spaceParent != null
return controller.showInviteAllInSpaceButton
? ListTile(
leading: ClipPath(
clipper: MapClipper(),