fix(kfet/open): Wrap sync function for async use

This commit is contained in:
Tom Hubrecht 2025-01-16 18:47:11 +01:00 committed by catvayor
parent b7d8af144b
commit 2a13f685ec

View file

@ -1,3 +1,5 @@
from asgiref.sync import sync_to_async
from ..decorators import kfet_is_team
from ..utils import DjangoJsonWebsocketConsumer, PermConsumerMixin
from .open import kfet_open
@ -19,7 +21,7 @@ class OpenKfetConsumer(PermConsumerMixin, DjangoJsonWebsocketConsumer):
"""Send current status on connect."""
await super().connect()
group = "team" if kfet_is_team(self.user) else "base"
group = "team" if await sync_to_async(kfet_is_team)(self.user) else "base"
await self.channel_layer.group_add(f"kfet.open.{group}", self.channel_name)