mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
http: Rename state query param to status
This allows us to match the query param with the output that is
`{ "status": "open" | "merged" | ... }`
This commit is contained in:
@@ -160,7 +160,7 @@ pub struct RawQuery {
|
||||
pub struct CobsQuery<T> {
|
||||
pub page: Option<usize>,
|
||||
pub per_page: Option<usize>,
|
||||
pub state: Option<T>,
|
||||
pub status: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
|
||||
@@ -612,17 +612,17 @@ async fn issues_handler(
|
||||
let CobsQuery {
|
||||
page,
|
||||
per_page,
|
||||
state,
|
||||
status,
|
||||
} = qs;
|
||||
let page = page.unwrap_or(0);
|
||||
let per_page = per_page.unwrap_or(10);
|
||||
let state = state.unwrap_or_default();
|
||||
let status = status.unwrap_or_default();
|
||||
let issues = ctx.profile.issues(&repo)?;
|
||||
let mut issues: Vec<_> = issues
|
||||
.list()?
|
||||
.filter_map(|r| {
|
||||
let (id, issue) = r.ok()?;
|
||||
(state.matches(issue.state())).then_some((id, issue))
|
||||
(status.matches(issue.state())).then_some((id, issue))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -666,17 +666,17 @@ async fn patches_handler(
|
||||
let CobsQuery {
|
||||
page,
|
||||
per_page,
|
||||
state,
|
||||
status,
|
||||
} = qs;
|
||||
let page = page.unwrap_or(0);
|
||||
let per_page = per_page.unwrap_or(10);
|
||||
let state = state.unwrap_or_default();
|
||||
let status = status.unwrap_or_default();
|
||||
let patches = ctx.profile.patches(&repo)?;
|
||||
let mut patches = patches
|
||||
.list()?
|
||||
.filter_map(|r| {
|
||||
let (id, patch) = r.ok()?;
|
||||
(state.matches(patch.state())).then_some((id, patch))
|
||||
(status.matches(patch.state())).then_some((id, patch))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
patches.sort_by(|(_, a), (_, b)| b.timestamp().cmp(&a.timestamp()));
|
||||
|
||||
Reference in New Issue
Block a user