Merge branch 'contactlist-enhance-requestbyroom' into 'master'

[ContactList] Fallback with old loadContacts

See merge request famedly/famedlysdk!55
This commit is contained in:
Marcel 2019-07-26 14:07:29 +00:00
commit 29c677e5ba
2 changed files with 5 additions and 2 deletions

View file

@ -224,9 +224,13 @@ class Client {
/// the famedlyContactDiscovery room, which is /// the famedlyContactDiscovery room, which is
/// defined by the autojoin room feature in Synapse. /// defined by the autojoin room feature in Synapse.
Future<List<User>> loadFamedlyContacts() async { Future<List<User>> loadFamedlyContacts() async {
List<User> contacts = [];
Room contactDiscoveryRoom = await store Room contactDiscoveryRoom = await store
.getRoomByAlias("#famedlyContactDiscovery:${userID.split(":")[1]}"); .getRoomByAlias("#famedlyContactDiscovery:${userID.split(":")[1]}");
List<User> contacts = await contactDiscoveryRoom.requestParticipants(); if (contactDiscoveryRoom != null)
contacts = await contactDiscoveryRoom.requestParticipants();
else
contacts = await store.loadContacts();
return contacts; return contacts;
} }

View file

@ -458,7 +458,6 @@ class Store {
/// Loads all Users in the database to provide a contact list /// Loads all Users in the database to provide a contact list
/// except users who are in the Room with the ID [exceptRoomID]. /// except users who are in the Room with the ID [exceptRoomID].
@deprecated
Future<List<User>> loadContacts({String exceptRoomID = ""}) async { Future<List<User>> loadContacts({String exceptRoomID = ""}) async {
List<Map<String, dynamic>> res = await db.rawQuery( List<Map<String, dynamic>> res = await db.rawQuery(
"SELECT * FROM Users WHERE matrix_id!=? AND chat_id!=? GROUP BY matrix_id ORDER BY displayname", "SELECT * FROM Users WHERE matrix_id!=? AND chat_id!=? GROUP BY matrix_id ORDER BY displayname",