feat: add reply/forward/pin message flow across backend and web
Some checks failed
CI / test (push) Failing after 24s
Some checks failed
CI / test (push) Failing after 24s
- add reply_to/forwarded_from message fields and chat pinned_message field - add forward and pin APIs plus reply support in message create - wire web actions: Reply, Fwd, Pin and reply composer state - fix spam policy bug: allow repeated identical messages, keep rate limiting
This commit is contained in:
@@ -8,6 +8,7 @@ from app.chats.schemas import (
|
||||
ChatMemberAddRequest,
|
||||
ChatMemberRead,
|
||||
ChatMemberRoleUpdateRequest,
|
||||
ChatPinMessageRequest,
|
||||
ChatRead,
|
||||
ChatTitleUpdateRequest,
|
||||
)
|
||||
@@ -17,6 +18,7 @@ from app.chats.service import (
|
||||
get_chat_for_user,
|
||||
get_chats_for_user,
|
||||
leave_chat_for_user,
|
||||
pin_chat_message_for_user,
|
||||
remove_chat_member_for_user,
|
||||
update_chat_member_role_for_user,
|
||||
update_chat_title_for_user,
|
||||
@@ -58,6 +60,7 @@ async def get_chat(
|
||||
id=chat.id,
|
||||
type=chat.type,
|
||||
title=chat.title,
|
||||
pinned_message_id=chat.pinned_message_id,
|
||||
created_at=chat.created_at,
|
||||
members=members,
|
||||
)
|
||||
@@ -127,3 +130,13 @@ async def leave_chat(
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> None:
|
||||
await leave_chat_for_user(db, chat_id=chat_id, user_id=current_user.id)
|
||||
|
||||
|
||||
@router.post("/{chat_id}/pin", response_model=ChatRead)
|
||||
async def pin_chat_message(
|
||||
chat_id: int,
|
||||
payload: ChatPinMessageRequest,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ChatRead:
|
||||
return await pin_chat_message_for_user(db, chat_id=chat_id, user_id=current_user.id, payload=payload)
|
||||
|
||||
Reference in New Issue
Block a user