PEP-235: статус «ждёт одобрения» ставится до вопроса — быстрый ответ PM не затирается
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c43ab6d44b
commit
ec658ad23a
@ -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.
|
// PEP-154: no service text (tags, command output, paths) in what the person reads.
|
||||||
const original = q.text;
|
const original = q.text;
|
||||||
q = { ...q, text: messageText(q.kind, 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.
|
// 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 () => {
|
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);
|
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).
|
// PEP-152: the details follow the message (a refreshed one gets the fresh details).
|
||||||
if (details !== undefined) await setMessageDetails(db, row.id, details);
|
if (details !== undefined) await setMessageDetails(db, row.id, details);
|
||||||
await keepQuestionDetails(db, row.id, original, q.text).catch(() => {});
|
await keepQuestionDetails(db, row.id, original, q.text).catch(() => {});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user