feat(project): 실시간 저장·댓글 답글/반응·완료 이력·수신함 오른쪽 작업 창·화면 배율 토글
- 작업 창 저장 버튼 제거 → 칸별 실시간 저장(새 작업은 제목 입력 시 생성) - 댓글 답글·이모티콘 반응(마이그레이션 012), @태그 아이콘+이름 칩, 이모티콘 선택기 - 작업 완료 시 댓글 사이에 "OO 님이 이 작업을 완료했습니다" 이력 표시 - 수신함 "확인" → 페이지 이동 없이 오른쪽 패널(iframe embed)에 작업 창 - 프로젝트 제목 클릭 수정, 긴 작업 제목 자동 줄바꿈 - 상단 바 화면 배율 토글(2880x1620·200%용, .erp-app zoom .75) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1620,7 +1620,17 @@ def api_list_comments(request: Request, task_id: int) -> JSONResponse:
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
_require_manage(request, st, user, task["project_id"])
|
||||
return JSONResponse({"comments": st.list_comments(task_id=task_id)})
|
||||
try:
|
||||
events = st.list_completion_events(task_id=task_id)
|
||||
except Exception: # noqa: BLE001 - 완료 표시는 부가 정보
|
||||
logger.warning("완료 이력 조회 실패: task=%s", task_id)
|
||||
events = []
|
||||
return JSONResponse({
|
||||
"comments": st.list_comments(task_id=task_id),
|
||||
# "OO 님이 이 작업을 완료했습니다" — 댓글 사이에 시간순으로 끼워 보인다.
|
||||
"events": [{"type": "completed", **e} for e in events],
|
||||
"features": st.comment_features(),
|
||||
})
|
||||
|
||||
|
||||
@router.post("/api/tasks/{task_id}/comments")
|
||||
@@ -1633,6 +1643,14 @@ def api_add_comment(
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
_require_manage(request, st, user, task["project_id"])
|
||||
parent_id = payload.get("parent_id")
|
||||
if parent_id:
|
||||
try:
|
||||
parent_id = int(parent_id)
|
||||
except (TypeError, ValueError):
|
||||
raise HTTPException(status_code=400, detail="parent_id 가 올바르지 않습니다.")
|
||||
if not st.comment_features()["replies"]:
|
||||
raise HTTPException(status_code=503, detail=_COMMENT_012_MSG)
|
||||
try:
|
||||
comment = st.add_comment(
|
||||
task_id=task_id,
|
||||
@@ -1640,9 +1658,12 @@ def api_add_comment(
|
||||
author_name=user.get("name") or user["email"].split("@")[0],
|
||||
body=payload.get("body", ""),
|
||||
allow_empty=bool(payload.get("has_attachment")),
|
||||
parent_id=parent_id or None,
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
comment.setdefault("parent_id", None)
|
||||
comment["reactions"] = []
|
||||
_follow(st, task_id, [user["email"]]) # 댓글 단 사람은 이후 소식도 받는다
|
||||
project = st.get_project(project_id=task["project_id"]) or {"id": task["project_id"], "name": task.get("project_name", "")}
|
||||
_inbox(
|
||||
@@ -1661,6 +1682,39 @@ def api_add_comment(
|
||||
return JSONResponse({"comment": comment}, status_code=201)
|
||||
|
||||
|
||||
_COMMENT_012_MSG = (
|
||||
"댓글 답글·반응 기능은 DB 마이그레이션 012 적용 후 사용할 수 있습니다 "
|
||||
"(scripts/sql/project_db_012_comment_replies_reactions.sql)."
|
||||
)
|
||||
_REACTION_MAX_LEN = 16 # 이모티콘 1개(ZWJ 조합·국기 포함)면 충분한 길이
|
||||
|
||||
|
||||
@router.post("/api/comments/{comment_id}/reactions")
|
||||
def api_toggle_reaction(
|
||||
request: Request, comment_id: int, payload: dict[str, Any] = Body(...)
|
||||
) -> JSONResponse:
|
||||
"""댓글 이모티콘 반응 켜기/끄기(아사나식). body: {"emoji": "👍"} → {"reactions": [...]}"""
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
emoji = str(payload.get("emoji") or "").strip()
|
||||
if not emoji or len(emoji) > _REACTION_MAX_LEN or any(ch.isalnum() or ch in "<>&\"'" for ch in emoji):
|
||||
raise HTTPException(status_code=400, detail="이모티콘이 올바르지 않습니다.")
|
||||
comment = st.get_comment(comment_id=comment_id)
|
||||
if comment is None:
|
||||
raise HTTPException(status_code=404, detail="댓글을 찾을 수 없습니다.")
|
||||
task = st.get_task(task_id=comment["task_id"])
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
_require_manage(request, st, user, task["project_id"])
|
||||
if not st.comment_features()["reactions"]:
|
||||
raise HTTPException(status_code=503, detail=_COMMENT_012_MSG)
|
||||
try:
|
||||
reactions = st.toggle_reaction(comment_id=comment_id, user_email=user["email"], emoji=emoji)
|
||||
except KeyError:
|
||||
raise HTTPException(status_code=404, detail="댓글을 찾을 수 없습니다.")
|
||||
return JSONResponse({"reactions": reactions})
|
||||
|
||||
|
||||
@router.put("/api/comments/{comment_id}")
|
||||
def api_update_comment(
|
||||
request: Request, comment_id: int, payload: dict[str, Any] = Body(...)
|
||||
|
||||
Reference in New Issue
Block a user