chore: Improve via calculation
This commit is contained in:
parent
dc64d1679b
commit
2c4a16d608
1 changed files with 21 additions and 11 deletions
|
|
@ -1114,19 +1114,29 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
|
|
||||||
void goToNewRoomAction() async {
|
void goToNewRoomAction() async {
|
||||||
final newRoomId = room
|
|
||||||
.getState(EventTypes.RoomTombstone)!
|
|
||||||
.parsedTombstoneContent
|
|
||||||
.replacementRoom;
|
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => room.client.joinRoom(
|
future: () async {
|
||||||
room
|
final users = await room.requestParticipants(
|
||||||
.getState(EventTypes.RoomTombstone)!
|
[Membership.join, Membership.leave],
|
||||||
.parsedTombstoneContent
|
true,
|
||||||
.replacementRoom,
|
false,
|
||||||
via: [newRoomId.domain!],
|
);
|
||||||
),
|
users.sort((a, b) => a.powerLevel.compareTo(b.powerLevel));
|
||||||
|
final via = users
|
||||||
|
.map((user) => user.id.domain)
|
||||||
|
.whereType<String>()
|
||||||
|
.toSet()
|
||||||
|
.take(10)
|
||||||
|
.toList();
|
||||||
|
return room.client.joinRoom(
|
||||||
|
room
|
||||||
|
.getState(EventTypes.RoomTombstone)!
|
||||||
|
.parsedTombstoneContent
|
||||||
|
.replacementRoom,
|
||||||
|
via: via,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
if (result.error != null) return;
|
if (result.error != null) return;
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue