This commit is contained in:
2023-10-04 20:14:06 +03:00
parent 34b7d0021d
commit 1360692b57
6 changed files with 42 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
import json
from datetime import datetime, timezone
from services.auth import login_required
from services.presence import notify_message
from services.redis import redis
from resolvers import mutation
@@ -53,11 +54,7 @@ async def create_message(_, info, chat: str, body: str, reply_to=None):
# await FollowingManager.push("chat", result)
# subscribe on updates
channel_name = (
f"chat:{chat['id']}" if not chat["title"] else f"group:{chat['id']}"
)
new_message["kind"] = "new_message"
await redis.execute_pubsub("PUBLISH", channel_name, json.dumps(new_message))
await notify_message(new_message, chat["id"])
return {"message": new_message, "error": None}