revert: don't auto-resolve chat_id for task comments
Some checks failed
Deploy Tracker / deploy (push) Failing after 4s
Some checks failed
Deploy Tracker / deploy (push) Failing after 4s
This commit is contained in:
parent
f267089f64
commit
79bd087b65
@ -87,22 +87,8 @@ async def create_message(req: MessageCreate, request: Request, db: AsyncSession
|
|||||||
author_id = member.id
|
author_id = member.id
|
||||||
author_type = member.type
|
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(
|
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,
|
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,
|
parent_id=uuid.UUID(req.parent_id) if req.parent_id else None,
|
||||||
author_type=author_type,
|
author_type=author_type,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user