refactor: Migrate to m.marked_unread from Matrix v1.12
This commit is contained in:
parent
6117e1cba8
commit
13d756856e
|
|
@ -2597,7 +2597,7 @@ class FakeMatrixApi extends BaseClient {
|
|||
(var req) => {},
|
||||
'/client/v3/user/%40alice%3Aexample.com/rooms/1234/account_data/test.account.data':
|
||||
(var req) => {},
|
||||
'/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/account_data/com.famedly.marked_unread':
|
||||
'/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/account_data/m.marked_unread':
|
||||
(var req) => {},
|
||||
'/client/v3/user/%40test%3AfakeServer.notExisting/account_data/m.direct':
|
||||
(var req) => {},
|
||||
|
|
|
|||
|
|
@ -493,7 +493,9 @@ class Room {
|
|||
|
||||
bool get markedUnread {
|
||||
return MarkedUnread.fromJson(
|
||||
roomAccountData[EventType.markedUnread]?.content ?? {})
|
||||
roomAccountData[EventType.markedUnread]?.content ??
|
||||
roomAccountData[EventType.oldMarkedUnread]?.content ??
|
||||
{})
|
||||
.unread;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
import 'package:matrix/matrix_api_lite.dart';
|
||||
|
||||
mixin EventType {
|
||||
static const String markedUnread = 'com.famedly.marked_unread';
|
||||
static const String markedUnread = 'm.marked_unread';
|
||||
static const String oldMarkedUnread = 'com.famedly.marked_unread';
|
||||
}
|
||||
|
||||
class MarkedUnread {
|
||||
|
|
|
|||
|
|
@ -1226,10 +1226,9 @@ void main() {
|
|||
await room.markUnread(true);
|
||||
await room.markUnread(false);
|
||||
expect(room.markedUnread, false);
|
||||
room.roomAccountData['com.famedly.marked_unread'] =
|
||||
BasicRoomEvent.fromJson({
|
||||
room.roomAccountData['m.marked_unread'] = BasicRoomEvent.fromJson({
|
||||
'content': {'unread': true},
|
||||
'type': 'com.famedly.marked_unread'
|
||||
'type': 'm.marked_unread'
|
||||
});
|
||||
expect(room.markedUnread, true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue