summaryrefslogtreecommitdiffstats
path: root/src/review
diff options
context:
space:
mode:
Diffstat (limited to 'src/review')
-rw-r--r--src/review/approve.rs2
-rw-r--r--src/review/diff.rs24
2 files changed, 25 insertions, 1 deletions
diff --git a/src/review/approve.rs b/src/review/approve.rs
index b62adec..0fdf2b2 100644
--- a/src/review/approve.rs
+++ b/src/review/approve.rs
@@ -72,7 +72,7 @@ pub fn approve(
let row: Option<CandidateState> = tx
.query_row(
"SELECT c.id, c.state, c.identity_hash, c.base_release_id, p.current_accepted_release_id,
- c.risk_level, b.name
+ c.risk_level, p.name
FROM candidate c JOIN pkgbase p ON p.id = c.pkgbase_id
WHERE c.id = ?1",
rusqlite::params![candidate_id],
diff --git a/src/review/diff.rs b/src/review/diff.rs
index cfce3fe..df6318c 100644
--- a/src/review/diff.rs
+++ b/src/review/diff.rs
@@ -154,3 +154,27 @@ pub fn full_recipe_text(db: &Db, c: &CandidateRow) -> Result<String> {
let r: Recipe = serde_json::from_str(&snap.srcinfo_json).unwrap_or_default();
Ok(r.pkgbuild)
}
+
+/// Render the panels, store the resulting `diff_digest` on the candidate, and
+/// hand it back. The approve POST must echo this value, which is what makes
+/// "we build exactly what was displayed" checkable (ยง7.1a).
+pub fn render_and_store(db: &Db, cfg: &Config, c: &CandidateRow) -> Result<String> {
+ let base = match c.base_release_id {
+ Some(id) => db::release_by_id(db, id)?,
+ None => None,
+ };
+ let ps = panels(cfg, db, c, base.as_ref())?;
+ let digest = diff_digest(&ps);
+ crate::review::candidates::set_diff_digest(db, c.id, &digest)?;
+ Ok(digest)
+}
+
+/// Re-render for a 409 response: show the reviewer what the candidate is now.
+pub fn render_current(db: &Db, cfg: &Config, c: &CandidateRow) -> Result<(String, String)> {
+ let base = match c.base_release_id {
+ Some(id) => db::release_by_id(db, id)?,
+ None => None,
+ };
+ let ps = panels(cfg, db, c, base.as_ref())?;
+ Ok((render_text(&ps), diff_digest(&ps)))
+}