feat(project): blinking popup for new mentions and task assignments
Project pages poll GET /api/notifications/alerts every 20s (and when the tab becomes visible). New unread mention/assigned notifications show in a large blinking popup at the bottom center until closed; closing in one tab closes it in the others. A new browser starts from the latest id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -727,6 +727,32 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
|
||||
check("[대시보드 담당자별] 항목 → 작업 편집 창(하위 작업은 서버에서 받아)", !env.d.getElementById("pj-modal-task").hidden &&
|
||||
env.d.getElementById("pj-t-title").value === "하위 2", env.d.getElementById("pj-t-title").value);
|
||||
}
|
||||
// ── 나를 태그·작업 배정 알림 팝업 — 본 것 이후 새 알림만, 깜박이는 팝업, 닫기 전까지 유지 ──
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
const asked = [];
|
||||
env.route("GET", /\/project\/api\/notifications\/alerts/, function (u) {
|
||||
asked.push(u);
|
||||
const after = /after=(\d+)/.exec(u);
|
||||
if (!after) return { body: { me: "me@test.local", latest_id: 5, alerts: [] } };
|
||||
return { body: { me: "me@test.local", latest_id: 5, alerts: [
|
||||
{ id: 4, type: "assigned", title: "작업 배정: 촬영 준비", body: "P1 · 마감 -", task_id: 101, project_id: 1, actor_email: "bob@test.local" },
|
||||
{ id: 5, type: "mention", title: "나를 태그함: 작업 A", body: "P1 · 댓글", task_id: 101, project_id: 1, actor_email: "bob@test.local" }] } };
|
||||
});
|
||||
env.w.localStorage.setItem("pj_alert_seen:me@test.local", "3");
|
||||
await boot(env); await settle(); await wait(10); await settle();
|
||||
const pop = env.d.body.querySelector(".pj-alert-pop");
|
||||
check("[알림 팝업] 본 것(3) 이후 새 알림 2건을 body 에 팝업", !!pop && pop.querySelectorAll(".pj-alert-item").length === 2 &&
|
||||
/촬영 준비/.test(pop.textContent) && /나를 태그/.test(pop.textContent) && asked.some(function (u) { return /after=3/.test(u); }), asked);
|
||||
pop.querySelector("[data-alert-close]").click();
|
||||
check("[알림 팝업] 닫기 → 사라지고 본 것 = 5", !env.d.body.querySelector(".pj-alert-pop") && env.w.localStorage.getItem("pj_alert_seen:me@test.local") === "5");
|
||||
}
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
env.route("GET", /\/project\/api\/notifications\/alerts/, function () { return { body: { me: "me@test.local", latest_id: 9, alerts: [] } }; });
|
||||
await boot(env); await settle();
|
||||
check("[알림 팝업] 처음 쓰는 브라우저 — 옛 알림 안 띄우고 기준점만", !env.d.body.querySelector(".pj-alert-pop") && env.w.localStorage.getItem("pj_alert_seen:me@test.local") === "9");
|
||||
}
|
||||
// ── 멤버 배정·제외 — 지금 멤버는 체크된 채로, 체크 = 배정 · 해제 = 제외(확인 뒤) ──
|
||||
{
|
||||
const env = makeEnv(adminHtml); baseRoutes(env);
|
||||
|
||||
Reference in New Issue
Block a user