Merge branch 'fix-messages-filter' into 'master'
[Room] Send correct filter on the messages endpoint See merge request famedly/famedlysdk!269
This commit is contained in:
commit
a72f25dcfa
|
@ -22,12 +22,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
|
||||||
import 'package:canonical_json/canonical_json.dart';
|
import 'package:canonical_json/canonical_json.dart';
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:famedlysdk/src/account_data.dart';
|
import 'package:famedlysdk/src/account_data.dart';
|
||||||
import 'package:famedlysdk/src/presence.dart';
|
import 'package:famedlysdk/src/presence.dart';
|
||||||
|
import 'package:famedlysdk/src/room.dart';
|
||||||
import 'package:famedlysdk/src/store_api.dart';
|
import 'package:famedlysdk/src/store_api.dart';
|
||||||
import 'package:famedlysdk/src/sync/user_update.dart';
|
import 'package:famedlysdk/src/sync/user_update.dart';
|
||||||
import 'package:famedlysdk/src/utils/device_keys_list.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/to_device_event.dart';
|
||||||
import 'package:famedlysdk/src/utils/turn_server_credentials.dart';
|
import 'package:famedlysdk/src/utils/turn_server_credentials.dart';
|
||||||
import 'package:famedlysdk/src/utils/user_device.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:http/http.dart' as http;
|
||||||
import 'package:mime_type/mime_type.dart';
|
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/event_update.dart';
|
||||||
import 'sync/room_update.dart';
|
import 'sync/room_update.dart';
|
||||||
import 'sync/user_update.dart';
|
import 'sync/user_update.dart';
|
||||||
|
import 'user.dart';
|
||||||
import 'utils/matrix_exception.dart';
|
import 'utils/matrix_exception.dart';
|
||||||
|
import 'utils/profile.dart';
|
||||||
|
|
||||||
typedef RoomSorter = int Function(Room a, Room b);
|
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 syncFilters = '{"room":{"state":{"lazy_load_members":true}}}';
|
||||||
|
static String messagesFilters = '{"lazy_load_members":true}';
|
||||||
static const List<String> supportedDirectEncryptionAlgorithms = [
|
static const List<String> supportedDirectEncryptionAlgorithms = [
|
||||||
'm.olm.v1.curve25519-aes-sha2'
|
'm.olm.v1.curve25519-aes-sha2'
|
||||||
];
|
];
|
||||||
|
|
|
@ -853,7 +853,7 @@ class Room {
|
||||||
final dynamic resp = await client.jsonRequest(
|
final dynamic resp = await client.jsonRequest(
|
||||||
type: HTTPType.GET,
|
type: HTTPType.GET,
|
||||||
action:
|
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();
|
if (onHistoryReceived != null) onHistoryReceived();
|
||||||
prev_batch = resp['end'];
|
prev_batch = resp['end'];
|
||||||
|
|
|
@ -21,11 +21,12 @@
|
||||||
* along with famedlysdk. If not, see <http://www.gnu.org/licenses/>.
|
* along with famedlysdk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:http/testing.dart';
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
|
import 'package:http/testing.dart';
|
||||||
|
|
||||||
class FakeMatrixApi extends MockClient {
|
class FakeMatrixApi extends MockClient {
|
||||||
FakeMatrixApi()
|
FakeMatrixApi()
|
||||||
|
@ -583,9 +584,9 @@ class FakeMatrixApi extends MockClient {
|
||||||
'origin_server_ts': 1432735824653,
|
'origin_server_ts': 1432735824653,
|
||||||
'unsigned': {'age': 1234}
|
'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,
|
(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,
|
(var req) => messagesResponse,
|
||||||
'/client/versions': (var req) => {
|
'/client/versions': (var req) => {
|
||||||
'versions': [
|
'versions': [
|
||||||
|
|
Loading…
Reference in a new issue