summaryrefslogtreecommitdiffstats
path: root/rust/src/endpoints.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-14 18:29:51 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-14 18:29:51 -0700
commita69fb6bfd45b99a2001a12524714fc2542a6d9ca (patch)
treeb6b100d2fc235b439c98ad9f1ee4915b5ac83660 /rust/src/endpoints.rs
parent7c18e1d22b16bb920c9bb9a788691820bbdb2bfa (diff)
downloadfatcat-a69fb6bfd45b99a2001a12524714fc2542a6d9ca.tar.gz
fatcat-a69fb6bfd45b99a2001a12524714fc2542a6d9ca.zip
rust: return editors and cl index for editgroup more often
Diffstat (limited to 'rust/src/endpoints.rs')
-rw-r--r--rust/src/endpoints.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/rust/src/endpoints.rs b/rust/src/endpoints.rs
index 7d6db908..96a4700b 100644
--- a/rust/src/endpoints.rs
+++ b/rust/src/endpoints.rs
@@ -788,9 +788,10 @@ impl Api for Server {
let limit = cmp::min(100, limit.unwrap_or(20)) as u64;
let rows =
Editgroup::db_get_range_for_editor(&conn, editor_id, limit, since, before)?;
+ let editor = Editor::db_get(&conn, editor_id)?.into_model();
Ok(rows
.into_iter()
- .map(|(eg, cl)| eg.into_model_partial(cl.map(|v| v.id)))
+ .map(|(eg, cl)| eg.into_model_partial(cl.map(|v| v.id), Some(editor.clone())))
.collect())
})
.map_err(|e: Error| FatcatError::from(e))
@@ -931,7 +932,7 @@ impl Api for Server {
let row = Editgroup::db_get_range_reviewable(&conn, limit, since, before)?;
let mut editgroups: Vec<Editgroup> = row
.into_iter()
- .map(|eg| eg.into_model_partial(None))
+ .map(|eg| eg.into_model_partial(None, None))
.collect();
if let Some(expand) = expand {
let expand = ExpandFlags::from_str(&expand)?;
@@ -1032,7 +1033,7 @@ impl Api for Server {
};
editgroup
.db_update(&conn, editgroup_id, submit)
- .map(|eg| eg.into_model_partial(None)) // can't update an accepted editgroup
+ .map(|eg| eg.into_model_partial(None, None)) // can't update an accepted editgroup
})
.map_err(|e: Error| FatcatError::from(e))
{