fix: Better handling leave broken room on join
This commit is contained in:
parent
388598ef67
commit
cbae6b9c84
|
|
@ -227,6 +227,8 @@ class LeftRoomUpdate extends SyncRoomUpdate {
|
|||
TimelineUpdate timeline;
|
||||
List<BasicRoomEvent> accountData;
|
||||
|
||||
LeftRoomUpdate();
|
||||
|
||||
LeftRoomUpdate.fromJson(Map<String, dynamic> json) {
|
||||
state = (json['state'] != null && json['state']['events'] != null)
|
||||
? (json['state']['events'] as List)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import 'utils/logs.dart';
|
|||
import 'utils/markdown.dart';
|
||||
import 'utils/matrix_file.dart';
|
||||
import 'utils/matrix_localizations.dart';
|
||||
import 'utils/room_update.dart';
|
||||
import 'utils/states_map.dart';
|
||||
|
||||
enum PushRuleState { notify, mentions_only, dont_notify }
|
||||
|
|
@ -812,13 +811,12 @@ class Room {
|
|||
if (removeIfNotFound &&
|
||||
[MatrixError.M_NOT_FOUND, MatrixError.M_UNKNOWN]
|
||||
.contains(exception.error)) {
|
||||
await client.database?.forgetRoom(client.id, id);
|
||||
client.onRoomUpdate.add(
|
||||
RoomUpdate(
|
||||
id: id,
|
||||
membership: Membership.leave,
|
||||
notification_count: 0,
|
||||
highlight_count: 0),
|
||||
await _handleFakeSync(
|
||||
SyncUpdate()
|
||||
..rooms = (RoomsUpdate()
|
||||
..leave = {
|
||||
'$id': (LeftRoomUpdate()),
|
||||
}),
|
||||
);
|
||||
}
|
||||
rethrow;
|
||||
|
|
|
|||
Loading…
Reference in New Issue