Show labels on issue details

This commit is contained in:
Georg Bauer
2026-07-31 18:27:57 +02:00
parent 0a38dbe9f2
commit acf2c839ad
6 changed files with 101 additions and 13 deletions

View File

@@ -77,6 +77,7 @@ pub struct IssuePage {
pub state: String,
pub meta: String,
pub milestone: String,
pub labels: Vec<LabelRow>,
pub body: String,
pub comments: Vec<CommentRow>,
pub has_more: bool,
@@ -554,6 +555,14 @@ pub fn issue_page(details: IssueDetails) -> IssuePage {
.unwrap_or_else(|| "unknown".into()),
meta: issue_meta(&details.issue),
milestone: issue_milestone(&details.issue),
labels: details
.issue
.labels
.as_deref()
.unwrap_or_default()
.iter()
.filter_map(label_row)
.collect(),
body: details
.issue
.body
@@ -1269,6 +1278,11 @@ mod tests {
let page = issue_page(IssueDetails {
issue: models::Issue {
state: Some("closed".into()),
labels: Some(vec![models::Label {
name: Some("bug".into()),
color: Some("ff0000".into()),
..Default::default()
}]),
..Default::default()
},
comments: vec![
@@ -1297,6 +1311,7 @@ mod tests {
});
assert_eq!(page.state, "closed");
assert_eq!(page.labels[0].name, "bug");
assert_eq!(page.comments[0].id, 7);
assert!(page.comments[0].can_edit);
assert!(!page.comments[1].can_edit);