Allow milestones to be closed and reopened
This commit is contained in:
@@ -148,6 +148,7 @@ pub struct MilestoneEditorPage {
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub due_date: Option<i64>,
|
||||
pub closed: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
@@ -424,6 +425,10 @@ pub fn milestone_editor_page(milestone: Option<models::Milestone>) -> MilestoneE
|
||||
.as_ref()
|
||||
.and_then(|milestone| milestone.due_on.as_deref())
|
||||
.and_then(parse_api_date),
|
||||
closed: milestone
|
||||
.as_ref()
|
||||
.and_then(|milestone| milestone.state.as_deref())
|
||||
== Some("closed"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1628,13 +1633,17 @@ mod tests {
|
||||
title: Some("Version 1".into()),
|
||||
description: Some("Ship it".into()),
|
||||
due_on: Some("2024-02-29T12:34:56Z".into()),
|
||||
state: Some("closed".into()),
|
||||
..Default::default()
|
||||
}));
|
||||
assert_eq!(page.title, "Version 1");
|
||||
assert_eq!(page.description, "Ship it");
|
||||
assert_eq!(page.due_date, Some(1_709_164_800));
|
||||
assert!(page.closed);
|
||||
|
||||
assert_eq!(milestone_editor_page(None).due_date, None);
|
||||
let new = milestone_editor_page(None);
|
||||
assert_eq!(new.due_date, None);
|
||||
assert!(!new.closed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user