fix(#1940): carry pr_number on the live approval_added event
This commit is contained in:
parent
6516d4282e
commit
4c53898382
4 changed files with 74 additions and 31 deletions
|
|
@ -389,6 +389,20 @@ pub struct ApprovalResolved<'a> {
|
|||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
/// Field-named payload for [`Coordinator::emit_approval_added`].
|
||||
/// Mirrors the `ApprovalAdded` dashboard-event fields. `agent`
|
||||
/// borrows from the caller; `approval_kind` is a compile-time
|
||||
/// constant. `pr_number` is set for `merge_config_pr` only.
|
||||
pub struct ApprovalAdded<'a> {
|
||||
pub id: i64,
|
||||
pub agent: &'a str,
|
||||
pub approval_kind: &'static str,
|
||||
pub sha_short: Option<String>,
|
||||
pub diff: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub pr_number: Option<u64>,
|
||||
}
|
||||
|
||||
/// Field-named payload for [`Coordinator::emit_question_added`].
|
||||
/// Mirrors the `QuestionAdded` dashboard-event fields; all references
|
||||
/// share the caller's lifetime.
|
||||
|
|
@ -740,15 +754,16 @@ impl Coordinator {
|
|||
/// Emit `ApprovalAdded` immediately after the row is inserted in
|
||||
/// sqlite. Caller passes the diff text it already computed (or
|
||||
/// `None` for spawn approvals which carry no diff).
|
||||
pub fn emit_approval_added(
|
||||
&self,
|
||||
id: i64,
|
||||
agent: &str,
|
||||
approval_kind: &'static str,
|
||||
sha_short: Option<String>,
|
||||
diff: Option<String>,
|
||||
description: Option<String>,
|
||||
) {
|
||||
pub fn emit_approval_added(&self, ev: ApprovalAdded<'_>) {
|
||||
let ApprovalAdded {
|
||||
id,
|
||||
agent,
|
||||
approval_kind,
|
||||
sha_short,
|
||||
diff,
|
||||
description,
|
||||
pr_number,
|
||||
} = ev;
|
||||
self.emit_dashboard_event(DashboardEvent::ApprovalAdded {
|
||||
seq: self.next_seq(),
|
||||
id,
|
||||
|
|
@ -757,6 +772,7 @@ impl Coordinator {
|
|||
sha_short,
|
||||
diff,
|
||||
description,
|
||||
pr_number,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue