From 4a0d08154e61d88bd86ca9503dde8e8799ce5e5c Mon Sep 17 00:00:00 2001 From: damocles Date: Fri, 22 May 2026 16:54:29 +0200 Subject: [PATCH] forge_notify: detect review requests via requested_reviewers (closes #253) --- hive-ag3nt/src/forge_notify.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hive-ag3nt/src/forge_notify.rs b/hive-ag3nt/src/forge_notify.rs index eb2382a..e023c5c 100644 --- a/hive-ag3nt/src/forge_notify.rs +++ b/hive-ag3nt/src/forge_notify.rs @@ -378,6 +378,26 @@ async fn format_notification( other => format!("{label}{num}{repo}: {other}"), }; + // Review-request detection (#253): Forgejo does not always set + // reason == "review_requested" (observed reason is null). Check + // requested_reviewers instead, which is reliable. If own_login is + // in the list, this is a review request -- override the kind. + // `subject` and `is_pr` are already fetched unconditionally above (#256). + let is_review_request = is_new + && is_pr + && !own_login.is_empty() + && subject + .as_ref() + .and_then(|s| s["requested_reviewers"].as_array()) + .map(|arr| arr.iter().any(|r| r["login"].as_str() == Some(own_login))) + .unwrap_or(false); + + let kind = if is_review_request { + format!("review requested{num}{repo}") + } else { + kind + }; + let mut out = format!("[{kind}] {title}\nurl: {html_url}"); out.push_str(&meta_suffix); Some(out)