fix(project): review fixes — access leaks, open paths, save safety, concurrency
- Subproject tasks via parent /tasks are re-filtered by current access (FULL/READ kept)
- PUT /api/projects/order: every id must be manageable; bad/duplicate ids -> 400, all-or-nothing
- Inbox, web alert popup, PC notifier open tasks via /project/t/{id}; embed=1 survives redirect;
old /p/{home}?task= redirects READ users to the linked project
- Project page / snapshot / workload include the opened archived or sub project only
- Alerts: DB-side filters + oldest-first paging (no 50-row cut); badges counted without caps;
my tasks keep every open task (completed capped)
- Meeting results: next-week meeting open, or own meeting open when no next meeting;
header edits + result checks under row locks (FOR UPDATE / FOR SHARE)
- Inbox panel waits for the task window save (same retry/discard flow) before switching/closing;
read failures stay unread
- Attachment upload removes only its own file on DB failure
- New project modal: create once, retry only failed member assignments
- update_task / update_project: locked-row validation in one transaction; completion hints from real transition
- Creator added as explicit member when another owner is chosen
- _once lock lifetime managed by refcount (no leak on failure)
- Section default assignee must still be a registered project user; follower add uses can_assign
- Docs (PROJECT_MODULE 6-15, help), tests (DB-less, real PostgreSQL, jsdom, Chrome)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -60,3 +60,16 @@ python -m unittest discover -s tests -p test_project_meeting_cells.py
|
||||
`PROJECT_TEST_DB_URL`에 기존 로컬 테스트 DB를 지정해야 하며, 미설정 또는 로컬 주소가 아니면 건너뛴다.
|
||||
회의록 셀 테스트는 DB 연결을 대신하는 트랜잭션 모형으로 실제 저장소 메서드·API 권한/충돌·이동/병합 롤백·
|
||||
019 미적용·병합 행 작업 보호·서식 보존·안전한 템플릿 출력을 검증한다. 실제 PostgreSQL 잠금 동작 검증은 별도다.
|
||||
|
||||
# 프로젝트 화면·수신함 UI 테스트 (jsdom + 실제 Chrome)
|
||||
|
||||
`project.html`·`inbox.html` + `static/project.js` — 작업 창 저장/실패/동기화, 전체 보기의 연결된(읽기 전용) 작업,
|
||||
수신함 오른쪽 작업 창(저장 대기 뒤 바꾸기·계속 편집·A→B→A·저장 중 Esc·읽음 실패), 새 프로젝트 창(생성/멤버 배정 결과 분리·
|
||||
실패한 멤버만 다시 배정·연타)을 가짜 서버로 검증한다.
|
||||
|
||||
```powershell
|
||||
python tests/js/render_project.py # → tests/js/.out/project_*.html · inbox_render.html
|
||||
node tests/js/project_ui.test.js # jsdom
|
||||
$env:PJ_TEST_BROWSER = 'C:/Program Files/Google/Chrome/Application/chrome.exe'
|
||||
node tests/js/inbox_panel.browser.test.js # Playwright: iframe 리다이렉트 뒤 embed·저장 실패 확인창·A→B→A·iframe 안 Esc·읽음 실패
|
||||
```
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
// 실제 브라우저 — 수신함 오른쪽 작업 창(iframe)이 다른 줄로 바뀌거나 닫히기 전에 작업 창의 저장을 기다리는지,
|
||||
// 저장 실패면 작업 창과 같은 "버리고 넘어가기 / 계속 편집"을 묻는지, 공유 링크 리다이렉트 뒤에도 embed 인지,
|
||||
// iframe 안 Esc·빠른 A→B→A·읽음 실패를 확인한다. 서버는 가짜(이 파일의 http 서버), 화면은 실제 템플릿 렌더 결과.
|
||||
// python tests/js/render_project.py
|
||||
// NODE_PATH=<playwright 경로> PJ_TEST_BROWSER=<Chrome 경로> node tests/js/inbox_panel.browser.test.js
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs"), path = require("node:path"), http = require("node:http");
|
||||
const { chromium } = require("playwright");
|
||||
const ROOT = path.resolve(__dirname, "../.."), OUT = path.join(__dirname, ".out"), STATIC = path.join(ROOT, "app/static");
|
||||
|
||||
const detail = (id, title) => ({ id, title, project_id: 1, stage_id: 11, description: "", priority: "normal",
|
||||
assignee_email: "", subtasks: [], links: [], followers: [], access: "full", completed_at: null });
|
||||
let putStatus = 200, holdPut = false, releasePut = null, failNotiRead = false;
|
||||
const puts = [], reads = [];
|
||||
const server = http.createServer(async (req, res) => {
|
||||
const url = new URL(req.url, "http://localhost");
|
||||
const json = (code, body) => { res.statusCode = code; res.setHeader("Content-Type", "application/json"); res.end(JSON.stringify(body)); };
|
||||
if (url.pathname === "/project/inbox") { res.setHeader("Content-Type", "text/html; charset=utf-8"); res.end(fs.readFileSync(path.join(OUT, "inbox_render.html"))); return; }
|
||||
const tm = /^\/project\/t\/(\d+)$/.exec(url.pathname);
|
||||
if (tm) { // 공유 링크 — 서버(router.task_permalink)처럼 embed 를 이어서 보낸다
|
||||
res.statusCode = 303;
|
||||
res.setHeader("Location", `/project/p/1?task=${tm[1]}${url.searchParams.get("embed") === "1" ? "&embed=1" : ""}`);
|
||||
res.end(); return;
|
||||
}
|
||||
if (url.pathname === "/project/p/1") { res.setHeader("Content-Type", "text/html; charset=utf-8"); res.end(fs.readFileSync(path.join(OUT, "project_render.html"))); return; }
|
||||
if (url.pathname.startsWith("/project/api/")) {
|
||||
let raw = ""; for await (const c of req) raw += c;
|
||||
const body = raw ? JSON.parse(raw) : null;
|
||||
const task = /^\/project\/api\/tasks\/(\d+)$/.exec(url.pathname);
|
||||
if (task && req.method === "GET") return json(200, { task: detail(+task[1], "작업 " + task[1]) });
|
||||
if (task && req.method === "PUT") {
|
||||
puts.push({ id: +task[1], body });
|
||||
if (holdPut) await new Promise(r => { releasePut = r; });
|
||||
return putStatus >= 400 ? json(putStatus, { detail: "서버 오류" }) : json(200, { task: Object.assign(detail(+task[1], "작업"), body) });
|
||||
}
|
||||
if (url.pathname === "/project/api/mentions/read") { reads.push("m" + (body && body.task_id)); return json(200, { ok: true, marked: 1 }); }
|
||||
const nr = /^\/project\/api\/notifications\/(\d+)\/read$/.exec(url.pathname);
|
||||
if (nr) { reads.push("n" + nr[1]); return failNotiRead ? json(500, { detail: "db" }) : json(200, { ok: true }); }
|
||||
if (url.pathname.endsWith("/comments")) return json(200, { comments: [], events: [], features: {} });
|
||||
if (url.pathname.endsWith("/attachments")) return json(200, { attachments: [] });
|
||||
if (url.pathname.endsWith("/members")) return json(200, { members: [{ user_email: "me@test.local" }] });
|
||||
if (url.pathname.endsWith("/live-version")) return json(200, { ts: "v1" });
|
||||
if (url.pathname.endsWith("/alerts")) return json(200, { me: "me@test.local", latest_id: 0, alerts: [] });
|
||||
return json(200, {});
|
||||
}
|
||||
if (url.pathname.startsWith("/static/")) {
|
||||
const file = path.join(STATIC, decodeURIComponent(url.pathname.slice("/static/".length)));
|
||||
if (file.startsWith(STATIC) && fs.existsSync(file)) {
|
||||
res.setHeader("Content-Type", file.endsWith(".js") ? "text/javascript" : file.endsWith(".css") ? "text/css" : "application/octet-stream");
|
||||
res.end(fs.readFileSync(file)); return;
|
||||
}
|
||||
}
|
||||
res.statusCode = 404; res.end("");
|
||||
});
|
||||
|
||||
(async function () {
|
||||
await new Promise(r => server.listen(0, "127.0.0.1", r));
|
||||
const base = "http://127.0.0.1:" + server.address().port;
|
||||
const browser = await chromium.launch(process.env.PJ_TEST_BROWSER ? { executablePath: process.env.PJ_TEST_BROWSER } : {});
|
||||
const page = await browser.newPage({ viewport: { width: 1920, height: 1080 } }); // 작업 창이 왼쪽 목록을 가리지 않는 보통 PC 화면
|
||||
const dialogs = [];
|
||||
let dialogAnswer = false;
|
||||
page.on("dialog", async d => { dialogs.push(d.type() + ":" + d.message().slice(0, 20)); if (dialogAnswer) await d.accept(); else await d.dismiss(); });
|
||||
const pass = [];
|
||||
const ok = (name, cond, extra) => { assert.ok(cond, name + (extra === undefined ? "" : " → " + JSON.stringify(extra))); pass.push(name); console.log("PASS " + name); };
|
||||
try {
|
||||
await page.goto(base + "/project/inbox");
|
||||
const frameOf = () => page.frames().find(f => f !== page.mainFrame());
|
||||
const frameUrl = () => (frameOf() ? frameOf().url() : "");
|
||||
const waitModal = async () => {
|
||||
await page.waitForFunction(() => { const f = document.querySelector(".pj-inbox-panel iframe"); const d = f && f.contentDocument;
|
||||
const m = d && d.getElementById("pj-modal-task"); return !!(m && !m.hidden && d.getElementById("pj-t-id").value); });
|
||||
};
|
||||
await page.click('#pj-mention-tasks .pj-inbox-item[data-task-id="101"]');
|
||||
await waitModal();
|
||||
ok("공유 링크 리다이렉트 뒤에도 embed 화면(작업 창만)", /\/project\/p\/1\?/.test(frameUrl()) && /embed=1/.test(frameUrl()) &&
|
||||
await frameOf().evaluate(() => document.documentElement.classList.contains("pj-embed")), frameUrl());
|
||||
ok("같은 작업의 태그·알림을 함께 확인", reads.includes("m101") && reads.includes("n901"), reads);
|
||||
|
||||
// ① 저장 실패 → 다른 줄 → 묻기 → 계속 편집: 창·입력 그대로
|
||||
putStatus = 500;
|
||||
const fr = frameOf();
|
||||
await fr.fill("#pj-t-title", "작업 101 고침");
|
||||
await fr.evaluate(() => document.getElementById("pj-t-title").blur());
|
||||
await page.waitForTimeout(150);
|
||||
dialogAnswer = false;
|
||||
await page.click('#pj-mention-tasks .pj-inbox-item[data-task-id="102"]');
|
||||
await page.waitForTimeout(400);
|
||||
ok("저장 실패면 바꾸기 전에 묻고(작업 창과 같은 확인), 계속 편집이면 그대로", dialogs.length === 1 && /\?task=|\/p\/1/.test(frameUrl()) &&
|
||||
await fr.evaluate(() => document.getElementById("pj-t-title").value) === "작업 101 고침" &&
|
||||
!reads.includes("m102"), { dialogs, url: frameUrl(), reads });
|
||||
|
||||
// ② 저장 대기 중 A→B→A — 확인 뒤 A 그대로, 새 줄 안 열림
|
||||
putStatus = 200; holdPut = true;
|
||||
await page.click('#pj-mention-tasks .pj-inbox-item[data-task-id="102"]');
|
||||
await page.waitForTimeout(150);
|
||||
await page.click('#pj-mention-tasks .pj-inbox-item[data-task-id="101"]');
|
||||
await page.waitForTimeout(100);
|
||||
ok("저장이 끝나기 전엔 창을 바꾸지 않는다", frameOf() === fr && releasePut !== null);
|
||||
holdPut = false; releasePut(); releasePut = null;
|
||||
await page.waitForTimeout(500);
|
||||
ok("A→B→A 빨리 — 저장 성공 뒤 A 작업 창 그대로(다시 읽지 않음)", frameOf() === fr &&
|
||||
await fr.evaluate(() => document.getElementById("pj-t-id").value) === "101" && puts[puts.length - 1].body.title === "작업 101 고침" &&
|
||||
!reads.includes("m102"), { puts: puts.length, reads });
|
||||
|
||||
// ③ 저장 성공 상태에서 B → 바로 바뀌고 이탈 경고 없음
|
||||
const before = dialogs.length;
|
||||
await page.click('#pj-mention-tasks .pj-inbox-item[data-task-id="102"]');
|
||||
await waitModal();
|
||||
await page.waitForFunction(() => document.querySelector(".pj-inbox-panel iframe").contentDocument.getElementById("pj-t-id").value === "102");
|
||||
ok("저장된 상태면 묻지 않고 B 로(beforeunload 경고도 없음)", dialogs.length === before && reads.includes("m102"), dialogs);
|
||||
|
||||
// ④ iframe 안 포커스에서 Esc — 작업 창이 닫히며 패널도 닫힘, 확인한 줄은 목록에서 빠짐
|
||||
const fr2 = frameOf();
|
||||
await fr2.focus("#pj-t-title");
|
||||
await page.keyboard.press("Escape");
|
||||
await page.waitForFunction(() => !document.querySelector(".pj-inbox-panel").classList.contains("is-open"));
|
||||
await page.waitForTimeout(400);
|
||||
ok("iframe 안에서 Esc → 패널 닫힘, 확인한 태그 줄은 빠짐", await page.evaluate(() =>
|
||||
!document.querySelector('#pj-mention-tasks .pj-inbox-item[data-task-id="102"]')));
|
||||
|
||||
// ⑤ 읽음 실패한 알림 줄은 남는다
|
||||
failNotiRead = true;
|
||||
await page.click('#pj-inbox .pj-inbox-item[data-id="903"]', { button: "right" });
|
||||
await page.click(".pj-ctxmenu button, .pj-ctxmenu [role=menuitem], .pj-ctxmenu li");
|
||||
await page.waitForTimeout(400);
|
||||
ok("읽음 처리 실패 — 줄이 남고 굵게(읽지 않음)", await page.evaluate(() => {
|
||||
const li = document.querySelector('#pj-inbox .pj-inbox-item[data-id="903"]'); return !!li && li.classList.contains("is-unread"); }));
|
||||
console.log("\nALL PASS (" + pass.length + ")");
|
||||
} finally {
|
||||
await browser.close();
|
||||
server.close();
|
||||
}
|
||||
})().catch(e => { console.error(e); process.exit(1); });
|
||||
@@ -16,6 +16,7 @@ const WATCHDOG = setTimeout(function () { console.log("TIMEOUT — 어딘가에
|
||||
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 JS = fs.readFileSync(path.join(ROOT, "app", "static", "project.js"), "utf8");
|
||||
|
||||
const fails = [];
|
||||
@@ -779,6 +780,124 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
|
||||
const shown = Array.from(d.querySelectorAll(".pj-tmember")).map(function (n) { return n.dataset.email; });
|
||||
check("[멤버 배정·제외] 머리 멤버 아이콘 갱신", shown.indexOf("bob@test.local") < 0 && shown.indexOf("carol@test.local") >= 0, shown);
|
||||
}
|
||||
// ── [검토 A] 전체 보기 — 원 소속을 볼 수 없는 연결된 작업(301, 읽기 전용)도 한 번 나온다 ──
|
||||
{
|
||||
const env = makeEnv(adminHtml); baseRoutes(env);
|
||||
await boot(env);
|
||||
const d = env.d;
|
||||
d.getElementById("pj-side-allview").click(); await settle();
|
||||
const cards = function (id) { return d.querySelectorAll('.pj-card[data-task-id="' + id + '"]').length; };
|
||||
check("[전체 보기] 연결된 작업(원 소속 못 봄)도 한 장, 원 소속 작업은 그대로 한 장", cards(301) === 1 && cards(101) === 1 && cards(103) === 1,
|
||||
[cards(301), cards(101), cards(103)]);
|
||||
}
|
||||
// ── [검토 7] 수신함 iframe 안쪽 — __pjEmbedSettle 이 작업 창 닫기와 같은 저장 절차를 탄다 ──
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
env.d.documentElement.classList.add("pj-embed");
|
||||
let putStatus = 500; const puts = [];
|
||||
env.route("PUT", /\/project\/api\/tasks\/101$/, function (u, b) {
|
||||
puts.push(b);
|
||||
return putStatus >= 400 ? { status: putStatus, body: { detail: "서버 오류" } } : { body: { task: Object.assign(detail(101, "작업 A"), b) } };
|
||||
});
|
||||
const P = await boot(env); const d = env.d; const modal = d.getElementById("pj-modal-task");
|
||||
await P.openTaskModal(taskOf(P, 101)); await settle();
|
||||
const ta = d.getElementById("pj-t-title");
|
||||
ta.value = "작업 A3"; ta.dispatchEvent(new env.w.Event("blur")); await settle();
|
||||
env.setConfirm(false); // 계속 편집
|
||||
const ok1 = await env.w.__pjEmbedSettle(); await settle();
|
||||
check("[수신함 iframe] 저장 실패 → 다시 시도 후 묻고, 계속 편집이면 false·입력 유지",
|
||||
ok1 === false && !modal.hidden && titleVal(d) === "작업 A3" && env.confirms === 1 && puts.length >= 2, [ok1, env.confirms, puts.length]);
|
||||
putStatus = 200;
|
||||
const ok2 = await env.w.__pjEmbedSettle(); await settle();
|
||||
check("[수신함 iframe] 다시 — 재시도 성공이면 true(묻지 않음)", ok2 === true && env.confirms === 1 && puts[puts.length - 1].title === "작업 A3",
|
||||
[ok2, env.confirms]);
|
||||
}
|
||||
// ── [검토 7] 수신함 작업 창 — 바꾸기·닫기 전 저장 대기, 계속 편집이면 그대로, A→B→A, 저장 중 Esc, 읽음 실패 ──
|
||||
{
|
||||
const env = makeEnv(inboxHtml); baseRoutes(env);
|
||||
const reads = [];
|
||||
env.route("POST", /\/project\/api\/mentions\/read$/, function (u, b) { reads.push("m" + (b && b.task_id)); return { body: { ok: true, marked: 1 } }; });
|
||||
let failNoti = true;
|
||||
env.route("POST", /\/project\/api\/notifications\/\d+\/read$/, function (u) {
|
||||
reads.push("n" + u.split("/")[4]);
|
||||
return failNoti ? { status: 500, body: { detail: "db" } } : { body: { ok: true } };
|
||||
});
|
||||
await boot(env);
|
||||
const d = env.d;
|
||||
const A = d.querySelector('#pj-mention-tasks .pj-inbox-item[data-task-id="101"]');
|
||||
const B = d.querySelector('#pj-mention-tasks .pj-inbox-item[data-task-id="102"]');
|
||||
const N901 = d.querySelector('#pj-inbox .pj-inbox-item[data-id="901"]');
|
||||
const frame = function () { const p = d.body.querySelector(".pj-inbox-panel"); return p && p.querySelector("iframe"); };
|
||||
const src = function () { return frame() ? frame().getAttribute("src") : ""; };
|
||||
A.click(); await settle();
|
||||
check("[수신함] 줄 → 오른쪽 작업 창 = 공유 링크 + embed", src() === "/project/t/101?embed=1", src());
|
||||
check("[수신함] 같은 작업의 태그·알림을 함께 확인", reads.indexOf("m101") >= 0 && reads.indexOf("n901") >= 0, reads);
|
||||
await settle();
|
||||
check("[수신함] 알림 읽음 실패 — 굵게(읽지 않음) 그대로", N901.classList.contains("is-unread"));
|
||||
let gate = deferred(), settles = 0;
|
||||
frame().contentWindow.__pjEmbedSettle = function () { settles++; return gate.promise; };
|
||||
B.click(); await settle();
|
||||
check("[수신함] 작업 창 저장 확인 중엔 바꾸지 않음", src() === "/project/t/101?embed=1" && settles === 1, [src(), settles]);
|
||||
A.click(); await settle(); // A→B→A 빨리
|
||||
gate.resolve(true); await settle();
|
||||
check("[수신함] A→B→A — 확인 뒤 A 그대로, B 는 열거나 확인하지 않음",
|
||||
src() === "/project/t/101?embed=1" && reads.indexOf("m102") < 0 && B.classList.contains("is-unread") && settles === 1, [src(), reads, settles]);
|
||||
gate = deferred();
|
||||
B.click(); await settle(); gate.resolve(false); await settle();
|
||||
check("[수신함] 계속 편집 — 창·선택 그대로, 새 줄 확인 안 함",
|
||||
src() === "/project/t/101?embed=1" && A.classList.contains("is-selected") && !B.classList.contains("is-selected") && reads.indexOf("m102") < 0);
|
||||
gate = deferred(); settles = 0;
|
||||
const esc = function () { d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true })); };
|
||||
esc(); await settle(); esc(); await settle();
|
||||
const panelEl = d.body.querySelector(".pj-inbox-panel");
|
||||
check("[수신함] 저장 중 Esc(두 번) — 확인 하나만, 끝나기 전엔 열린 채", panelEl.classList.contains("is-open") && settles === 1, settles);
|
||||
gate.resolve(true); await settle();
|
||||
check("[수신함] 저장이 끝나면 닫힘", !panelEl.classList.contains("is-open"));
|
||||
await wait(260); await settle();
|
||||
check("[수신함] 확인된 태그 줄은 빠지고, 읽음 실패한 알림 줄은 남는다", !A.isConnected && N901.isConnected, [A.isConnected, N901.isConnected]);
|
||||
failNoti = false;
|
||||
B.click(); await settle(); await settle();
|
||||
check("[수신함] 닫힌 뒤 다른 줄 — 바로 열림", src() === "/project/t/102?embed=1", src());
|
||||
}
|
||||
// ── [검토 9] 새 프로젝트 — 생성과 멤버 배정 결과를 따로, 실패한 멤버만 다시, 연타해도 한 번 생성 ──
|
||||
{
|
||||
const env = makeEnv(adminHtml); baseRoutes(env);
|
||||
env.route("GET", /\/project\/api\/assignable-users$/, function () { return { body: { users: [
|
||||
{ email: "bob@test.local", id: "bob", name: "Bob", avatar: "" },
|
||||
{ email: "carol@test.local", id: "carol", name: "Carol", avatar: "" }] } }; });
|
||||
let creates = 0, failCarol = true;
|
||||
const memberCalls = [];
|
||||
const createGate = deferred();
|
||||
env.route("POST", /\/project\/api\/projects$/, async function () {
|
||||
creates++;
|
||||
await createGate.promise;
|
||||
return { status: 201, body: { project: { id: 9, name: "새 프로젝트" } } };
|
||||
});
|
||||
env.route("POST", /\/project\/api\/projects\/9\/members$/, function (u, b) {
|
||||
memberCalls.push(b.user_email);
|
||||
return failCarol && b.user_email === "carol@test.local" ? { status: 400, body: { detail: "배정 불가" } } : { status: 201, body: { member: {} } };
|
||||
});
|
||||
await boot(env);
|
||||
const d = env.d;
|
||||
d.getElementById("pj-new-project-side").click(); await settle();
|
||||
d.getElementById("pj-f-name").value = "새 프로젝트";
|
||||
d.querySelectorAll("#pj-f-members input[type=checkbox]").forEach(function (c) { c.checked = true; });
|
||||
const save = d.getElementById("pj-save-project");
|
||||
save.click(); save.click(); await settle(); // 연타
|
||||
createGate.resolve(); await settle(); await settle();
|
||||
const modal = d.getElementById("pj-modal-project");
|
||||
const msg = d.getElementById("pj-f-project-msg");
|
||||
const carol = d.querySelector('#pj-f-members input[value="carol@test.local"]').closest(".pj-member-pick");
|
||||
check("[새 프로젝트] 연타해도 한 번만 생성", creates === 1, creates);
|
||||
check("[새 프로젝트] 배정 실패 — 창 유지, 생성됨·실패 멤버 안내, 실패 표시",
|
||||
!modal.hidden && !msg.hidden && /만들어졌습니다/.test(msg.textContent) && /배정 불가/.test(msg.textContent) &&
|
||||
carol.classList.contains("is-failed") && /다시 배정/.test(save.textContent), [modal.hidden, msg.textContent, save.textContent]);
|
||||
failCarol = false;
|
||||
save.click(); await settle(); await settle();
|
||||
check("[새 프로젝트] 다시 배정 — 실패한 멤버만, 프로젝트는 다시 만들지 않음, 끝나면 닫힘",
|
||||
creates === 1 && JSON.stringify(memberCalls) === JSON.stringify(["bob@test.local", "carol@test.local", "carol@test.local"]) && modal.hidden,
|
||||
[creates, memberCalls, modal.hidden]);
|
||||
}
|
||||
clearTimeout(WATCHDOG);
|
||||
console.log(fails.length ? "\nFAILED: " + fails.join(", ") : "\nALL PASS");
|
||||
process.exit(fails.length ? 1 : 0);
|
||||
|
||||
@@ -52,6 +52,31 @@ def main() -> None:
|
||||
env.globals["pj_kr_holidays"] = {}
|
||||
for name, admin in (("project_render.html", False), ("project_admin_render.html", True)):
|
||||
render_one(env, name, admin)
|
||||
render_inbox(env)
|
||||
|
||||
|
||||
def render_inbox(env) -> None:
|
||||
"""수신함(project/inbox.html) — 태그한 작업 101·102, 알림(작업 101·102·프로젝트만)."""
|
||||
def mt(tid: int, title: str) -> dict:
|
||||
return {"id": tid, "title": title, "project_id": 1, "project_name": "P1", "project_color": "#4573d2",
|
||||
"unread_mentions": 1, "stage_name": "할 일", "due_label": "", "mention_actor": "bob@test.local",
|
||||
"completed_at": None}
|
||||
|
||||
def nt(nid: int, ntype: str, title: str, task_id: int | None) -> dict:
|
||||
return {"id": nid, "type": ntype, "title": title, "body": "P1", "task_id": task_id, "project_id": 1,
|
||||
"is_read": False, "actor_email": "bob@test.local", "created_at": "2026-10-12T09:00:00+09:00"}
|
||||
|
||||
html = env.get_template("project/inbox.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=0, mention_unread=2,
|
||||
color_palette=["#4573d2"], project_icons=["folder"], project_asana_icons=[],
|
||||
mentioned_tasks=[mt(101, "작업 A"), mt(102, "작업 B")],
|
||||
notifications=[nt(901, "assigned", "작업 배정: 작업 A", 101), nt(902, "comment", "새 댓글: 작업 B", 102),
|
||||
nt(903, "completed", "프로젝트 알림", None)],
|
||||
)
|
||||
path = os.path.join(OUT_DIR, "inbox_render.html")
|
||||
io.open(path, "w", encoding="utf-8", newline="\n").write(html)
|
||||
print("rendered:", path)
|
||||
|
||||
|
||||
def render_one(env, name: str, admin: bool) -> None:
|
||||
|
||||
Reference in New Issue
Block a user