fix: notice anonymous user

This commit is contained in:
AdrienLSH 2024-05-15 16:41:51 +02:00
parent 6bc7270dfb
commit 71c313a078

View File

@ -26,9 +26,10 @@ class NoticeManager:
'user': ProfileSerializer(consumer.user.profilemodel).data}) 'user': ProfileSerializer(consumer.user.profilemodel).data})
def remove(self, consumer: NoticeConsumer): def remove(self, consumer: NoticeConsumer):
for friend in consumer.user.profilemodel.get_friends(): if consumer.user.is_authenticated:
self.notify_user(friend.user, {'type': 'offline', for friend in consumer.user.profilemodel.get_friends():
'user': ProfileSerializer(consumer.user.profilemodel).data}) self.notify_user(friend.user, {'type': 'offline',
'user': ProfileSerializer(consumer.user.profilemodel).data})
self._list.remove(consumer) self._list.remove(consumer)
def get_consumer_by_user(self, user: User): def get_consumer_by_user(self, user: User):