famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
52 stars 30 forks source link

feat: lazy load global profile from db #1798

Open nico-famedly opened 3 months ago

nico-famedly commented 3 months ago

When using the getProfileFromUserId with getFromRooms == true, it would always fail to load any profile from the database. This is because by default rooms are partial/not postLoaded, which means no state is in memory. However we usually also don't want to load all members in all rooms just to have a usable offline behaviour.

So this changes the function to first check the non-partial rooms. If none of them have the profile, it then starts looking for the specific user profile in the partial rooms. This should only load one member event, which hopefully is faster than loading all members in all rooms.