Skip to content

Commit 44a1813

Browse files
committed
Extract GitHubTeamMembership::is_active() fn
1 parent c313d87 commit 44a1813

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

crates/crates_io_github/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ pub struct GitHubTeamMembership {
206206
pub state: String,
207207
}
208208

209+
impl GitHubTeamMembership {
210+
pub fn is_active(&self) -> bool {
211+
self.state == "active"
212+
}
213+
}
214+
209215
#[derive(Debug, Deserialize)]
210216
pub struct GitHubOrgMembership {
211217
pub state: String,

src/models/team.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,5 @@ async fn team_with_gh_id_contains_user(
236236

237237
// There is also `state: pending` for which we could possibly give
238238
// some feedback, but it's not obvious how that should work.
239-
Ok(membership.is_some_and(|m| m.state == "active"))
239+
Ok(membership.is_some_and(|m| m.is_active()))
240240
}

0 commit comments

Comments
 (0)