PEP-235: Access Hub — подтверждение опасных операций владельцем #313

Merged
peppa-bot merged 9 commits from task/pep-235 into main 2026-12-01 09:46:18 +00:00
Showing only changes of commit ec658ad23a - Show all commits

View File

@ -361,13 +361,13 @@ export async function askPm(db: Db, ref: TaskRef, { topic, head, details, ...q }
// PEP-154: no service text (tags, command output, paths) in what the person reads.
const original = q.text;
q = { ...q, text: messageText(q.kind, q.text) };
// The status goes BEFORE the question: an answer that comes at once (it moves the story on)
// must not be overwritten by a late «awaiting approval» (cjm «rejected proposal» raced here).
if (q.kind === "approval") await updateTask(db, ref, { status: "awaiting_approval" }, q.sessionId);
// PEP-151: the same state of the story again refreshes the earlier message instead of adding one.
const row = await raiseOnce(db, { projectId: ref.project.id, taskId: ref.task.id, sessionId: q.sessionId ?? null, kind: q.kind, text: q.text, options: q.options, topic, head }, async () => {
return insertQuestion(db, { projectId: ref.project.id, taskId: ref.task.id, ...q, msgType: q.msgType ?? defaultMessageType(q) }, details);
});
// The status goes right after the question: an answer that comes at once (it moves the story
// on) must not be overwritten by a late «awaiting approval».
if (q.kind === "approval") await updateTask(db, ref, { status: "awaiting_approval" }, q.sessionId);
// PEP-152: the details follow the message (a refreshed one gets the fresh details).
if (details !== undefined) await setMessageDetails(db, row.id, details);
await keepQuestionDetails(db, row.id, original, q.text).catch(() => {});