This commit is contained in:
@@ -71,7 +71,7 @@ async def create_message(_, info, chat: str, body: str, reply_to=None):
|
||||
await redis.execute("LPUSH", f"chats/{chat_dict['id']}/unread/{member_id}", str(message_id))
|
||||
|
||||
# Отправка уведомления о новом сообщении
|
||||
await notify_message(new_message, chat_dict["id"])
|
||||
await notify_message(new_message, chat_dict["id"], "create")
|
||||
|
||||
return {"message": new_message, "error": None}
|
||||
|
||||
@@ -99,6 +99,7 @@ async def update_message(_, info, chat_id: str, message_id: int, body: str):
|
||||
await redis.execute("SET", f"chats/{chat_id}/messages/{message_id}", json.dumps(message))
|
||||
|
||||
# TODO: use presence service to notify about updated message
|
||||
await notify_message(message, chat_id, "update")
|
||||
|
||||
return {"message": message, "error": None}
|
||||
|
||||
@@ -128,6 +129,7 @@ async def delete_message(_, info, chat_id: str, message_id: int):
|
||||
await redis.execute("LREM", f"chats/{chat_id}/unread/{member_id}", 0, str(message_id))
|
||||
|
||||
# TODO: use presence service to notify about deleted message
|
||||
await notify_message(message, chat_id, "delete")
|
||||
|
||||
return {}
|
||||
|
||||
@@ -149,4 +151,7 @@ async def mark_as_read(_, info, chat_id: str, messages: List[int]):
|
||||
for message_id in messages:
|
||||
await redis.execute("LREM", f"chats/{chat_id}/unread/{author_id}", 0, str(message_id))
|
||||
|
||||
# TODO: seen per author
|
||||
# await notify_message(message, chat_id, "seen")
|
||||
|
||||
return {"error": None}
|
||||
|
Reference in New Issue
Block a user