diff --git a/lib/src/client.dart b/lib/src/client.dart index eae0e16..60acc71 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -22,12 +22,14 @@ */ import 'dart:async'; +import 'dart:convert'; import 'dart:core'; import 'package:canonical_json/canonical_json.dart'; import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/src/account_data.dart'; import 'package:famedlysdk/src/presence.dart'; +import 'package:famedlysdk/src/room.dart'; import 'package:famedlysdk/src/store_api.dart'; import 'package:famedlysdk/src/sync/user_update.dart'; import 'package:famedlysdk/src/utils/device_keys_list.dart'; @@ -39,20 +41,19 @@ import 'package:famedlysdk/src/utils/session_key.dart'; import 'package:famedlysdk/src/utils/to_device_event.dart'; import 'package:famedlysdk/src/utils/turn_server_credentials.dart'; import 'package:famedlysdk/src/utils/user_device.dart'; -import 'package:olm/olm.dart' as olm; -import 'package:pedantic/pedantic.dart'; -import 'room.dart'; -import 'event.dart'; -import 'user.dart'; -import 'utils/profile.dart'; -import 'dart:convert'; -import 'package:famedlysdk/src/room.dart'; import 'package:http/http.dart' as http; import 'package:mime_type/mime_type.dart'; +import 'package:olm/olm.dart' as olm; +import 'package:pedantic/pedantic.dart'; + +import 'event.dart'; +import 'room.dart'; import 'sync/event_update.dart'; import 'sync/room_update.dart'; import 'sync/user_update.dart'; +import 'user.dart'; import 'utils/matrix_exception.dart'; +import 'utils/profile.dart'; typedef RoomSorter = int Function(Room a, Room b); @@ -551,6 +552,7 @@ class Client { } static String syncFilters = '{"room":{"state":{"lazy_load_members":true}}}'; + static String messagesFilters = '{"lazy_load_members":true}'; static const List supportedDirectEncryptionAlgorithms = [ 'm.olm.v1.curve25519-aes-sha2' ]; diff --git a/lib/src/room.dart b/lib/src/room.dart index 4717926..2038b71 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -853,7 +853,7 @@ class Room { final dynamic resp = await client.jsonRequest( type: HTTPType.GET, action: - '/client/r0/rooms/$id/messages?from=${prev_batch}&dir=b&limit=$historyCount&filter=${Client.syncFilters}'); + '/client/r0/rooms/$id/messages?from=${prev_batch}&dir=b&limit=$historyCount&filter=${Client.messagesFilters}'); if (onHistoryReceived != null) onHistoryReceived(); prev_batch = resp['end']; diff --git a/test/fake_matrix_api.dart b/test/fake_matrix_api.dart index e00f579..54b4d05 100644 --- a/test/fake_matrix_api.dart +++ b/test/fake_matrix_api.dart @@ -21,11 +21,12 @@ * along with famedlysdk. If not, see . */ -import 'package:http/testing.dart'; import 'dart:convert'; import 'dart:core'; import 'dart:math'; + import 'package:http/http.dart'; +import 'package:http/testing.dart'; class FakeMatrixApi extends MockClient { FakeMatrixApi() @@ -583,9 +584,9 @@ class FakeMatrixApi extends MockClient { 'origin_server_ts': 1432735824653, 'unsigned': {'age': 1234} }, - '/client/r0/rooms/!localpart:server.abc/messages?from=&dir=b&limit=10&filter=%7B%22room%22:%7B%22state%22:%7B%22lazy_load_members%22:true%7D%7D%7D': + '/client/r0/rooms/!localpart:server.abc/messages?from=&dir=b&limit=10&filter=%7B%22lazy_load_members%22:true%7D': (var req) => messagesResponse, - '/client/r0/rooms/!1234:example.com/messages?from=1234&dir=b&limit=100&filter=%7B%22room%22:%7B%22state%22:%7B%22lazy_load_members%22:true%7D%7D%7D': + '/client/r0/rooms/!1234:example.com/messages?from=1234&dir=b&limit=100&filter=%7B%22lazy_load_members%22:true%7D': (var req) => messagesResponse, '/client/versions': (var req) => { 'versions': [