From 833249191cd19d7a579965f4bb945d3748c027ad Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 4 Apr 2021 16:37:02 +0200 Subject: [PATCH] Missing await --- .../commands/fix_matrix_channels.py | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/participation/management/commands/fix_matrix_channels.py b/apps/participation/management/commands/fix_matrix_channels.py index 819dadc..21f08eb 100644 --- a/apps/participation/management/commands/fix_matrix_channels.py +++ b/apps/participation/management/commands/fix_matrix_channels.py @@ -51,7 +51,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias("#annonces:tfjm.org"): + if not await Matrix.resolve_room_alias("#annonces:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="annonces", @@ -61,7 +61,7 @@ class Command(BaseCommand): preset=RoomPreset.public_chat, ) - if not Matrix.resolve_room_alias("#bienvenue:tfjm.org"): + if not await Matrix.resolve_room_alias("#bienvenue:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="bienvenue", @@ -71,7 +71,7 @@ class Command(BaseCommand): preset=RoomPreset.public_chat, ) - if not Matrix.resolve_room_alias("#bot:tfjm.org"): + if not await Matrix.resolve_room_alias("#bot:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="bot", @@ -81,7 +81,7 @@ class Command(BaseCommand): preset=RoomPreset.public_chat, ) - if not Matrix.resolve_room_alias("#cno:tfjm.org"): + if not await Matrix.resolve_room_alias("#cno:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="cno", @@ -91,7 +91,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias("#dev-bot:tfjm.org"): + if not await Matrix.resolve_room_alias("#dev-bot:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="dev-bot", @@ -101,7 +101,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias("#faq:tfjm.org"): + if not await Matrix.resolve_room_alias("#faq:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="faq", @@ -111,7 +111,7 @@ class Command(BaseCommand): preset=RoomPreset.public_chat, ) - if not Matrix.resolve_room_alias("#flood:tfjm.org"): + if not await Matrix.resolve_room_alias("#flood:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="flood", @@ -121,7 +121,7 @@ class Command(BaseCommand): preset=RoomPreset.public_chat, ) - if not Matrix.resolve_room_alias("#je-cherche-une-equipe:tfjm.org"): + if not await Matrix.resolve_room_alias("#je-cherche-une-equipe:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias="je-cherche-une-equipe", @@ -195,7 +195,7 @@ class Command(BaseCommand): name = tournament.name slug = name.lower().replace(" ", "-") - if not Matrix.resolve_room_alias(f"#annonces-{slug}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#annonces-{slug}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"annonces-{slug}", @@ -205,7 +205,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias(f"#general-{slug}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#general-{slug}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"general-{slug}", @@ -215,7 +215,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias(f"#flood-{slug}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#flood-{slug}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"flood-{slug}", @@ -225,7 +225,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias(f"#jury-{slug}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#jury-{slug}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"jury-{slug}", @@ -235,7 +235,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias(f"#orga-{slug}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#orga-{slug}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"orga-{slug}", @@ -245,7 +245,7 @@ class Command(BaseCommand): preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias(f"#tirage-au-sort-{slug}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#tirage-au-sort-{slug}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"tirage-au-sort-{slug}", @@ -331,7 +331,7 @@ class Command(BaseCommand): for i in range(2 if five else 1): # Fix for five teams-pools suffix = f"-{chr(ord('A') + i)}" if five else "" - if not Matrix.resolve_room_alias(f"#poule-{slug}-{pool.id}{suffix}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#poule-{slug}-{pool.id}{suffix}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"poule-{slug}-{pool.id}{suffix}", @@ -342,7 +342,7 @@ class Command(BaseCommand): federate=False, preset=RoomPreset.private_chat, ) - if not Matrix.resolve_room_alias(f"#poule-{slug}-{pool.id}{suffix}-jurys:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#poule-{slug}-{pool.id}{suffix}-jurys:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"poule-{slug}-{pool.id}{suffix}-jurys", @@ -357,8 +357,8 @@ class Command(BaseCommand): await Matrix.set_room_avatar(f"#poule-{slug}-{pool.id}{suffix}:tfjm.org", avatar_uri) await Matrix.set_room_avatar(f"#poule-{slug}-{pool.id}{suffix}-jurys:tfjm.org", avatar_uri) - bbb_url = pool.bbb_url - if five: + bbb_url = pool.bbb_url.strip() + if five and ';' in bbb_url: bbb_url = bbb_url.split(";")[i].strip() url_params = urlencode(dict(url=bbb_url, isAudioConf='false', displayName='$matrix_display_name', @@ -429,7 +429,7 @@ class Command(BaseCommand): # Create private channels for teams for team in Team.objects.all(): self.stdout.write(f"Create private channel for {team}...") - if not Matrix.resolve_room_alias(f"#equipe-{team.trigram.lower()}:tfjm.org"): + if not await Matrix.resolve_room_alias(f"#equipe-{team.trigram.lower()}:tfjm.org"): await Matrix.create_room( visibility=RoomVisibility.public, alias=f"equipe-{team.trigram.lower()}",