Merge branch 'contactsearch-fix-search' into 'master'
[ContactSearch] Hotfix See merge request famedly/famedlysdk!98
This commit is contained in:
commit
dee3aad69d
|
@ -299,13 +299,14 @@ class Client {
|
|||
if (contactDiscoveryRoom != null)
|
||||
contacts = await contactDiscoveryRoom.requestParticipants();
|
||||
else {
|
||||
Map<String, User> userMap = {};
|
||||
Map<String, bool> userMap = {};
|
||||
for (int i = 0; i < roomList.rooms.length; i++) {
|
||||
List<User> roomUsers = roomList.rooms[i].getParticipants();
|
||||
for (int j = 0; j < roomUsers.length; j++)
|
||||
userMap[roomUsers[i].id] = roomUsers[i];
|
||||
for (int j = 0; j < roomUsers.length; j++) {
|
||||
if (userMap[roomUsers[j].id] != true) contacts.add(roomUsers[j]);
|
||||
userMap[roomUsers[j].id] = true;
|
||||
}
|
||||
}
|
||||
userMap.forEach((String id, User user) => contacts.add(user));
|
||||
}
|
||||
return contacts;
|
||||
}
|
||||
|
|
|
@ -133,6 +133,31 @@ void main() {
|
|||
matrix.presences["@alice:example.com"].content["presence"], "online");
|
||||
expect(presenceCounter, 1);
|
||||
expect(accountDataCounter, 2);
|
||||
|
||||
matrix.connection.onEvent.add(
|
||||
EventUpdate(
|
||||
roomID: "!726s6s6q:example.com",
|
||||
type: "state",
|
||||
eventType: "m.room.canonical_alias",
|
||||
content: {
|
||||
"sender": "@alice:example.com",
|
||||
"type": "m.room.canonical_alias",
|
||||
"content": {"alias": ""},
|
||||
"state_key": "",
|
||||
"origin_server_ts": 1417731086799,
|
||||
"event_id": "66697273743033:example.com"
|
||||
},
|
||||
),
|
||||
);
|
||||
await new Future.delayed(new Duration(milliseconds: 50));
|
||||
|
||||
expect(
|
||||
matrix.roomList.getRoomByAlias(
|
||||
"#famedlyContactDiscovery:${matrix.userID.split(":")[1]}"),
|
||||
null);
|
||||
final List<User> altContacts = await matrix.loadFamedlyContacts();
|
||||
expect(altContacts.length, 2);
|
||||
expect(altContacts[0].senderId, "@alice:example.com");
|
||||
});
|
||||
|
||||
test('Try to get ErrorResponse', () async {
|
||||
|
@ -198,7 +223,7 @@ void main() {
|
|||
|
||||
List<EventUpdate> eventUpdateList = await eventUpdateListFuture;
|
||||
|
||||
expect(eventUpdateList.length, 8);
|
||||
expect(eventUpdateList.length, 9);
|
||||
|
||||
expect(eventUpdateList[0].eventType, "m.room.member");
|
||||
expect(eventUpdateList[0].roomID, "!726s6s6q:example.com");
|
||||
|
|
Loading…
Reference in a new issue