Skip to content

Commit 36991eb

Browse files
committed
move flagship test to a fn on ExistingGithubIssue
1 parent e1da5eb commit 36991eb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

mdbook-goals/src/gh/issues.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ impl ExistingGithubIssue {
242242
pub fn has_label(&self, name: &str) -> bool {
243243
self.labels.iter().any(|label| label.name == name)
244244
}
245+
246+
/// True if the issue has the label for a flagship goal.
247+
pub fn has_flagship_label(&self) -> bool {
248+
self.has_label("flagship")
249+
}
245250
}
246251

247252
pub fn lock_issue(repository: &Repository, number: u64) -> anyhow::Result<()> {

mdbook-goals/src/json.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub(super) fn generate_json(
3636
TrackingIssue {
3737
number: issue.number,
3838
title,
39-
flagship: is_flagship(&issue),
39+
flagship: issue.has_flagship_label(),
4040
progress,
4141
assignees: issue.assignees.into_iter().collect(),
4242
updates: updates(issue.comments),
@@ -224,10 +224,6 @@ fn try_checkboxes(issue: &ExistingGithubIssue) -> anyhow::Result<Progress> {
224224
}
225225
}
226226

227-
fn is_flagship(issue: &ExistingGithubIssue) -> bool {
228-
issue.has_label("flagship")
229-
}
230-
231227
fn updates(comments: Vec<ExistingGithubComment>) -> Vec<TrackingIssueUpdate> {
232228
comments
233229
.into_iter()

0 commit comments

Comments
 (0)