Skip to content

Commit 213da2a

Browse files
committed
Use project to get scheduled meetings
1 parent 6b67e16 commit 213da2a

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

src/agenda.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,8 @@ pub fn lang<'a>() -> Box<dyn Action + Send + Sync> {
475475
QueryMap {
476476
name: "scheduled_meetings",
477477
kind: QueryKind::List,
478-
query: Arc::new(github::Query {
479-
filters: vec![("state", "open"), ("is", "issue")],
480-
include_labels: vec!["meeting-proposal", "meeting-scheduled"],
481-
exclude_labels: vec![],
478+
query: Arc::new(github::DesignMeetings {
479+
with_status: github::DesignMeetingStatus::Scheduled,
482480
}),
483481
},
484482
],
@@ -596,7 +594,9 @@ pub fn lang_planning<'a>() -> Box<dyn Action + Send + Sync> {
596594
QueryMap {
597595
name: "proposed_meetings",
598596
kind: QueryKind::List,
599-
query: Arc::new(github::ProposedDesignMeetings),
597+
query: Arc::new(github::DesignMeetings {
598+
with_status: github::DesignMeetingStatus::Proposed,
599+
}),
600600
},
601601
],
602602
},

src/github.rs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,9 +2169,30 @@ async fn project_items_by_status(
21692169
Ok(all_items)
21702170
}
21712171

2172-
pub struct ProposedDesignMeetings;
2172+
pub enum DesignMeetingStatus {
2173+
Proposed,
2174+
Scheduled,
2175+
Done,
2176+
Empty,
2177+
}
2178+
2179+
impl DesignMeetingStatus {
2180+
fn query_str(&self) -> Option<&str> {
2181+
match self {
2182+
DesignMeetingStatus::Proposed => Some("Needs triage"),
2183+
DesignMeetingStatus::Scheduled => Some("Scheduled"),
2184+
DesignMeetingStatus::Done => Some("Done"),
2185+
DesignMeetingStatus::Empty => None,
2186+
}
2187+
}
2188+
}
2189+
2190+
pub struct DesignMeetings {
2191+
pub with_status: DesignMeetingStatus,
2192+
}
2193+
21732194
#[async_trait]
2174-
impl IssuesQuery for ProposedDesignMeetings {
2195+
impl IssuesQuery for DesignMeetings {
21752196
async fn query<'a>(
21762197
&'a self,
21772198
_repo: &'a Repository,
@@ -2181,7 +2202,8 @@ impl IssuesQuery for ProposedDesignMeetings {
21812202
use github_graphql::project_items_by_status::ProjectV2ItemContent;
21822203

21832204
let items =
2184-
project_items_by_status(client, |status| status == Some("Needs triage")).await?;
2205+
project_items_by_status(client, |status| status == self.with_status.query_str())
2206+
.await?;
21852207
Ok(items
21862208
.into_iter()
21872209
.flat_map(|item| match item {

0 commit comments

Comments
 (0)