Skip to content

Commit b93064a

Browse files
committed
Caller checks review capacity DB query result
1 parent d11d555 commit b93064a

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/handlers/assign.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -541,18 +541,17 @@ pub(super) async fn handle_command(
541541
}
542542
let db_client = ctx.db.get().await;
543543
if is_self_assign(&name, &event.user().login) {
544-
match has_user_capacity(&db_client, &name).await {
545-
Ok(work_queue) => work_queue.username,
546-
Err(_) => {
547-
issue
548-
.post_comment(
549-
&ctx.github,
550-
&REVIEWER_HAS_NO_CAPACITY.replace("{username}", &name),
551-
)
552-
.await?;
553-
return Ok(());
554-
}
555-
};
544+
let work_queue = has_user_capacity(&db_client, &name).await;
545+
if work_queue.is_err() {
546+
issue
547+
.post_comment(
548+
&ctx.github,
549+
&REVIEWER_HAS_NO_CAPACITY.replace("{username}", &name),
550+
)
551+
.await?;
552+
return Ok(());
553+
}
554+
556555
name.to_string()
557556
} else {
558557
let teams = crate::team_data::teams(&ctx.github).await?;

src/handlers/pr_tracking.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ pub(super) async fn handle_input<'a>(
105105
Ok(())
106106
}
107107

108-
// TODO: we should just fetch the number of assigned prs and max assigned prs. The caller should do the check.
109108
pub async fn has_user_capacity(
110109
db: &crate::db::PooledClient,
111110
assignee: &str,

0 commit comments

Comments
 (0)