mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-11-04 16:02:31 +01:00 
			
		
		
		
	Create #annonces channel
This commit is contained in:
		@@ -3,7 +3,7 @@ from nio import RoomPreset
 | 
			
		||||
 | 
			
		||||
from corres2math.matrix import Matrix, RoomVisibility
 | 
			
		||||
from django.core.management import BaseCommand
 | 
			
		||||
from registration.models import AdminRegistration
 | 
			
		||||
from registration.models import AdminRegistration, Registration
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Command(BaseCommand):
 | 
			
		||||
@@ -20,6 +20,24 @@ class Command(BaseCommand):
 | 
			
		||||
                preset=RoomPreset.public_chat,
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        if not async_to_sync(Matrix.resolve_room_alias)("#annonces:correspondances-maths.fr"):
 | 
			
		||||
            Matrix.create_room(
 | 
			
		||||
                visibility=RoomVisibility.public,
 | 
			
		||||
                alias="annonces",
 | 
			
		||||
                name="Annonces",
 | 
			
		||||
                topic="Informations importantes des Correspondances",
 | 
			
		||||
                federate=False,
 | 
			
		||||
                preset=RoomPreset.public_chat,
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        Matrix.set_room_power_level_event("#annonces:correspondances-maths.fr", "events_default", 50)
 | 
			
		||||
 | 
			
		||||
        for r in Registration.objects.all():
 | 
			
		||||
            Matrix.invite("#annonces:correspondances-maths.fr", f"@{r.matrix_username}:correspondances-maths.fr")
 | 
			
		||||
            Matrix.invite("#faq:correspondances-maths.fr", f"@{r.matrix_username}:correspondances-maths.fr")
 | 
			
		||||
 | 
			
		||||
        for admin in AdminRegistration.objects.all():
 | 
			
		||||
            Matrix.set_room_power_level("#annonces:correspondances-maths.fr",
 | 
			
		||||
                                        f"@{admin.matrix_username}:correspondances-maths.fr", 95)
 | 
			
		||||
            Matrix.set_room_power_level("#faq:correspondances-maths.fr",
 | 
			
		||||
                                        f"@{admin.matrix_username}:correspondances-maths.fr", 95)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user