Fix: don't throw people out of labs
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
8018958090
commit
7f8e4fa825
1 changed files with 5 additions and 3 deletions
|
@ -44,7 +44,7 @@ class MlmMatrixBot:
|
|||
|
||||
await self._create_project_rooms(all_projects)
|
||||
|
||||
await self._create_lab_rooms()
|
||||
lab_rooms = await self._create_lab_rooms()
|
||||
|
||||
self._log_step("Loading current rooms")
|
||||
matrix_rooms = await self._get_managed_rooms(with_power_levels=True)
|
||||
|
@ -84,7 +84,7 @@ class MlmMatrixBot:
|
|||
|
||||
# remove from rooms that are not in the groups
|
||||
rooms_to_be_left = list(filter(
|
||||
lambda room: room in matrix_room_ids and not room in rooms_to_join, user['rooms']))
|
||||
lambda room: room in matrix_room_ids and not room in rooms_to_join and not room_id_map[room]['name'] in lab_rooms, user['rooms']))
|
||||
for room_id in rooms_to_be_left:
|
||||
logging.info(f"\t\t* leaving {room_id_map[room_id]['name']}")
|
||||
await self._matrixHelper.remove_user_from_room(
|
||||
|
@ -92,7 +92,7 @@ class MlmMatrixBot:
|
|||
|
||||
# update power levels
|
||||
for room in matrix_rooms:
|
||||
if not room['id'] in rooms_to_join and not room['id'] in user['rooms']:
|
||||
if (not room['id'] in rooms_to_join and not room['id'] in user['rooms']) or room['id'] in rooms_to_be_left:
|
||||
continue
|
||||
|
||||
if (user['matrix_username'] in room['power_levels'] and room['power_levels'][user['matrix_username']] != user['power_level']) or (user['matrix_username'] not in room['power_levels'] and user['power_level'] != 0):
|
||||
|
@ -185,6 +185,8 @@ class MlmMatrixBot:
|
|||
labs = list(map(lambda lab: lab['sAMAccountName'].replace("p_", "").replace("lab", "-lab"), labs))
|
||||
await self._create_rooms(labs, joinable_for_space_members=True)
|
||||
|
||||
return labs
|
||||
|
||||
async def _create_rooms(self, rooms, joinable_for_space_members=False, suggested=False):
|
||||
matrix_room_names = list(map(lambda room: room['name'], await self._get_managed_rooms()))
|
||||
for room in rooms:
|
||||
|
|
Loading…
Reference in a new issue