make Room#loadThreadsFromServer public

This commit is contained in:
OfficialDakari 2025-10-30 11:50:17 +05:00
parent 56f34ecb59
commit 09643a172f
1 changed files with 5 additions and 4 deletions

View File

@ -130,7 +130,7 @@ class Room {
setState(state); setState(state);
} }
await _loadThreadsFromServer(); await loadThreadsFromServer();
partial = false; partial = false;
} }
@ -139,7 +139,7 @@ class Room {
String? getThreadRootsBatch; String? getThreadRootsBatch;
bool loadedAllThreads = false; bool loadedAllThreads = false;
Future<void> _loadThreadsFromServer() async { Future<void> loadThreadsFromServer() async {
try { try {
if (loadedAllThreads) return; if (loadedAllThreads) return;
final response = final response =
@ -185,11 +185,12 @@ class Room {
id, id,
root, root,
event, // update last event event, // update last event
event.senderId == client.userID, // currentUserParticipated event.senderId == client.userID || (thread?.currentUserParticipated ?? false), // currentUserParticipated
(thread?.count ?? 0) + 1, // increment count - should be calculated properly (thread?.count ?? 0) + 1, // increment count - should be calculated properly
0, 0, 0, 0,
client, client,
); );
threads[event.relationshipEventId!] = (await client.database.getThread(id, event.relationshipEventId!, client))!;
} }
} }
@ -1528,7 +1529,7 @@ class Room {
direction = Direction.b, direction = Direction.b,
StateFilter? filter, StateFilter? filter,
}) async { }) async {
unawaited(_loadThreadsFromServer()); unawaited(loadThreadsFromServer());
final prev_batch = this.prev_batch; final prev_batch = this.prev_batch;