Minor fixes

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

@ -813,21 +813,26 @@ 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();
for (final student in students) { try {
await kick(student.id); for (final student in students) {
} await kick(student.id);
if (!isSpace && membership == Membership.join && isUnread) { }
await markUnread(false); if (!isSpace && membership == Membership.join && isUnread) {
await markUnread(false);
}
await leave();
} catch (err, s) {
debugger(when: kDebugMode);
ErrorHandler.logError(e: err, s: s, data: toJson());
} }
await leave();
} }
Future<bool> archiveSpace(BuildContext context, Client client) async { Future<bool> archiveSpace(BuildContext context, Client client) async {
@ -872,16 +877,22 @@ extension PangeaRoom on Room {
final success = await showFutureLoadingDialog( final success = await showFutureLoadingDialog(
context: context, context: context,
future: () async { future: () async {
final List<Room> children = await getChildRooms(); try {
for (final Room child in children) { final List<Room> children = await getChildRooms();
if (!child.isSpace && for (final Room child in children) {
child.membership == Membership.join && if (!child.isSpace &&
child.isUnread) { child.membership == Membership.join &&
await child.markUnread(false); child.isUnread) {
await child.markUnread(false);
}
await child.leave();
} }
await child.leave(); await leave();
} catch (err, stack) {
debugger(when: kDebugMode);
ErrorHandler.logError(e: err, s: stack, data: powerLevels);
rethrow;
} }
await leave();
}, },
); );
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