mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 03:02:14 +01:00 
			
		
		
		
	Add rooms for problems
This commit is contained in:
		@@ -443,5 +443,33 @@ class Command(BaseCommand):
 | 
			
		||||
                                        f"@{participant.matrix_username}:tfjm.org")
 | 
			
		||||
                    await Matrix.set_room_power_level(f"#equipe-{team.trigram.lower()}:tfjm.org",
 | 
			
		||||
                                                      f"@{participant.matrix_username}:tfjm.org", 50)
 | 
			
		||||
 | 
			
		||||
            # Manage channels to discuss about problems
 | 
			
		||||
            for i in range(9):
 | 
			
		||||
                self.stdout.write(f"Create channel for problem {i}...")
 | 
			
		||||
                if not await Matrix.resolve_room_alias(f"#mec-{i}:tfjm.org"):
 | 
			
		||||
                    await Matrix.create_room(
 | 
			
		||||
                        visibility=RoomVisibility.public,
 | 
			
		||||
                        alias=f"mec-{i}",
 | 
			
		||||
                        name=f"Mise en commun - {'Général' if i == 0 else f'Problème {i}'}",
 | 
			
		||||
                        topic=f"Discussion autour des problèmes",
 | 
			
		||||
                        federate=False,
 | 
			
		||||
                        preset=RoomPreset.public_chat,
 | 
			
		||||
                        invite=[f"@{registration.matrix_username}:tfjm.org"
 | 
			
		||||
                                for registration in Registration.objects.all()],
 | 
			
		||||
                        power_level_override={
 | 
			
		||||
                            f"@{registration.matrix_username}:tfjm.org": (95 if registration.is_admin else 50)
 | 
			
		||||
                            for registration in VolunteerRegistration.objects.all()
 | 
			
		||||
                        },
 | 
			
		||||
                    )
 | 
			
		||||
                    await Matrix.set_room_avatar(f"#mec-{i}:tfjm.org", avatar_uri)
 | 
			
		||||
 | 
			
		||||
                for registration in Registration.objects.all():
 | 
			
		||||
                    await Matrix.invite(f"#mec-{i}:tfjm.org", registration.matrix_username)
 | 
			
		||||
 | 
			
		||||
                for registration in VolunteerRegistration.objects.all():
 | 
			
		||||
                    await Matrix.set_room_power_level(f"#mec-{i}:tfjm.org",
 | 
			
		||||
                                                      f"@{registration.matrix_username}:tfjm.org",
 | 
			
		||||
                                                      95 if registration.is_admin else 50)
 | 
			
		||||
    
 | 
			
		||||
        asyncio.get_event_loop().run_until_complete(main())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user