File tree 1 file changed +14
-1
lines changed
lib/pangea/spaces/controllers
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import 'dart:convert';
3
3
4
4
import 'package:flutter/material.dart' ;
5
5
6
+ import 'package:collection/collection.dart' ;
6
7
import 'package:flutter_gen/gen_l10n/l10n.dart' ;
7
8
import 'package:get_storage/get_storage.dart' ;
8
9
import 'package:go_router/go_router.dart' ;
@@ -170,10 +171,22 @@ class ClassController extends BaseController {
170
171
171
172
GoogleAnalytics .joinClass (classCode);
172
173
173
- if (room.client. getRoomById (room.id) ? . membership != Membership .join) {
174
+ if (room.membership != Membership .join) {
174
175
await room.client.waitForRoomInSync (room.id, join: true );
175
176
}
176
177
178
+ // Sometimes, the invite event comes through after the join event and
179
+ // replaces it, so membership gets out of sync. In this case,
180
+ // load the true value from the server.
181
+ // Related github issue: https://github.com/pangeachat/client/issues/2098
182
+ if (room.membership !=
183
+ room
184
+ .getParticipants ()
185
+ .firstWhereOrNull ((u) => u.id == room? .client.userID)
186
+ ? .membership) {
187
+ await room.requestParticipants ();
188
+ }
189
+
177
190
context.push ("/rooms/${room .id }/details" );
178
191
} catch (e, s) {
179
192
ErrorHandler .logError (
You can’t perform that action at this time.
0 commit comments