Minor fixes

pull/1183/head
Kelrap 1 year ago
parent 2127277d81
commit 42406dd360

@ -813,14 +813,15 @@ extension PangeaRoom on Room {
} }
Future<void> archive() async { Future<void> archive() async {
final participants = await requestParticipants(); final students = (await requestParticipants())
final students = participants
.where( .where(
(e) => (e) =>
e.id != client.userID &&
e.powerLevel < ClassDefaultValues.powerLevelOfAdmin && e.powerLevel < ClassDefaultValues.powerLevelOfAdmin &&
e.id != BotName.byEnvironment, e.id != BotName.byEnvironment,
) )
.toList(); .toList();
try {
for (final student in students) { for (final student in students) {
await kick(student.id); await kick(student.id);
} }
@ -828,6 +829,10 @@ extension PangeaRoom on Room {
await markUnread(false); await markUnread(false);
} }
await leave(); await leave();
} catch (err, s) {
debugger(when: kDebugMode);
ErrorHandler.logError(e: err, s: s, data: toJson());
}
} }
Future<bool> archiveSpace(BuildContext context, Client client) async { Future<bool> archiveSpace(BuildContext context, Client client) async {
@ -872,6 +877,7 @@ extension PangeaRoom on Room {
final success = await showFutureLoadingDialog( final success = await showFutureLoadingDialog(
context: context, context: context,
future: () async { future: () async {
try {
final List<Room> children = await getChildRooms(); final List<Room> children = await getChildRooms();
for (final Room child in children) { for (final Room child in children) {
if (!child.isSpace && if (!child.isSpace &&
@ -882,6 +888,11 @@ extension PangeaRoom on Room {
await child.leave(); await child.leave();
} }
await leave(); await leave();
} catch (err, stack) {
debugger(when: kDebugMode);
ErrorHandler.logError(e: err, s: stack, data: powerLevels);
rethrow;
}
}, },
); );
MatrixState.pangeaController.classController MatrixState.pangeaController.classController
@ -1091,7 +1102,7 @@ extension PangeaRoom on Room {
for (final child in spaceChildren) { for (final child in spaceChildren) {
if (child.roomId == null) continue; if (child.roomId == null) continue;
final Room? room = client.getRoomById(child.roomId!); final Room? room = client.getRoomById(child.roomId!);
if (room != null) { if (room != null && !room.isAnalyticsRoom) {
children.add(room); children.add(room);
} }
} }

Loading…
Cancel
Save