Merge branch 'feat/project-followers-rules'
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
{% block head_extra %}
|
||||
{# 프로젝트 화면 부품(설명 편집기·날짜 팝업·멤버 고르기)을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<script>window.PJ_LIB_ONLY = true; window.PJ_HOLIDAYS = {{ (pj_kr_holidays or {}) | tojson }};</script>
|
||||
{% endblock %}
|
||||
@@ -64,7 +64,7 @@
|
||||
</section>
|
||||
</div>
|
||||
<script>window.NTC_PEOPLE = {{ people | tojson }};</script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
<script src="/static/erp-notice-admin.js?v=20261012b" defer></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -918,6 +918,8 @@ class ProjectStore:
|
||||
store.validate_date_range(final("start_date"), final("due_date"),
|
||||
final("start_time"), final("due_time"))
|
||||
conn.execute(f"UPDATE tasks SET {', '.join(sets)} WHERE id = %s", (*params, task_id))
|
||||
if "assignee_email" in assignee_fields:
|
||||
self._drop_assignee_follower(conn, task_id, assignee_fields["assignee_email"])
|
||||
if newly_assigned:
|
||||
self._log(conn, project_id=prev["project_id"], task_id=task_id,
|
||||
actor=actor, action=store.ACTION_ASSIGNED,
|
||||
@@ -986,6 +988,8 @@ class ProjectStore:
|
||||
params.append(now_kst())
|
||||
newly_completed = True
|
||||
conn.execute(f"UPDATE tasks SET {', '.join(sets)} WHERE id = %s", (*params, task_id))
|
||||
if newly_assigned:
|
||||
self._drop_assignee_follower(conn, task_id, newly_assigned)
|
||||
conn.execute(
|
||||
"DELETE FROM task_project_links WHERE task_id = ANY(%s) AND project_id = %s", (ids, target))
|
||||
conn.execute("UPDATE project_activity SET project_id = %s WHERE task_id = ANY(%s)", (target, ids))
|
||||
@@ -1993,7 +1997,8 @@ class ProjectStore:
|
||||
return out
|
||||
|
||||
def add_followers(self, *, task_id: int, emails: list[str]) -> list[str]:
|
||||
"""팔로워 추가(이미 있으면 무시). 새로 추가된 이메일만 돌려준다."""
|
||||
"""팔로워 추가(이미 있으면 무시). 새로 추가된 이메일만 돌려준다.
|
||||
그 업무의 담당자는 넣지 않는다 — 협업자는 담당자 외의 멤버(2026-10-13)."""
|
||||
targets = store.normalize_emails(emails)
|
||||
if not targets:
|
||||
return []
|
||||
@@ -2001,11 +2006,18 @@ class ProjectStore:
|
||||
rows = conn.execute(
|
||||
"INSERT INTO task_followers (task_id, user_email) "
|
||||
"SELECT %s, e FROM unnest(%s::text[]) AS e "
|
||||
"WHERE e <> COALESCE((SELECT lower(assignee_email) FROM tasks WHERE id = %s), '') "
|
||||
"ON CONFLICT DO NOTHING RETURNING user_email",
|
||||
(task_id, targets),
|
||||
(task_id, targets, task_id),
|
||||
).fetchall()
|
||||
return [r["user_email"] for r in rows]
|
||||
|
||||
def _drop_assignee_follower(self, conn: Any, task_id: int, email: str) -> None:
|
||||
"""새 담당자는 협업자에서 뺀다(같은 트랜잭션). 008 미적용이면 건너뜀."""
|
||||
if email and self._table_exists(conn, "task_followers"):
|
||||
conn.execute("DELETE FROM task_followers WHERE task_id = %s AND user_email = %s",
|
||||
(task_id, store.norm_str(email, lower=True)))
|
||||
|
||||
def remove_follower(self, *, task_id: int, user_email: str) -> None:
|
||||
with self._pool.connection() as conn:
|
||||
conn.execute(
|
||||
|
||||
@@ -1514,8 +1514,9 @@ def _create_task_for(
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc))
|
||||
# 만든 사람·담당자는 자동 팔로워(아사나와 같은 규칙) + 만들 때 고른 협업자(세부 업무 추가 칸 등)
|
||||
_follow(st, task["id"], [user["email"], task.get("assignee_email") or ""] + followers)
|
||||
# 만든 사람은 자동 협업자 + 만들 때 고른 협업자(세부 업무 추가 칸 등). 담당자는 협업자가 아니다(2026-10-13,
|
||||
# db.add_followers 가 담당자를 거른다 — 만든 사람이 담당자여도 빠진다).
|
||||
_follow(st, task["id"], [user["email"]] + followers)
|
||||
# 생성과 동시에 담당자 지정 시 관리자 메일 + 담당자 인앱 알림
|
||||
if task.get("assignee_email"):
|
||||
_notify(
|
||||
@@ -1603,8 +1604,7 @@ def api_update_task(
|
||||
|
||||
project_name = task.get("project_name") or ""
|
||||
project = st.get_project(project_id=existing["project_id"]) or {"id": existing["project_id"], "name": project_name}
|
||||
if task.get("_newly_assigned"):
|
||||
_follow(st, task_id, [task["_newly_assigned"]])
|
||||
if task.get("_newly_assigned"): # 담당자는 협업자가 아니다 — db.update_task 가 협업자에서 뺐다(2026-10-13)
|
||||
_notify(
|
||||
bg, request,
|
||||
subject=store.build_subject_assigned(
|
||||
@@ -1775,8 +1775,7 @@ def api_move_task_project(
|
||||
raise HTTPException(status_code=404, detail=str(exc))
|
||||
task.pop("_moved_ids", None)
|
||||
newly_assigned = task.pop("_newly_assigned", None)
|
||||
if newly_assigned: # 대상 섹션 기본 담당자가 자동 배정됨 — 일반 배정과 같은 알림
|
||||
_follow(st, task["id"], [newly_assigned])
|
||||
if newly_assigned: # 대상 섹션 기본 담당자가 자동 배정됨 — 일반 배정과 같은 알림(담당자는 협업자가 아님)
|
||||
_inbox(
|
||||
st, recipients=[newly_assigned], actor=user["email"], project_id=target, task_id=task["id"],
|
||||
ntype="assigned", title=f"업무 배정: {task['title']}",
|
||||
@@ -1829,6 +1828,8 @@ def api_add_follower(
|
||||
st = _db_or_503(request)
|
||||
task = _task_for_followers(request, st, user, task_id)
|
||||
email = store.norm_str(payload.get("email") or user["email"], lower=True)
|
||||
if email and email == store.norm_str(task.get("assignee_email") or "", lower=True):
|
||||
raise HTTPException(status_code=400, detail="담당자는 협업자로 지정할 수 없습니다(협업자는 담당자 외의 멤버).")
|
||||
if email != store.norm_str(user["email"], lower=True):
|
||||
if not access.can_assign(st, email, task["project_id"]):
|
||||
raise HTTPException(status_code=400, detail="이 프로젝트 멤버만 협업자로 추가할 수 있습니다.")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -298,5 +298,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261012a" defer></script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -207,5 +207,5 @@
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -102,5 +102,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -469,5 +469,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013c" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013d" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261013c" defer></script>
|
||||
<script src="/static/project.js?v=20261013d" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1594,6 +1594,25 @@ img.pj-person-ic { width: 22px; height: 22px; }
|
||||
.pj-assignee-btn.pj-subtask-add-fol .pj-person-ic svg,
|
||||
.pj-assignee-btn.pj-subtask-add-fol > svg { width: 18px; height: 18px; flex: 0 0 auto; }
|
||||
.pj-assignee-btn.pj-subtask-add-fol .pj-subtask-fol-n { margin-left: -2px; }
|
||||
/* 세부 업무 추가 칸(2026-10-13) — 담당자·협업자·마감일은 글자 없는 동그라미 아이콘 버튼, 남는 폭은 제목 칸이 다 쓴다.
|
||||
(말풍선 = 담당자 이름·협업자 목록·날짜, 날짜를 고르면 아이콘 + 날짜) */
|
||||
.pj-subtask-form { flex-wrap: nowrap; align-items: center; gap: 4px; }
|
||||
.pj-subtask-form input[type="text"] { flex: 1 1 auto; min-width: 0; }
|
||||
.pj-subtask-form .pj-assignee-btn[data-for="pj-subtask-add-assignee"],
|
||||
.pj-subtask-form .pj-assignee-btn.pj-subtask-add-fol {
|
||||
width: auto; min-width: 32px; height: 32px; padding: 0 3px; gap: 1px; justify-content: center;
|
||||
border: none; border-radius: 16px; background: transparent; color: #6d6e6f;
|
||||
}
|
||||
.pj-subtask-form .pj-assignee-btn[data-for="pj-subtask-add-assignee"]:hover,
|
||||
.pj-subtask-form .pj-assignee-btn.pj-subtask-add-fol:hover { background: #eceef0; color: #1e1f21; }
|
||||
.pj-subtask-form .pj-assignee-btn .pj-assignee-btn-name { display: none; }
|
||||
.pj-subtask-form .pj-assignee-btn img.pj-person-ic { width: 24px; height: 24px; border-radius: 50%; }
|
||||
.pj-subtask-form .pj-assignee-btn .pj-person-ic svg,
|
||||
.pj-subtask-form .pj-assignee-btn.pj-subtask-add-fol > svg { width: 24px; height: 24px; }
|
||||
.pj-subtask-form .pj-date-btn:not(.is-icon-only) { height: 32px; padding: 0 8px; border: none; border-radius: 16px; background: #f3f4f6; }
|
||||
.pj-subtask-form .pj-date-btn:not(.is-icon-only) .material-symbols-outlined { font-size: 17px; }
|
||||
.pj-subtask-form #pj-subtask-add { flex: 0 0 auto; }
|
||||
.pj-subtask-form .pj-date-btn.is-icon-only { flex: 0 0 auto; width: 32px; padding: 0; }
|
||||
.pj-assignee-btn.pj-subtask-assignee img.pj-person-ic,
|
||||
.pj-assignee-btn[data-for="pj-subtask-add-assignee"] img.pj-person-ic { width: 18px; height: 18px; }
|
||||
.pj-assignee-btn.pj-subtask-assignee .pj-person-ic svg,
|
||||
@@ -1996,6 +2015,8 @@ html.pj-embed .pj-btn-goto-project { display: inline-flex; align-items: center;
|
||||
transform: translateX(100%); transition: transform .22s ease;
|
||||
}
|
||||
.pj-inbox-panel.is-open { transform: translateX(0); }
|
||||
/* 내 업무 — 오른쪽 업무 창에 연 줄 */
|
||||
.pj-mtk-row.is-panel-selected > td { background: var(--pj-accent-tint); }
|
||||
.pj-inbox-panel iframe { display: block; width: 100%; height: 100%; border: 0; }
|
||||
.pj-inbox-item.is-selected { border-color: var(--pj-accent, #4573d2); box-shadow: 0 0 0 1px var(--pj-accent, #4573d2) inset; }
|
||||
|
||||
|
||||
+156
-48
@@ -973,11 +973,13 @@
|
||||
}
|
||||
// 협업자 고르기 메뉴 — 후보 멤버(지금 협업자는 ✓). 고르면 onToggle(email, 켜기?) 를 기다린 뒤 같은 자리에 메뉴를
|
||||
// 다시 열어 여러 명을 이어서 고른다(Esc·바깥 클릭으로 닫힘). current() = 지금 협업자 목록.
|
||||
function openFollowerMenu(anchor, emails, current, onToggle) {
|
||||
// assignee = 그 업무 담당자(함수 가능) — 담당자는 협업자가 아니라 후보에서 뺀다(2026-10-13).
|
||||
function openFollowerMenu(anchor, emails, current, onToggle, assignee) {
|
||||
const lower = function (x) { return String(x || "").toLowerCase(); };
|
||||
const who = lower(typeof assignee === "function" ? assignee() : assignee);
|
||||
const cur = (current() || []).map(lower);
|
||||
const cands = [];
|
||||
(emails || []).concat(cur).forEach(function (e) { e = lower(e); if (e && cands.indexOf(e) < 0) cands.push(e); });
|
||||
(emails || []).concat(cur).forEach(function (e) { e = lower(e); if (e && e !== who && cands.indexOf(e) < 0) cands.push(e); });
|
||||
if (!cands.length) { showToast("지정할 수 있는 멤버가 없습니다."); return; }
|
||||
const r = anchor.getBoundingClientRect();
|
||||
showContextMenu(r.left, r.bottom + 4, cands.map(function (em) {
|
||||
@@ -986,7 +988,7 @@
|
||||
label: idOf(em), icon: personIconHtml(em), checked: on,
|
||||
onClick: async function () {
|
||||
const ok = await onToggle(em, !on);
|
||||
if (ok !== false && anchor.isConnected) openFollowerMenu(anchor, emails, current, onToggle);
|
||||
if (ok !== false && anchor.isConnected) openFollowerMenu(anchor, emails, current, onToggle, assignee);
|
||||
},
|
||||
};
|
||||
}), { label: "협업자 지정" });
|
||||
@@ -1005,6 +1007,15 @@
|
||||
: await api("DELETE", "/project/api/tasks/" + taskId + "/followers/" + encodeURIComponent(email));
|
||||
return res.followers || [];
|
||||
}
|
||||
// 새로 만든 업무의 협업자 = 만든 사람 + 고른 사람(담당자는 빼고) — 서버 _follow·db.add_followers 와 같은 규칙.
|
||||
function newTaskFollowers(chosen, assignee) {
|
||||
const who = String(assignee || "").toLowerCase();
|
||||
const out = [];
|
||||
[pageMeEmail()].concat(chosen || []).forEach(function (x) {
|
||||
x = String(x || "").toLowerCase(); if (x && x !== who && out.indexOf(x) < 0) out.push(x);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function pageMeEmail() {
|
||||
const w = document.querySelector(".pj-wrap");
|
||||
return ((w && w.dataset.me) || "").toLowerCase();
|
||||
@@ -1033,7 +1044,7 @@
|
||||
btn.querySelector(".pj-assignee-btn-name").textContent = v ? (opt ? opt.textContent : idOf(v)) : "담당자 없음";
|
||||
btn.classList.toggle("is-empty", !v);
|
||||
btn.disabled = sel.disabled;
|
||||
btn.dataset.tip = v ? "담당자 변경" : "이 업무 배정";
|
||||
btn.dataset.tip = v ? "담당자: " + (opt ? opt.textContent : idOf(v)) : "담당자 지정";
|
||||
}
|
||||
const desc = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value");
|
||||
Object.defineProperty(sel, "value", {
|
||||
@@ -2935,6 +2946,74 @@
|
||||
// 모아 보여주고, 완료 체크·정렬·필터를 그 자리에서 처리한다. 업무를
|
||||
// 누르면 그 프로젝트 화면이 열리면서 편집 팝업이 뜬다(?task=).
|
||||
// ════════════════════════════════════════════════════════════
|
||||
// 오른쪽 업무 창 — /project/t/{id}?embed=1 을 iframe 패널(.pj-inbox-panel, body 에)로. 수신함·회의록과 같은 방식:
|
||||
// 다른 업무로 바꾸거나 닫기 전에 창 안 저장을 기다린다(__pjEmbedSettle — 실패면 "버리고 넘어가기 / 계속 편집").
|
||||
// opts.onOpen(id)·opts.onClose() — 목록 줄 표시·목록 다시 받기.
|
||||
function createEmbedTaskPanel(opts) {
|
||||
opts = opts || {};
|
||||
let panel = null, shown = null, switching = null, wanted;
|
||||
function isOpen() { return !!panel && panel.classList.contains("is-open"); }
|
||||
async function settleFrame() {
|
||||
if (!isOpen()) return true;
|
||||
let fn = null;
|
||||
try { fn = panel.querySelector("iframe").contentWindow.__pjEmbedSettle; } catch (_) { fn = null; }
|
||||
if (typeof fn !== "function") return true;
|
||||
try { return !!(await fn()); } catch (_) { return false; }
|
||||
}
|
||||
function apply(id) {
|
||||
if (id == null) {
|
||||
if (!isOpen()) return;
|
||||
panel.classList.remove("is-open");
|
||||
shown = null;
|
||||
const p = panel;
|
||||
setTimeout(function () { if (!p.classList.contains("is-open")) p.querySelector("iframe").src = "about:blank"; }, 250);
|
||||
if (opts.onClose) opts.onClose();
|
||||
return;
|
||||
}
|
||||
if (!panel) {
|
||||
panel = document.createElement("div");
|
||||
panel.className = "pj-inbox-panel";
|
||||
panel.innerHTML = '<iframe title="업무"></iframe>';
|
||||
document.body.appendChild(panel); // 화면 배율(.pj-ui-scale) 밖 — body 에
|
||||
try {
|
||||
const w = parseInt(localStorage.getItem("pj_task_panel_w") || "", 10);
|
||||
if (w) panel.style.width = "min(" + Math.round(w * uiZoom()) + "px, 92vw)";
|
||||
} catch (_) {}
|
||||
}
|
||||
shown = id;
|
||||
panel.querySelector("iframe").src = "/project/t/" + encodeURIComponent(id) + "?embed=1";
|
||||
void panel.offsetWidth;
|
||||
panel.classList.add("is-open");
|
||||
if (opts.onOpen) opts.onOpen(id);
|
||||
}
|
||||
function request(id) {
|
||||
wanted = id;
|
||||
if (switching) return switching;
|
||||
switching = (async function () {
|
||||
while (wanted !== undefined) {
|
||||
const t = wanted;
|
||||
if ((t == null && !isOpen()) || (t != null && isOpen() && shown === t)) { wanted = undefined; break; }
|
||||
const ok = await settleFrame();
|
||||
if (!ok) { wanted = undefined; break; } // 계속 편집 — 창·입력 그대로
|
||||
if (wanted !== t) continue;
|
||||
wanted = undefined;
|
||||
apply(t);
|
||||
}
|
||||
})().finally(function () { switching = null; });
|
||||
return switching;
|
||||
}
|
||||
window.addEventListener("message", function (e) {
|
||||
if (e.origin === location.origin && e.data && e.data.type === "pj-embed-close" && isOpen()) request(null);
|
||||
});
|
||||
return {
|
||||
open: function (id) { return request(id); },
|
||||
close: function () { return request(null); },
|
||||
isOpen: isOpen,
|
||||
shownId: function () { return isOpen() ? shown : null; },
|
||||
contains: function (n) { return !!panel && panel.contains(n); },
|
||||
};
|
||||
}
|
||||
|
||||
function initMyTasks() {
|
||||
const root = document.querySelector(".pj-mytasks-view");
|
||||
if (!root) return;
|
||||
@@ -2945,6 +3024,32 @@
|
||||
// 오늘 = 한국시간 날짜를 그때그때(화면을 밤새 열어 두어도 자정이 지나면 바뀐다).
|
||||
const todayNow = kstTodayIso;
|
||||
const me = (root.dataset.me || "").toLowerCase();
|
||||
// 줄을 누르면 화면은 그대로, 오른쪽에 업무 창(2026-10-13). 닫으면 목록을 다시 받는다(창에서 고친 내용 반영).
|
||||
// Ctrl·가운데 클릭은 예전처럼 새 탭에서 그 프로젝트 화면.
|
||||
function markPanelRow(id) {
|
||||
root.querySelectorAll("tr.is-panel-selected").forEach(function (r) { r.classList.remove("is-panel-selected"); });
|
||||
if (id != null) {
|
||||
const tr = root.querySelector('tr.pj-mtk-row[data-task-id="' + id + '"]');
|
||||
if (tr) tr.classList.add("is-panel-selected");
|
||||
}
|
||||
}
|
||||
const taskPanel = createEmbedTaskPanel({
|
||||
onOpen: markPanelRow,
|
||||
onClose: function () { markPanelRow(null); if (softSyncProjectRef) softSyncProjectRef(); },
|
||||
});
|
||||
function openTaskHere(id, projectId, e) {
|
||||
if (e && (e.ctrlKey || e.metaKey || e.button === 1)) {
|
||||
window.open("/project/p/" + projectId + "?task=" + id, "_blank");
|
||||
return;
|
||||
}
|
||||
taskPanel.open(id);
|
||||
}
|
||||
document.addEventListener("keydown", function (e) { if (e.key === "Escape" && taskPanel.isOpen()) taskPanel.close(); });
|
||||
document.addEventListener("mousedown", function (e) {
|
||||
if (!taskPanel.isOpen() || taskPanel.contains(e.target)) return;
|
||||
if (e.target.closest && e.target.closest("tr.pj-mtk-row, .pj-ctxmenu, .pj-modal, .erp-dialog, .pj-alert-pop, .erp-overdue")) return;
|
||||
taskPanel.close();
|
||||
});
|
||||
|
||||
const table = el("pj-mytasks-table");
|
||||
const emptyEl = el("pj-mytasks-empty");
|
||||
@@ -3079,7 +3184,8 @@
|
||||
|
||||
function rowContextItems(t) {
|
||||
return [
|
||||
{ label: "열기", onClick: function () { location.href = "/project/p/" + t.project_id + "?task=" + t.id; } },
|
||||
{ label: "열기", onClick: function () { openTaskHere(t.id, t.project_id); } },
|
||||
{ label: "프로젝트 화면에서 열기", onClick: function () { location.href = "/project/p/" + t.project_id + "?task=" + t.id; } },
|
||||
{ label: "업무 링크 복사", onClick: function () { shareTaskLink(t.id); } },
|
||||
{
|
||||
label: t.completed_at ? "완료 취소" : "완료로 표시",
|
||||
@@ -3120,10 +3226,12 @@
|
||||
const chk = tr.querySelector('input[type="checkbox"]');
|
||||
chk.addEventListener("click", function (e) { e.stopPropagation(); });
|
||||
chk.addEventListener("change", function () { toggleDone(t, chk.checked); });
|
||||
if (taskPanel.shownId() === t.id) tr.classList.add("is-panel-selected");
|
||||
tr.addEventListener("click", function (e) {
|
||||
if (e.target.closest(".pj-cmt-badge")) return; // 말풍선은 댓글 팝업 담당
|
||||
location.href = "/project/p/" + t.project_id + "?task=" + t.id;
|
||||
openTaskHere(t.id, t.project_id, e);
|
||||
});
|
||||
tr.addEventListener("auxclick", function (e) { if (e.button === 1) openTaskHere(t.id, t.project_id, e); });
|
||||
tr.addEventListener("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
showContextMenu(e.clientX, e.clientY, rowContextItems(t));
|
||||
@@ -3147,9 +3255,8 @@
|
||||
'<span class="pj-mtk-parent-name">' + escapeHtml(subtask.parent_title || "(상위 업무)") + "</span>" +
|
||||
'<span class="pj-mtk-parent-hint">' + (parentIsMine ? "상위 업무" : "다른 담당자의 상위 업무") + "</span>" +
|
||||
"</td>";
|
||||
tr.addEventListener("click", function () {
|
||||
location.href = "/project/p/" + subtask.project_id + "?task=" + subtask.parent_task_id;
|
||||
});
|
||||
tr.dataset.taskId = subtask.parent_task_id;
|
||||
tr.addEventListener("click", function (e) { openTaskHere(subtask.parent_task_id, subtask.project_id, e); });
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
@@ -5237,6 +5344,9 @@
|
||||
await api("PUT", "/project/api/tasks/" + sub.id,
|
||||
{ assignee_email: email, assignee_name: email ? idOf(email) : "" });
|
||||
sub.assignee_email = email;
|
||||
if (email && Array.isArray(sub.followers)) { // 담당자는 협업자가 아니다
|
||||
sub.followers = sub.followers.filter(function (x) { return String(x).toLowerCase() !== String(email).toLowerCase(); });
|
||||
}
|
||||
if (box.isConnected) fillCardSubs(box, t);
|
||||
} catch (e) { showToast("담당자 변경 실패: " + e.message, "error"); }
|
||||
}
|
||||
@@ -5407,7 +5517,7 @@
|
||||
fol.dataset.tip = followerTip(sub.followers);
|
||||
return true;
|
||||
} catch (err) { showToast("협업자 변경 실패: " + err.message, "error"); return false; }
|
||||
});
|
||||
}, function () { return sub.assignee_email; });
|
||||
});
|
||||
const check = row.querySelector(".pj-card-sub-check");
|
||||
check.addEventListener("click", async function (e) {
|
||||
@@ -5541,7 +5651,11 @@
|
||||
const r = avEl.getBoundingClientRect();
|
||||
showContextMenu(r.left, r.bottom + 4, assigneeMenuItems(
|
||||
list.map(function (m) { return m.user_email; }), draft.assignee,
|
||||
function (email) { draft.assignee = email || ""; paintAv(); refocus(); }
|
||||
function (email) {
|
||||
draft.assignee = email || "";
|
||||
if (draft.assignee) draft.followers = draft.followers.filter(function (x) { return x !== draft.assignee.toLowerCase(); });
|
||||
paintAv(); paintFol(); refocus();
|
||||
}
|
||||
));
|
||||
});
|
||||
// 협업자 — 고른 사람은 만들 때 followers 로 같이 보낸다(메뉴는 고를 때마다 다시 열려 여러 명).
|
||||
@@ -5554,7 +5668,7 @@
|
||||
draft.followers = on ? draft.followers.concat([em]) : draft.followers.filter(function (x) { return x !== em; });
|
||||
paintFol();
|
||||
return true;
|
||||
});
|
||||
}, function () { return draft.assignee; });
|
||||
});
|
||||
function closeDraft() {
|
||||
delete subDrafts[t.id];
|
||||
@@ -5576,13 +5690,7 @@
|
||||
});
|
||||
const subs = subsCache[t.id] || (subsCache[t.id] = []);
|
||||
// 새 줄 협업자 아이콘 — 서버 자동 협업자와 같은 규칙(만든 사람·담당자·고른 협업자)
|
||||
if (res.task && !Array.isArray(res.task.followers)) {
|
||||
const fl = [];
|
||||
[me, res.task.assignee_email].concat(draft.followers).forEach(function (x) {
|
||||
x = String(x || "").toLowerCase(); if (x && fl.indexOf(x) < 0) fl.push(x);
|
||||
});
|
||||
res.task.followers = fl;
|
||||
}
|
||||
if (res.task && !Array.isArray(res.task.followers)) res.task.followers = newTaskFollowers(draft.followers, res.task.assignee_email);
|
||||
subs.push(res.task);
|
||||
adjustSubCounts(t.id, 1, 0);
|
||||
// Enter — 다음 세부 작업을 이어서 입력(아사나): 이름만 비우고 줄은 열어 둔다.
|
||||
@@ -6200,21 +6308,7 @@
|
||||
const charts = document.createElement("div");
|
||||
charts.className = "pj-dash-charts";
|
||||
|
||||
// 섹션별 미완료 — "이 프로젝트" 스코프면 보드 컬럼과 같은 순서로.
|
||||
const sectionOrder = viewScope === "project"
|
||||
? (stagesByProject[projectId] || []).slice().sort(function (a, b) { return a.sort_order - b.sort_order; }).map(function (s) { return s.name; })
|
||||
: boardStages.slice();
|
||||
const bySection = {};
|
||||
incomplete.forEach(function (t) { const k = t.stage_name || "미지정"; bySection[k] = (bySection[k] || 0) + 1; });
|
||||
const sectionNames = sectionOrder.filter(function (n) { return bySection[n]; });
|
||||
Object.keys(bySection).forEach(function (n) { if (sectionNames.indexOf(n) < 0) sectionNames.push(n); });
|
||||
const sectionData = sectionNames.map(function (n) { return { label: n, value: bySection[n] }; });
|
||||
const sectionCard = document.createElement("div");
|
||||
sectionCard.className = "pj-dash-card";
|
||||
sectionCard.innerHTML = '<div class="pj-dash-card-title">미완료 업무 합계(섹션별)</div>';
|
||||
sectionCard.appendChild(dashBarChart(sectionData));
|
||||
charts.appendChild(sectionCard);
|
||||
|
||||
// "미완료 업무 합계(섹션별)" 카드는 2026-10-13 요청으로 없앴다(dashBarChart 는 남겨 둔다).
|
||||
// 프로젝트별(2026-10-13) — 업무가 속한 프로젝트마다 완료/전체·완료율 막대. 완료 상태별 카드 바로 왼쪽.
|
||||
const projectCard = document.createElement("div");
|
||||
projectCard.className = "pj-dash-card";
|
||||
@@ -6744,7 +6838,12 @@
|
||||
}
|
||||
// 완료 섹션으로 옮기거나 빼면 완료 이력 줄이 생기거나 사라진다.
|
||||
if (wasDone !== !!res.task.completed_at) loadComments(id);
|
||||
if (res.task._newly_assigned) loadTaskExtras(res.task); // 새 담당자가 협업자로 들어온다
|
||||
if (key === "assignee" && followersTask && followersTask.id === id) {
|
||||
// 담당자는 협업자가 아니다 — 서버가 뺀 것과 맞추고, 참여 버튼도 다시
|
||||
const a = String(res.task.assignee_email || "").toLowerCase();
|
||||
followers = followers.filter(function (x) { return x !== a; });
|
||||
renderFollowers();
|
||||
}
|
||||
if (res.mention_skipped && res.mention_skipped.length) warnMentionSkipped(res.mention_skipped);
|
||||
setAutoState(failedFields.size ? "error" : "saved");
|
||||
}
|
||||
@@ -6918,6 +7017,8 @@
|
||||
const tog = el("pj-follow-toggle");
|
||||
tog.textContent = followingMe ? "협업자에서 나가기" : "협업자로 참여";
|
||||
tog.classList.toggle("is-on", followingMe);
|
||||
// 내가 담당자면 협업자로 참여할 수 없다(담당자는 협업자가 아니다)
|
||||
tog.hidden = !followingMe && String((el("pj-t-assignee") && el("pj-t-assignee").value) || "").toLowerCase() === me;
|
||||
}
|
||||
async function setFollower(email, on) {
|
||||
if (!followersTask) return;
|
||||
@@ -6951,8 +7052,9 @@
|
||||
const r = e.currentTarget.getBoundingClientRect();
|
||||
let list = [];
|
||||
try { list = await membersOfProject(followersTask.project_id); } catch (_) {}
|
||||
const assignee = String((el("pj-t-assignee") && el("pj-t-assignee").value) || "").toLowerCase();
|
||||
const cands = list.map(function (m) { return (m.user_email || "").toLowerCase(); })
|
||||
.filter(function (em) { return em && followers.indexOf(em) < 0; });
|
||||
.filter(function (em) { return em && em !== assignee && followers.indexOf(em) < 0; }); // 담당자는 협업자가 아니다
|
||||
if (!cands.length) { showToast("추가할 수 있는 멤버가 없습니다."); return; }
|
||||
showContextMenu(r.left, r.bottom + 4, cands.map(function (em) {
|
||||
return { label: idOf(em), icon: personIconHtml(em), onClick: function () { setFollower(em, true); } };
|
||||
@@ -8393,8 +8495,14 @@
|
||||
'<span class="pj-assignee-btn-name"></span>';
|
||||
addFolBtn.querySelector(".pj-assignee-btn-name").textContent =
|
||||
addFollowers.length ? "협업자 " + addFollowers.length + "명" : "협업자 없음";
|
||||
addFolBtn.title = followerTip(addFollowers);
|
||||
addFolBtn.removeAttribute("title");
|
||||
addFolBtn.dataset.tip = followerTip(addFollowers);
|
||||
}
|
||||
// 추가 칸 담당자를 고르면 그 사람은 협업자에서 뺀다(담당자는 협업자가 아니다)
|
||||
if (addAssignee) addAssignee.addEventListener("change", function () {
|
||||
const a = String(addAssignee.value || "").toLowerCase();
|
||||
if (a && addFollowers.indexOf(a) >= 0) { addFollowers = addFollowers.filter(function (x) { return x !== a; }); paintAddFol(); }
|
||||
});
|
||||
paintAddFol();
|
||||
if (addFolBtn) addFolBtn.addEventListener("click", async function () {
|
||||
if (!projectId || readOnly) return;
|
||||
@@ -8405,10 +8513,11 @@
|
||||
addFollowers = on ? addFollowers.concat([em]) : addFollowers.filter(function (x) { return x !== em; });
|
||||
paintAddFol();
|
||||
return true;
|
||||
});
|
||||
}, function () { return addAssignee ? addAssignee.value : ""; });
|
||||
});
|
||||
const addDue = el("pj-subtask-add-due");
|
||||
enhanceDateInput(addDue, { placeholder: "마감일" }); // 아사나식 날짜 팝업
|
||||
// 아사나식 날짜 팝업 — 추가 칸은 동그라미 아이콘 버튼(날짜가 있으면 아이콘 + 날짜, 2026-10-13)
|
||||
enhanceDateInput(addDue, { placeholder: "마감일", iconOnly: true });
|
||||
const addBtn = el("pj-subtask-add");
|
||||
const formEl = listEl.parentNode ? listEl.parentNode.querySelector(".pj-subtask-form") : null;
|
||||
let taskId = null, projectId = null, canDeleteFn = function () { return false; }, onChange = null, onOpen = null;
|
||||
@@ -8550,7 +8659,12 @@
|
||||
const prev = sub.assignee_email;
|
||||
sub.assignee_email = v;
|
||||
renderAv();
|
||||
if (!(await patch({ assignee_email: v, assignee_name: v ? idOf(v) : "" }))) { sub.assignee_email = prev; renderAv(); }
|
||||
if (!(await patch({ assignee_email: v, assignee_name: v ? idOf(v) : "" }))) { sub.assignee_email = prev; renderAv(); return; }
|
||||
// 담당자는 협업자가 아니다 — 서버가 뺀 것과 화면을 맞춘다
|
||||
if (v && Array.isArray(sub.followers)) {
|
||||
sub.followers = sub.followers.filter(function (x) { return String(x).toLowerCase() !== String(v).toLowerCase(); });
|
||||
renderFol();
|
||||
}
|
||||
}));
|
||||
});
|
||||
// 협업자 — 누르면 멤버 목록(협업자는 ✓). 고르면 넣고/빼고, 메뉴를 다시 열어 여러 명 지정.
|
||||
@@ -8562,7 +8676,7 @@
|
||||
renderFol();
|
||||
return true;
|
||||
} catch (err) { showToast("협업자 변경 실패: " + err.message, "error"); return false; }
|
||||
});
|
||||
}, function () { return sub.assignee_email; });
|
||||
});
|
||||
function open() { if (onOpen) onOpen(sub); }
|
||||
li.querySelector(".pj-subtask-open").addEventListener("click", function (e) { e.stopPropagation(); open(); });
|
||||
@@ -8688,13 +8802,7 @@
|
||||
if (addAssignee) addAssignee.value = "";
|
||||
if (addDue) addDue.value = "";
|
||||
// 새 줄의 협업자 아이콘 — 만든 사람·담당자·고른 협업자(서버 자동 협업자와 같은 규칙)
|
||||
if (res.task && !Array.isArray(res.task.followers)) {
|
||||
const fl = [];
|
||||
[pageMeEmail(), res.task.assignee_email].concat(addFollowers).forEach(function (x) {
|
||||
x = String(x || "").toLowerCase(); if (x && fl.indexOf(x) < 0) fl.push(x);
|
||||
});
|
||||
res.task.followers = fl;
|
||||
}
|
||||
if (res.task && !Array.isArray(res.task.followers)) res.task.followers = newTaskFollowers(addFollowers, res.task.assignee_email);
|
||||
addFollowers = []; paintAddFol();
|
||||
const emails = await memberEmails(pid);
|
||||
if (seq !== ctxSeq) return;
|
||||
|
||||
@@ -137,6 +137,19 @@ docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db < s
|
||||
docker exec postgres-db psql -U postgres -d project_db -c "SELECT column_name FROM information_schema.columns WHERE table_name='goal_meeting_items' AND column_name='label_cont';"
|
||||
```
|
||||
|
||||
## 담당자·협업자 겹침 정리 마이그레이션 (028)
|
||||
|
||||
028은 스키마를 바꾸지 않고, 담당자와 같은 사람인 협업자 행(`task_followers`)만 지운다(담당자는 협업자가 아니다 — 2026-10-13).
|
||||
다시 실행해도 같고, 지운 행 수를 NOTICE 로 보여 준다. 앱은 새 코드부터 담당자를 협업자로 넣지 않으므로, 028 을 늦게 적용해도
|
||||
새로 겹치는 행은 생기지 않는다(예전 겹친 행만 남음). 되돌리기 = 아래 백업에서 task_followers 만 복원.
|
||||
|
||||
```bash
|
||||
cd /opt/www/main
|
||||
docker exec postgres-db pg_dump -U postgres project_db > ~/project_db_before_028_$(date +%Y%m%d%H%M).sql
|
||||
docker exec postgres-db psql -U postgres -d project_db -c "SELECT COUNT(*) FROM task_followers f JOIN tasks t ON t.id = f.task_id WHERE COALESCE(t.assignee_email,'') <> '' AND lower(f.user_email) = lower(t.assignee_email);"
|
||||
docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db < scripts/sql/project_db_028_followers_exclude_assignee.sql
|
||||
```
|
||||
|
||||
## 실적 수동 입력·열 순서 마이그레이션 (performance_db 002)
|
||||
|
||||
002는 `perf_marketplaces.manual_input` 열(기본 꺼짐) + `perf_manual_sales` 표를 추가하고, 쇼핑몰 순서(`sort_order`)를
|
||||
|
||||
@@ -1299,6 +1299,26 @@ Windows 트레이 프로그램 **DBX 알림**(`desktop/notifier/`, C# .NET Frame
|
||||
- 아직 안 되는 것: 목록·캘린더·타임라인 보기에서 끌기(보드 카드만), 이동 되돌리기(다시 끌어 옮기면 됨).
|
||||
- 검증: `tests/test_project_module.py::test_move_task_to_other_project`(실제 PG), `tests/js/project_ui.test.js` [프로젝트 이동].
|
||||
|
||||
## 6-19. 담당자는 협업자가 아니다 · 세부 업무 추가 칸 아이콘 · 내 업무 오른쪽 업무 창 · 섹션별 카드 삭제 (2026-10-13, 마이그레이션 028)
|
||||
|
||||
- **규칙 — 협업자는 담당자 외의 멤버**(업무·세부 업무 모두). 예전엔 담당자를 자동 협업자로 넣었다.
|
||||
· `db.add_followers` 가 그 업무의 담당자를 SQL 에서 거른다 — 자동 협업자(만든 사람·댓글 쓴 사람·@태그)·만들 때 고른 협업자 모두.
|
||||
· 담당자를 정하면(`db.update_task` — 직접 지정·섹션 기본 담당자, `move_task_to_project` 의 기본 담당자) 같은 트랜잭션에서 그 사람을
|
||||
협업자에서 뺀다(`_drop_assignee_follower`). 예전 담당자를 협업자로 자동으로 넣지는 않는다.
|
||||
· `POST /api/tasks/{id}/followers` 에 담당자(빈 email = 나 자신이 담당자인 경우 포함)는 400.
|
||||
· 화면: 협업자 고르기 메뉴(`openFollowerMenu` 의 assignee 인자)·업무 창 협업자 추가 메뉴에서 담당자를 뺀다, 내가 담당자면 [협업자로 참여] 숨김,
|
||||
담당자를 바꾸면 화면의 협업자 목록에서도 바로 뺀다. 알림은 그대로 — 수신자 = 담당자 + 협업자(`_task_recipients`).
|
||||
· **마이그레이션 028**(`project_db_028_followers_exclude_assignee.sql`) — 이미 겹친 `task_followers` 행(담당자와 같은 사람)을 지운다.
|
||||
스키마 변경 없음, 멱등(008 미적용이면 건너뜀), 지운 행 수를 NOTICE 로. 되돌리기 = 적용 전 백업에서 task_followers 복원.
|
||||
- **세부 업무 추가 칸**(업무 창) — 담당자·협업자·마감일은 글자 없는 동그라미 아이콘 버튼(담당자 = 아바타/점선 원, 협업자 = 첫 사람 + "+N"/점선 원
|
||||
두 사람, 마감일 = 점선 원 달력 → 고르면 아이콘 + 날짜), 말풍선에 담당자 이름·협업자 목록. 남는 폭은 제목 칸이 다 쓴다(`.pj-subtask-form` nowrap).
|
||||
- **내 업무 화면** — 줄(남의 상위 업무 안내 줄 포함)을 누르면 화면 이동 없이 오른쪽 업무 창(`createEmbedTaskPanel` — `/project/t/{id}?embed=1`
|
||||
iframe, 수신함·회의록과 같은 저장 대기). 다른 줄 = 같은 창에서 바꿈, Esc·목록 밖 클릭 = 닫기 → 목록 다시 받기. 연 줄은 `.is-panel-selected`.
|
||||
Ctrl·가운데 클릭 = 새 탭 프로젝트 화면, 우클릭 "프로젝트 화면에서 열기".
|
||||
- **대시보드** — "미완료 업무 합계(섹션별)" 카드 삭제(요청). 남은 카드: 업무 합계(프로젝트별)·업무 합계(완료 상태별)·담당자별(Pro user 이상).
|
||||
- 검증: `tests/test_project_module.py::test_assignee_is_never_follower`(실제 PG, 028 두 번 실행 포함),
|
||||
`tests/test_project_review_fixes.py`(같은 트랜잭션에서 협업자 정리), `tests/js/project_ui.test.js` [내 업무 창](`render_project.py` 가 `mytasks_render.html` 도 만든다).
|
||||
|
||||
## 7. 추후 단계
|
||||
|
||||
작업 라벨(태그 분류) · 반복 작업 · 템플릿 · 작업 의존성.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
-- =====================================================================
|
||||
-- project_db 마이그레이션 028 — 담당자는 협업자에서 제외(데이터 정리)
|
||||
-- =====================================================================
|
||||
-- 멱등(idempotent). 스키마 변경 없음 — 업무(세부 업무 포함)의 담당자와 같은 사람인 협업자 행만 지운다.
|
||||
-- 운영: /opt/www/main 에서 기존 project_db 에 적용(적용 전 pg_dump 백업).
|
||||
--
|
||||
-- 왜(2026-10-13 사용자 요청): "모든 업무·세부 업무에서 담당자는 협업자에서 제외 — 협업자는 담당자 외의 멤버".
|
||||
-- 예전엔 담당자를 자동으로 협업자에 넣었다. 앱은 이제 담당자를 협업자로 넣지 않고(db.add_followers),
|
||||
-- 담당자가 바뀌면 그 사람을 협업자에서 뺀다(db.update_task). 이미 겹쳐 있는 행은 여기서 한 번 정리한다.
|
||||
-- 알림은 그대로 간다 — 업무 알림 수신자 = 담당자 + 협업자(라우터 _task_recipients).
|
||||
-- 되돌리기: 이 파일 적용 직전 백업에서 task_followers 만 복원(다른 표는 건드리지 않는다).
|
||||
-- =====================================================================
|
||||
BEGIN;
|
||||
|
||||
DO $$
|
||||
DECLARE n integer;
|
||||
BEGIN
|
||||
IF to_regclass('public.task_followers') IS NULL THEN
|
||||
RAISE NOTICE '028: task_followers 없음(008 미적용) — 건너뜀';
|
||||
RETURN;
|
||||
END IF;
|
||||
DELETE FROM task_followers f
|
||||
USING tasks t
|
||||
WHERE f.task_id = t.id
|
||||
AND COALESCE(t.assignee_email, '') <> ''
|
||||
AND lower(f.user_email) = lower(t.assignee_email);
|
||||
GET DIAGNOSTICS n = ROW_COUNT;
|
||||
RAISE NOTICE '028: 담당자와 겹친 협업자 % 행 삭제', n;
|
||||
END $$;
|
||||
|
||||
COMMIT;
|
||||
@@ -17,6 +17,7 @@ const ROOT = path.join(__dirname, "..", "..");
|
||||
const html = fs.readFileSync(path.join(__dirname, ".out", "project_render.html"), "utf8");
|
||||
const adminHtml = fs.readFileSync(path.join(__dirname, ".out", "project_admin_render.html"), "utf8");
|
||||
const inboxHtml = fs.readFileSync(path.join(__dirname, ".out", "inbox_render.html"), "utf8");
|
||||
const mytasksHtml = fs.readFileSync(path.join(__dirname, ".out", "mytasks_render.html"), "utf8");
|
||||
const JS = fs.readFileSync(path.join(ROOT, "app", "static", "project.js"), "utf8");
|
||||
|
||||
const fails = [];
|
||||
@@ -773,6 +774,29 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
|
||||
check("[세부 업무 협업자] 고른 뒤 메뉴가 다시 열려 이어서 고름", !!d.querySelector(".pj-ctxmenu"));
|
||||
d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true })); await settle();
|
||||
}
|
||||
// ── 내 업무 — 줄을 누르면 화면 이동 없이 오른쪽 업무 창(iframe), 닫으면 목록 다시 받기(2026-10-13) ──
|
||||
{
|
||||
const env = makeEnv(mytasksHtml); baseRoutes(env);
|
||||
let reloads = 0;
|
||||
env.route("GET", /\/project\/api\/my-tasks$/, function () { reloads++; return { body: { tasks: [] } }; });
|
||||
await boot(env); const d = env.d, w = env.w;
|
||||
const before = w.location.href;
|
||||
const row = d.querySelector('tr.pj-mtk-row[data-task-id="101"]');
|
||||
check("[내 업무 창] 목록 줄", !!row);
|
||||
row.querySelector(".pj-mtk-title").click(); await settle();
|
||||
const panel = d.body.querySelector(".pj-inbox-panel");
|
||||
check("[내 업무 창] 줄 클릭 → 오른쪽 업무 창(/project/t/101?embed=1), 화면 그대로·줄 표시",
|
||||
!!panel && panel.classList.contains("is-open") && /\/project\/t\/101\?embed=1$/.test(panel.querySelector("iframe").getAttribute("src")) &&
|
||||
w.location.href === before && row.classList.contains("is-panel-selected"), panel && panel.querySelector("iframe").getAttribute("src"));
|
||||
d.querySelector('tr.pj-mtk-row[data-task-id="102"]').click(); await settle();
|
||||
check("[내 업무 창] 다른 줄 → 같은 창에서 바꿈", /\/project\/t\/102\?embed=1$/.test(panel.querySelector("iframe").getAttribute("src")) &&
|
||||
!row.classList.contains("is-panel-selected"));
|
||||
const grp = d.querySelector("tr.pj-mtk-parent-group");
|
||||
if (grp) { grp.click(); await settle(); }
|
||||
check("[내 업무 창] 남의 상위 업무 줄 → 그 상위 업무를 창에", !grp || /\/project\/t\/300\?embed=1$/.test(panel.querySelector("iframe").getAttribute("src")));
|
||||
d.dispatchEvent(new w.KeyboardEvent("keydown", { key: "Escape", bubbles: true })); await settle();
|
||||
check("[내 업무 창] Esc → 닫고 목록 다시 받기", !panel.classList.contains("is-open") && reloads === 1, reloads);
|
||||
}
|
||||
// ── 업무 카드를 왼쪽 프로젝트로 끌어 다른 프로젝트로 이동(2026-10-13) — 섹션 선택 창 → move-project ──
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
|
||||
@@ -53,6 +53,29 @@ def main() -> None:
|
||||
for name, admin in (("project_render.html", False), ("project_admin_render.html", True)):
|
||||
render_one(env, name, admin)
|
||||
render_inbox(env)
|
||||
render_mytasks(env)
|
||||
|
||||
|
||||
def render_mytasks(env) -> None:
|
||||
"""내 업무(project/mytasks.html) — 내 업무 101·102, 남의 상위 업무 아래 내 세부 업무 501."""
|
||||
def t(tid: int, title: str, **kw) -> dict:
|
||||
base = {"id": tid, "title": title, "project_id": 1, "project_name": "P1", "project_color": "#4573d2",
|
||||
"stage_name": "할 일", "assignee_email": ME, "priority": "normal", "due_date": None, "start_date": None,
|
||||
"completed_at": None, "comment_count": 0, "subtask_total": 0, "subtask_done": 0, "parent_task_id": None}
|
||||
base.update(kw)
|
||||
return base
|
||||
|
||||
html = env.get_template("project/mytasks.html").render(
|
||||
user={"email": ME, "is_super_admin": False}, is_admin=False, pj_pro=False, pj_admin=False,
|
||||
nav_projects=PROJECTS, goal_years=[2026], my_open_total=3, mention_unread=0,
|
||||
color_palette=["#4573d2"], project_icons=["folder"], project_asana_icons=[],
|
||||
my_tasks=[t(101, "작업 A"), t(102, "작업 B"),
|
||||
t(501, "내 세부", parent_task_id=300, parent_title="남의 상위", parent_assignee_email="bob@test.local")],
|
||||
avatars={}, priority_labels={"low": "낮음", "normal": "보통", "high": "높음"}, today="2026-10-13",
|
||||
)
|
||||
path = os.path.join(OUT_DIR, "mytasks_render.html")
|
||||
io.open(path, "w", encoding="utf-8", newline="\n").write(html)
|
||||
print("rendered:", path)
|
||||
|
||||
|
||||
def render_inbox(env) -> None:
|
||||
|
||||
@@ -1418,6 +1418,36 @@ def test_create_with_followers_and_my_overdue():
|
||||
assert not [x for x in req("GET", "/project/api/my-overdue", BOB).json()["tasks"] if x["project_id"] == p["id"]]
|
||||
|
||||
|
||||
def test_assignee_is_never_follower():
|
||||
"""담당자는 협업자가 아니다(2026-10-13) — 만들 때·배정할 때·협업자 추가 API·정리 SQL(028)."""
|
||||
import pathlib
|
||||
p = _project("P-asgfol", ADMIN, (ALICE, BOB, CAROL))
|
||||
s = _stage(p["id"], by=ADMIN)
|
||||
url = f"/project/api/projects/{p['id']}/tasks"
|
||||
# 만든 사람이 담당자 + 고른 협업자에 담당자가 섞여도 → 담당자는 빠진다
|
||||
t = req("POST", url, ALICE, json={"title": "규칙", "stage_id": s["id"], "assignee_email": ALICE,
|
||||
"followers": [ALICE, BOB]}).json()["task"]
|
||||
assert ST.list_followers(task_id=t["id"]) == [BOB]
|
||||
# 담당자를 협업자로 직접 넣으면 400
|
||||
assert req("POST", f"/project/api/tasks/{t['id']}/followers", ALICE, json={"email": ALICE}).status_code == 400
|
||||
assert req("POST", f"/project/api/tasks/{t['id']}/followers", ALICE, json={}).status_code == 400 # 나 = 담당자
|
||||
# 협업자(BOB)를 담당자로 바꾸면 협업자에서 빠진다 — 예전 담당자(ALICE)는 자동으로 들어가지 않는다
|
||||
assert req("PUT", f"/project/api/tasks/{t['id']}", ALICE, json={"assignee_email": BOB}).status_code == 200
|
||||
assert ST.list_followers(task_id=t["id"]) == []
|
||||
# 댓글 단 담당자도 협업자가 되지 않는다(댓글 쓴 사람 자동 협업자 규칙보다 우선)
|
||||
req("POST", f"/project/api/tasks/{t['id']}/comments", BOB, json={"body": "담당자 댓글"})
|
||||
req("POST", f"/project/api/tasks/{t['id']}/comments", CAROL, json={"body": "협업자 댓글"})
|
||||
assert ST.list_followers(task_id=t["id"]) == [CAROL]
|
||||
# 정리 SQL — 예전 데이터(담당자가 협업자에도 있음)를 지운다, 두 번 돌려도 같다
|
||||
with ST._pool.connection() as conn: # noqa: SLF001
|
||||
conn.execute("INSERT INTO task_followers (task_id, user_email) VALUES (%s, %s)", (t["id"], BOB))
|
||||
sql = (pathlib.Path(__file__).resolve().parent.parent / "scripts" / "sql" / "project_db_028_followers_exclude_assignee.sql").read_text(encoding="utf-8")
|
||||
for _ in range(2):
|
||||
with ST._pool.connection() as conn: # noqa: SLF001
|
||||
conn.execute(sql)
|
||||
assert ST.list_followers(task_id=t["id"]) == [CAROL]
|
||||
|
||||
|
||||
def test_move_task_to_other_project():
|
||||
"""업무를 다른 프로젝트로 옮기기(2026-10-13) — 세부 업무 함께, 대상 섹션·기본 담당자·완료 섹션, 연결 정리, 권한."""
|
||||
a = _project("P-mvA", ADMIN, (ALICE, BOB))
|
||||
|
||||
@@ -388,6 +388,7 @@ class TaskConn:
|
||||
def __init__(self, row):
|
||||
self.row = dict(row)
|
||||
self.depth, self.locked, self.updates, self.logs = 0, False, [], []
|
||||
self.unfollowed = [] # 담당자가 되면 협업자에서 뺀다(2026-10-13) — 같은 트랜잭션·잠근 행에서
|
||||
self.stages = {11: {"project_id": 1, "is_done_stage": False, "dae": "dae@test.local"},
|
||||
12: {"project_id": 1, "is_done_stage": True, "dae": ""}}
|
||||
|
||||
@@ -421,6 +422,12 @@ class TaskConn:
|
||||
if sql.startswith("INSERT INTO project_activity"):
|
||||
self.logs.append(params)
|
||||
return _Res([])
|
||||
if sql.startswith("SELECT to_regclass"):
|
||||
return _Res([{"r": params[0]}])
|
||||
if sql.startswith("DELETE FROM task_followers"):
|
||||
assert self.locked, "협업자 정리도 잠근 행의 트랜잭션에서"
|
||||
self.unfollowed.append(params[1])
|
||||
return _Res([])
|
||||
raise AssertionError(sql)
|
||||
|
||||
|
||||
@@ -465,6 +472,7 @@ class UpdateTaskConcurrencyTests(unittest.TestCase):
|
||||
out = st.update_task(task_id=7, fields={"stage_id": 11}, actor="a@test.local",
|
||||
assignee_allowed=lambda e: asked.append(e) or True)
|
||||
self.assertEqual((asked, out["_newly_assigned"], self.borrows), (["dae@test.local"], "dae@test.local", 1))
|
||||
self.assertEqual(self.conn.unfollowed, ["dae@test.local"]) # 새 담당자는 협업자에서 빠진다
|
||||
st = self.make({**self.BASE, "stage_id": 12})
|
||||
out = st.update_task(task_id=7, fields={"stage_id": 11}, assignee_allowed=lambda e: False)
|
||||
self.assertIsNone(out["_newly_assigned"]) # 권한을 잃은 기본 담당자는 자동 배정·배정 알림 없음
|
||||
|
||||
Reference in New Issue
Block a user