Skip to content

Commit 7b81000

Browse files
committed
Use a constant for the ghost account username
1 parent ae34e11 commit 7b81000

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/handlers/assign.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ const REVIEWER_ALREADY_ASSIGNED: &str =
8787
8888
Please choose another assignee.";
8989

90+
// Special account that we use to prevent assignment.
91+
const GHOST_ACCOUNT: &str = "ghost";
92+
9093
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
9194
struct AssignData {
9295
user: Option<String>,
@@ -132,7 +135,7 @@ pub(super) async fn handle_input(
132135
// Don't auto-assign or welcome if the user manually set the assignee when opening.
133136
if event.issue.assignees.is_empty() {
134137
let (assignee, from_comment) = determine_assignee(ctx, event, config, &diff).await?;
135-
if assignee.as_deref() == Some("ghost") {
138+
if assignee.as_deref() == Some(GHOST_ACCOUNT) {
136139
// "ghost" is GitHub's placeholder account for deleted accounts.
137140
// It is used here as a convenient way to prevent assignment. This
138141
// is typically used for rollups or experiments where you don't
@@ -694,8 +697,8 @@ async fn find_reviewer_from_names(
694697
);
695698

696699
// Special case user "ghost", we always skip filtering
697-
if candidates.contains("ghost") {
698-
return Ok("ghost".to_string());
700+
if candidates.contains(GHOST_ACCOUNT) {
701+
return Ok(GHOST_ACCOUNT.to_string());
699702
}
700703

701704
// Return unfiltered list of candidates

0 commit comments

Comments
 (0)