NoticeManager: thats better
This commit is contained in:
parent
743988c883
commit
9fea10fc91
@ -18,7 +18,7 @@ class NoticeManager:
|
||||
|
||||
unsend_notices = NoticeModel.objects.filter(user=consumer.user)
|
||||
for notice in unsend_notices:
|
||||
self.notify_user(consumer.user, json_data=notice.data)
|
||||
consumer.send(notice.data)
|
||||
notice.delete()
|
||||
|
||||
def remove(self, consumer: NoticeConsumer):
|
||||
@ -29,9 +29,9 @@ class NoticeManager:
|
||||
if consumer.user == user:
|
||||
return consumer
|
||||
|
||||
def notify_user(self, user: User, data: dict = None, json_data: str = None):
|
||||
def notify_user(self, user: User, data: dict):
|
||||
consumer = self.get_consumer_by_user(user)
|
||||
data_str: str = json.dumps(data) if json_data is None else json_data
|
||||
data_str: str = json.dumps(data)
|
||||
if consumer:
|
||||
consumer.send(data_str)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user