diff --git a/src/tracker/api/messages.py b/src/tracker/api/messages.py index b3571cf..f796a45 100644 --- a/src/tracker/api/messages.py +++ b/src/tracker/api/messages.py @@ -87,22 +87,8 @@ async def create_message(req: MessageCreate, request: Request, db: AsyncSession author_id = member.id author_type = member.type - # Resolve chat_id from task's project if not provided - resolved_chat_id = uuid.UUID(req.chat_id) if req.chat_id else None - if not resolved_chat_id and req.task_id: - from ..models.task import Task - task_r = await db.execute(select(Task).where(Task.id == uuid.UUID(req.task_id))) - task_obj = task_r.scalar_one_or_none() - if task_obj and task_obj.project_id: - chat_r = await db.execute( - select(Chat).where(Chat.project_id == task_obj.project_id, Chat.kind == ChatKind.PROJECT) - ) - project_chat = chat_r.scalar_one_or_none() - if project_chat: - resolved_chat_id = project_chat.id - msg = Message( - chat_id=resolved_chat_id, + chat_id=uuid.UUID(req.chat_id) if req.chat_id else None, task_id=uuid.UUID(req.task_id) if req.task_id else None, parent_id=uuid.UUID(req.parent_id) if req.parent_id else None, author_type=author_type,