Merge pull request #4848 from pangeachat/4839-on-add-course-plan-to-space-set-mspacechild-power-level-to-0
fix: on add course plan to space, set m.space.child power level to 0
This commit is contained in:
commit
7b09ae8969
1 changed files with 17 additions and 0 deletions
|
|
@ -38,6 +38,23 @@ extension CoursePlanRoomExtension on Room {
|
|||
}
|
||||
|
||||
Future<void> addCourseToSpace(String courseId) async {
|
||||
// Ensure students in course can launch activity rooms
|
||||
final powerLevels = Map<String, dynamic>.from(
|
||||
getState(EventTypes.RoomPowerLevels)?.content ?? {},
|
||||
);
|
||||
powerLevels['events'] ??= <String, dynamic>{};
|
||||
final events = Map<String, dynamic>.from(powerLevels['events']);
|
||||
if (events["m.space.child"] != 0) {
|
||||
events["m.space.child"] = 0;
|
||||
powerLevels['events'] = events;
|
||||
await client.setRoomStateWithKey(
|
||||
id,
|
||||
EventTypes.RoomPowerLevels,
|
||||
'',
|
||||
powerLevels,
|
||||
);
|
||||
}
|
||||
|
||||
if (coursePlan?.uuid == courseId) return;
|
||||
final future = waitForRoomInSync();
|
||||
await client.setRoomStateWithKey(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue