gatewayd: approvals asked by non-approvers in direct messages go to an approver

Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
2026-09-24 12:07:06 -07:00
parent 989548419d
commit e10d93c3e8
6 changed files with 338 additions and 42 deletions
+22 -9
View File
@@ -112,28 +112,41 @@ fn without_a_turn_in_flight_it_goes_to_the_first_approvers_direct_messages_in_pa
let long = format!("{{\"content\":\"{}\"}}", "x".repeat(20_000));
let asking = ask(&socket(&home), pending(7, "chat-1789700000-1", &long)).unwrap();
let posts = mm.posts();
assert_eq!(posts.len(), 2, "two parts");
assert_eq!(posts.len(), 3, "a first post, then two parts");
assert_eq!(
(posts[0].0.as_str(), posts[0].1.as_str()),
(DM, ""),
"a new thread in the direct channel"
);
assert_eq!(
(posts[1].0.as_str(), posts[1].1.clone()),
(DM, FakeMm::post_id(0)),
"the next part in its thread"
);
assert!(
posts[1]
posts[0]
.2
.starts_with("**Approval 7** was asked in session `chat-1789700000-1`"),
"{}",
posts[0].2
);
for (n, part) in posts[1..].iter().enumerate() {
assert_eq!(
(part.0.as_str(), part.1.clone()),
(DM, FakeMm::post_id(0)),
"part {n} in its thread"
);
}
assert!(posts[1].2.starts_with("**Approval 7**"), "{}", posts[1].2);
assert!(
posts[2]
.2
.contains("Reply in this thread with `!approve 7`")
);
assert_eq!(asking.posts, [FakeMm::post_id(0), FakeMm::post_id(1)]);
assert_eq!(
asking.posts,
[FakeMm::post_id(0), FakeMm::post_id(1), FakeMm::post_id(2)]
);
asking.close();
let edits = mm.wait_edits(1, WAIT);
assert_eq!(
edits[0].0,
FakeMm::post_id(1),
FakeMm::post_id(2),
"only the last part is edited"
);
}