fix(backend):AttributeError: 'AnonymousUser' object has no attribute 'get_channels_groups'
This commit is contained in:
parent
724d85a2d9
commit
34203afe44
|
@ -19,6 +19,10 @@ class JsonAuthConsumer(JsonWebsocketConsumer):
|
|||
channels.group_add(group, self.channel_name)
|
||||
|
||||
def disconnect(self, close_code):
|
||||
groups = self.scope["user"].get_channels_groups() + self.groups
|
||||
if self.scope.get("user", False) and self.scope.get("user").pk is not None:
|
||||
groups = self.scope["user"].get_channels_groups() + self.groups
|
||||
else:
|
||||
groups = self.groups
|
||||
|
||||
for group in groups:
|
||||
channels.group_discard(group, self.channel_name)
|
||||
|
|
Loading…
Reference in New Issue