feat(project): 용어 "업무" 통일·섹션 담당자 바로 지정·세부 업무 협업자·반응 알림
- 화면·메시지·알림 제목·도움말의 "작업" → "업무"(조사 포함). 큰 알림 팝업·PC 알림 소스는 예전 "작업 배정:" 접두어도 뗀다 - 보드·목록 섹션 제목 오른쪽 담당자 아이콘을 눌러 기본 담당자를 그 자리에서 지정 - 섹션을 접으면 제목 보통 굵기, 펼치면 다시 굵게 - 업무 창 세부 업무 줄 담당자 오른쪽에 협업자 지정(subtasks[].followers, list_followers_of) - 댓글 이모티콘 반응을 켜면 댓글 쓴 사람에게 어떤 이모티콘인지 수신함 알림(type=reaction) - 왼쪽 전체 보기의 기본 보기는 대시보드 - 대시보드 업무 목록 패널에서 연 업무 창은 패널 왼쪽에 열림 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -130,15 +130,15 @@ def _accessible_project_ids(st: Any, user: dict[str, Any]) -> set[int] | None:
|
||||
return access.visible_project_ids(st, user)
|
||||
|
||||
|
||||
_TASK_DENIED = "이 작업을 볼 권한이 없습니다. 프로젝트 관리자에게 멤버 배정을 요청하세요."
|
||||
_TASK_READ_ONLY = ("다른 프로젝트에서 연결된 작업이라 읽기만 할 수 있습니다. "
|
||||
_TASK_DENIED = "이 업무를 볼 권한이 없습니다. 프로젝트 관리자에게 멤버 배정을 요청하세요."
|
||||
_TASK_READ_ONLY = ("다른 프로젝트에서 연결된 업무라 읽기만 할 수 있습니다. "
|
||||
"변경은 원 소속 프로젝트 멤버만 할 수 있습니다.")
|
||||
|
||||
|
||||
def _task_or_404(st: Any, task_id: int) -> dict[str, Any]:
|
||||
task = st.get_task(task_id=task_id)
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
raise HTTPException(status_code=404, detail="업무를 찾을 수 없습니다.")
|
||||
return task
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ def _notify_completed(
|
||||
subject=store.build_subject_completed(project_name=project_name, task_title=task["title"]),
|
||||
body=(
|
||||
f"프로젝트: {project_name}\n"
|
||||
f"완료된 작업: {task['title']}\n"
|
||||
f"완료된 업무: {task['title']}\n"
|
||||
f"담당자: {task.get('assignee_name') or task.get('assignee_email') or '-'}\n"
|
||||
f"완료 처리: {actor}\n"
|
||||
),
|
||||
@@ -402,7 +402,7 @@ def _notify_completed(
|
||||
_inbox(
|
||||
st, recipients=_task_recipients(st, project, task, exclude=actor),
|
||||
actor=actor, project_id=task["project_id"], task_id=task["id"],
|
||||
ntype="completed", title=f"작업 완료: {task['title']}", body=project_name,
|
||||
ntype="completed", title=f"업무 완료: {task['title']}", body=project_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -667,8 +667,8 @@ def my_tasks_page(request: Request) -> HTMLResponse:
|
||||
"user": user,
|
||||
**_role_ctx(user),
|
||||
"nav_items": build_erp_nav(user, active="project"),
|
||||
"page_title": "내 작업",
|
||||
"page_subtitle": "내가 담당자인 작업을 한 곳에서 봅니다.",
|
||||
"page_title": "내 업무",
|
||||
"page_subtitle": "내가 담당자인 업무를 한 곳에서 봅니다.",
|
||||
"force_sidebar_collapsed": True,
|
||||
"nav_projects": nav_projects,
|
||||
"goal_years": _goal_years_nav(st),
|
||||
@@ -728,11 +728,11 @@ def task_permalink(request: Request, task_id: int):
|
||||
|
||||
task = st.get_task(task_id=task_id)
|
||||
if task is None:
|
||||
return _denied("작업을 찾을 수 없습니다. 삭제되었을 수 있습니다.", 404)
|
||||
return _denied("업무를 찾을 수 없습니다. 삭제되었을 수 있습니다.", 404)
|
||||
target = _task_open_project(st, user, task)
|
||||
if target is None:
|
||||
return _denied(
|
||||
"이 작업이 속한 프로젝트의 멤버만 볼 수 있습니다. "
|
||||
"이 업무가 속한 프로젝트의 멤버만 볼 수 있습니다. "
|
||||
"프로젝트 관리자에게 멤버 배정을 요청하세요.",
|
||||
403,
|
||||
)
|
||||
@@ -1514,7 +1514,7 @@ def _create_task_for(
|
||||
),
|
||||
body=(
|
||||
f"프로젝트: {project['name']}\n"
|
||||
f"작업: {task['title']}\n"
|
||||
f"업무: {task['title']}\n"
|
||||
f"담당자: {task.get('assignee_name') or task['assignee_email']} "
|
||||
f"({task['assignee_email']})\n"
|
||||
f"마감일: {task.get('due_date') or '-'}\n"
|
||||
@@ -1524,7 +1524,7 @@ def _create_task_for(
|
||||
_inbox(
|
||||
st, recipients=[task["assignee_email"]], actor=user["email"],
|
||||
project_id=project_id, task_id=task["id"], ntype="assigned",
|
||||
title=f"작업 배정: {task['title']}",
|
||||
title=f"업무 배정: {task['title']}",
|
||||
body=f"{project['name']} · 마감 {task.get('due_date') or '-'}",
|
||||
)
|
||||
# 완료 섹션에 바로 만든 작업 — 완료 섹션으로 옮긴 것과 같은 완료 알림.
|
||||
@@ -1573,7 +1573,7 @@ def api_update_task(
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
except KeyError:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
raise HTTPException(status_code=404, detail="업무를 찾을 수 없습니다.")
|
||||
|
||||
project_name = task.get("project_name") or ""
|
||||
project = st.get_project(project_id=existing["project_id"]) or {"id": existing["project_id"], "name": project_name}
|
||||
@@ -1588,7 +1588,7 @@ def api_update_task(
|
||||
),
|
||||
body=(
|
||||
f"프로젝트: {project_name}\n"
|
||||
f"작업: {task['title']}\n"
|
||||
f"업무: {task['title']}\n"
|
||||
f"담당자: {task.get('assignee_name') or task['_newly_assigned']} "
|
||||
f"({task['_newly_assigned']})\n"
|
||||
f"마감일: {task.get('due_date') or '-'}\n"
|
||||
@@ -1598,7 +1598,7 @@ def api_update_task(
|
||||
_inbox(
|
||||
st, recipients=[task["_newly_assigned"]], actor=user["email"],
|
||||
project_id=existing["project_id"], task_id=task_id, ntype="assigned",
|
||||
title=f"작업 배정: {task['title']}",
|
||||
title=f"업무 배정: {task['title']}",
|
||||
body=f"{project_name} · 마감 {task.get('due_date') or '-'}",
|
||||
)
|
||||
if task.get("_newly_completed"):
|
||||
@@ -1623,7 +1623,7 @@ def api_delete_task(request: Request, task_id: int) -> JSONResponse:
|
||||
try:
|
||||
removed_task_ids, trash_id = st.delete_task(task_id=task_id, deleted_by=user["email"])
|
||||
except KeyError:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
raise HTTPException(status_code=404, detail="업무를 찾을 수 없습니다.")
|
||||
# 휴지통(010)이 있으면 첨부 폴더도 휴지통으로(복구 대비), 없으면 예전처럼 삭제.
|
||||
if trash_id is not None:
|
||||
_move_task_dirs_to_trash(request, removed_task_ids, trash_id)
|
||||
@@ -1658,6 +1658,10 @@ def api_get_task(request: Request, task_id: int) -> JSONResponse:
|
||||
else:
|
||||
try:
|
||||
task["followers"] = st.list_followers(task_id=task_id)
|
||||
# 세부 업무 줄의 협업자 아이콘(담당자 오른쪽) — 줄마다 다시 묻지 않게 한 번에.
|
||||
by_sub = st.list_followers_of(task_ids=[s["id"] for s in task["subtasks"]])
|
||||
for s in task["subtasks"]:
|
||||
s["followers"] = by_sub.get(int(s["id"]), [])
|
||||
except Exception: # noqa: BLE001 - 008 미적용이면 팔로워 UI 를 숨긴다
|
||||
task["followers"] = None
|
||||
return JSONResponse({"task": task})
|
||||
@@ -1837,13 +1841,13 @@ def api_add_task_link(
|
||||
st = _db_or_503(request)
|
||||
task = st.get_task(task_id=task_id)
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
raise HTTPException(status_code=404, detail="업무를 찾을 수 없습니다.")
|
||||
try:
|
||||
target_project_id = int(payload.get("project_id"))
|
||||
except (TypeError, ValueError):
|
||||
raise HTTPException(status_code=400, detail="project_id 가 필요합니다.")
|
||||
if target_project_id == task["project_id"]:
|
||||
raise HTTPException(status_code=400, detail="이미 이 작업의 기본 프로젝트입니다.")
|
||||
raise HTTPException(status_code=400, detail="이미 이 업무의 기본 프로젝트입니다.")
|
||||
_require_manage(request, st, user, target_project_id)
|
||||
already_linked = any(
|
||||
link["project_id"] == target_project_id for link in st.list_task_links(task_id=task_id)
|
||||
@@ -1869,7 +1873,7 @@ def api_remove_task_link(request: Request, task_id: int, project_id: int) -> JSO
|
||||
st = _db_or_503(request)
|
||||
task = st.get_task(task_id=task_id)
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="작업을 찾을 수 없습니다.")
|
||||
raise HTTPException(status_code=404, detail="업무를 찾을 수 없습니다.")
|
||||
_require_manage(request, st, user, task["project_id"])
|
||||
_require_manage(request, st, user, project_id)
|
||||
st.remove_task_link(task_id=task_id, project_id=project_id)
|
||||
@@ -2125,9 +2129,31 @@ def api_toggle_reaction(
|
||||
reactions = st.toggle_reaction(comment_id=comment_id, user_email=user["email"], emoji=emoji)
|
||||
except KeyError:
|
||||
raise HTTPException(status_code=404, detail="댓글을 찾을 수 없습니다.")
|
||||
me = store.norm_str(user["email"], lower=True)
|
||||
if any(r["emoji"] == emoji and me in r["users"] for r in reactions): # 켤 때만(끌 때는 알림 없음)
|
||||
_notify_reaction(st, task=task, comment=comment, actor=user["email"], emoji=emoji)
|
||||
return JSONResponse({"reactions": reactions})
|
||||
|
||||
|
||||
def _notify_reaction(
|
||||
st: Any, *, task: dict[str, Any], comment: dict[str, Any], actor: str, emoji: str,
|
||||
) -> None:
|
||||
"""댓글 이모티콘 반응 알림 — 그 댓글을 쓴 사람에게 어떤 이모티콘인지(자기 댓글·지금 볼 수 없는 사람은 제외)."""
|
||||
author = store.norm_str(comment.get("author_email"), lower=True)
|
||||
if not author or author == store.norm_str(actor, lower=True):
|
||||
return
|
||||
recipients = access.filter_recipients(st, task, [author])
|
||||
if not recipients:
|
||||
return
|
||||
project = st.get_project(project_id=task["project_id"]) or {}
|
||||
preview = (comment.get("body") or "").strip().replace("\n", " ")[:80] or "첨부 파일"
|
||||
_inbox(
|
||||
st, recipients=recipients, actor=actor, project_id=task["project_id"], task_id=task["id"],
|
||||
ntype="reaction", title=f"내 댓글에 {emoji} 반응: {task['title']}",
|
||||
body=f"{project.get('name') or task.get('project_name') or ''} · “{preview}”",
|
||||
)
|
||||
|
||||
|
||||
def _comment_task_access(st: Any, user: dict[str, Any], comment_id: int) -> dict[str, Any]:
|
||||
"""댓글 수정·삭제 전 — 작성자라도 지금 그 작업의 원 소속 권한이 없으면 거절(멤버에서 빠진 뒤
|
||||
자기 댓글을 고치거나 지우던 경로 차단). 작성자 본인/관리자 검사는 DB 쪽이 한다."""
|
||||
@@ -2595,7 +2621,7 @@ def notifier_page(request: Request) -> Any:
|
||||
"my_open_total": _my_open_count(st, user),
|
||||
"mention_unread": _safe_mention_unread(st, user),
|
||||
"page_title": "PC 알림 프로그램",
|
||||
"page_subtitle": "브라우저가 뒤에 있어도 태그·작업 배정 알림을 화면 위에 크게",
|
||||
"page_subtitle": "브라우저가 뒤에 있어도 태그·업무 배정 알림을 화면 위에 크게",
|
||||
"force_sidebar_collapsed": True,
|
||||
"color_palette": list(store.COLOR_PALETTE),
|
||||
"project_icons": list(store.PROJECT_ICONS),
|
||||
@@ -2744,7 +2770,7 @@ def trash_page(request: Request) -> HTMLResponse:
|
||||
"my_open_total": _my_open_count(st, user),
|
||||
"mention_unread": _safe_mention_unread(st, user),
|
||||
"page_title": "휴지통",
|
||||
"page_subtitle": "삭제한 작업 — 3개월 보관, Pro user 이상만 복구",
|
||||
"page_subtitle": "삭제한 업무 — 3개월 보관, Pro user 이상만 복구",
|
||||
"force_sidebar_collapsed": True,
|
||||
"color_palette": list(store.COLOR_PALETTE),
|
||||
"project_icons": list(store.PROJECT_ICONS),
|
||||
@@ -2849,7 +2875,7 @@ def inbox_page(request: Request) -> HTMLResponse:
|
||||
"goal_years": _goal_years_nav(st),
|
||||
"my_open_total": my_open_total,
|
||||
"page_title": "수신함",
|
||||
"page_subtitle": "나를 태그한 작업과 프로젝트 알림",
|
||||
"page_subtitle": "나를 태그한 업무와 프로젝트 알림",
|
||||
"force_sidebar_collapsed": True,
|
||||
"color_palette": list(store.COLOR_PALETTE),
|
||||
"project_icons": list(store.PROJECT_ICONS),
|
||||
@@ -2973,9 +2999,9 @@ def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
except store.MeetingMigration027Needed:
|
||||
raise HTTPException(status_code=503, detail="같은 항목 칸 안 줄 추가·항목 칸 나누기는 project_db 마이그레이션 027 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingParentTaskMigrationNeeded:
|
||||
raise HTTPException(status_code=503, detail="작업 칸(이미 있는 작업의 세부 작업으로 등록)은 project_db 마이그레이션 026 적용 후 사용할 수 있습니다.")
|
||||
raise HTTPException(status_code=503, detail="업무 칸(이미 있는 업무의 세부 업무로 등록)은 project_db 마이그레이션 026 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingTaskMigrationNeeded:
|
||||
raise HTTPException(status_code=503, detail="작업 등록 표(모두가 같이 보는 주차별 표)는 project_db 마이그레이션 025 적용 후 사용할 수 있습니다.")
|
||||
raise HTTPException(status_code=503, detail="업무 등록 표(모두가 같이 보는 주차별 표)는 project_db 마이그레이션 025 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingMigration020Needed:
|
||||
raise HTTPException(status_code=503, detail="새 주차·결과 글·주차별 목표는 project_db 마이그레이션 020 적용 후 사용할 수 있습니다.")
|
||||
except store.GoalCellConflict as exc:
|
||||
@@ -3866,7 +3892,7 @@ def api_apply_quick_task(request: Request, item_id: int, bg: BackgroundTasks) ->
|
||||
|
||||
def create(row: dict[str, Any], parent_task_id: int | None) -> dict[str, Any]:
|
||||
if not row["title"].strip():
|
||||
raise ValueError("작업 제목을 쓰세요.")
|
||||
raise ValueError("업무 제목을 쓰세요.")
|
||||
if row["project_id"] is None:
|
||||
raise ValueError("프로젝트를 고르세요.")
|
||||
rec = access.default_user_lookup(row["assignee_email"]) if row["assignee_email"] else None
|
||||
|
||||
Reference in New Issue
Block a user