[ContactSearch] Hotfix
This commit is contained in:
parent
95f95ad976
commit
3a7dff596e
|
@ -299,13 +299,14 @@ class Client {
|
||||||
if (contactDiscoveryRoom != null)
|
if (contactDiscoveryRoom != null)
|
||||||
contacts = await contactDiscoveryRoom.requestParticipants();
|
contacts = await contactDiscoveryRoom.requestParticipants();
|
||||||
else {
|
else {
|
||||||
Map<String, User> userMap = {};
|
Map<String, bool> userMap = {};
|
||||||
for (int i = 0; i < roomList.rooms.length; i++) {
|
for (int i = 0; i < roomList.rooms.length; i++) {
|
||||||
List<User> roomUsers = roomList.rooms[i].getParticipants();
|
List<User> roomUsers = roomList.rooms[i].getParticipants();
|
||||||
for (int j = 0; j < roomUsers.length; j++)
|
for (int j = 0; j < roomUsers.length; j++) {
|
||||||
userMap[roomUsers[i].id] = roomUsers[i];
|
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;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,31 @@ void main() {
|
||||||
matrix.presences["@alice:example.com"].content["presence"], "online");
|
matrix.presences["@alice:example.com"].content["presence"], "online");
|
||||||
expect(presenceCounter, 1);
|
expect(presenceCounter, 1);
|
||||||
expect(accountDataCounter, 2);
|
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 {
|
test('Try to get ErrorResponse', () async {
|
||||||
|
@ -198,7 +223,7 @@ void main() {
|
||||||
|
|
||||||
List<EventUpdate> eventUpdateList = await eventUpdateListFuture;
|
List<EventUpdate> eventUpdateList = await eventUpdateListFuture;
|
||||||
|
|
||||||
expect(eventUpdateList.length, 8);
|
expect(eventUpdateList.length, 9);
|
||||||
|
|
||||||
expect(eventUpdateList[0].eventType, "m.room.member");
|
expect(eventUpdateList[0].eventType, "m.room.member");
|
||||||
expect(eventUpdateList[0].roomID, "!726s6s6q:example.com");
|
expect(eventUpdateList[0].roomID, "!726s6s6q:example.com");
|
||||||
|
|
Loading…
Reference in a new issue