1.9
This commit is contained in:
@@ -22,6 +22,7 @@ async def handle_chat_send(ws: WebSocket, user_id: str, data: dict, db: AsyncSes
|
||||
content=data["content"],
|
||||
msg_type=data.get("type", "text"),
|
||||
reply_to_id=data.get("reply_to_id"),
|
||||
mentioned_user_ids=data.get("mentioned_user_ids"),
|
||||
)
|
||||
await db.commit()
|
||||
|
||||
@@ -60,6 +61,8 @@ async def handle_chat_send(ws: WebSocket, user_id: str, data: dict, db: AsyncSes
|
||||
"reply_to_id": message.reply_to_id,
|
||||
"reply_to_content": reply_to_content,
|
||||
"reply_to_sender_name": reply_to_sender_name,
|
||||
"mentions": data.get("mentioned_user_ids"),
|
||||
"is_recalled": False,
|
||||
"created_at": message.created_at.isoformat(),
|
||||
}
|
||||
|
||||
@@ -69,6 +72,15 @@ async def handle_chat_send(ws: WebSocket, user_id: str, data: dict, db: AsyncSes
|
||||
await manager.broadcast_to_conversation(
|
||||
member_ids, EventType.CHAT_MESSAGE, msg_data
|
||||
)
|
||||
# 被@的人:单独推送提及通知(即使免打扰也提醒)
|
||||
mentioned = data.get("mentioned_user_ids") or []
|
||||
for mid in mentioned:
|
||||
if mid in member_ids and mid != user_id:
|
||||
await manager.send_to_user(mid, EventType.PRESENCE_MENTIONED, {
|
||||
"conversation_id": message.conversation_id,
|
||||
"from_user_id": user_id,
|
||||
"from_username": sender.username if sender else "未知",
|
||||
})
|
||||
except Exception as e:
|
||||
await manager.send_to_user(user_id, EventType.ERROR, {"message": str(e)})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user