fix: load full participant list when needed (#3782)
This commit is contained in:
parent
ece75b7f74
commit
20b17e5f3d
5 changed files with 25 additions and 1 deletions
|
|
@ -645,6 +645,12 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
onInsert: onInsert,
|
||||
);
|
||||
// #Pangea
|
||||
// Users with assosiated events in the timeline will be loaded into the state
|
||||
// in-memory cache by getTimeline, but to ensure all users (even those without
|
||||
// event in the timeline) are loaded, we will request all users. This is important
|
||||
// for widgets in the chat like the activity participants displays
|
||||
room.requestParticipants();
|
||||
|
||||
if (visibleEvents.length < 10 && timeline != null) {
|
||||
var prevNumEvents = timeline!.events.length;
|
||||
await requestHistory();
|
||||
|
|
|
|||
|
|
@ -50,6 +50,18 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
String? get roomId => widget.roomId;
|
||||
|
||||
// #Pangea
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// Widgets within the chat details page rely on a fully-loaded in-memory
|
||||
// participants list, so we need to ensure that the participants are loaded
|
||||
final room = Matrix.of(context).client.getRoomById(widget.roomId);
|
||||
room?.requestParticipants().then((_) {
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
final GlobalKey<ChatDetailsController> addConversationBotKey =
|
||||
GlobalKey<ChatDetailsController>();
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
void initState() {
|
||||
// #Pangea
|
||||
// loadHierarchy();
|
||||
// load full participant list into memory to ensure widgets
|
||||
// that rely on full participants list work as expected
|
||||
final room = Matrix.of(context).client.getRoomById(widget.spaceId);
|
||||
room?.requestParticipants().then((_) {
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
|
||||
// If, on launch, this room has had updates to its children,
|
||||
// ensure the hierarchy is properly reloaded
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class LoadParticipantsUtilState extends State<LoadParticipantsUtil> {
|
|||
error = null;
|
||||
});
|
||||
|
||||
await widget.space.requestParticipants();
|
||||
await _cacheLevels();
|
||||
} catch (err, s) {
|
||||
error = err.toString();
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ abstract class ClientManager {
|
|||
// to postLoad to confirm that these state events are completely loaded
|
||||
EventTypes.RoomPowerLevels,
|
||||
EventTypes.RoomJoinRules,
|
||||
EventTypes.RoomMember,
|
||||
PangeaEventTypes.rules,
|
||||
PangeaEventTypes.botOptions,
|
||||
PangeaEventTypes.capacity,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue