chore: hide invite all in space button if everyone from space is already in room (#5340)
This commit is contained in:
parent
aa855bcc71
commit
6cfdd35f58
2 changed files with 15 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue