File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -187,16 +187,19 @@ async fn handle_command<'a>(
187
187
let mut impersonated = false ;
188
188
if let Some ( & "as" ) = words. get ( 0 ) {
189
189
if let Some ( username) = words. get ( 1 ) {
190
- impersonated = true ;
191
-
192
- // Impersonate => change actual gh_id
193
- gh_id = match get_id_for_username ( & ctx. github , username)
190
+ let impersonated_gh_id = match get_id_for_username ( & ctx. github , username)
194
191
. await
195
192
. context ( "getting ID of github user" ) ?
196
193
{
197
- Some ( id) => id. try_into ( ) . unwrap ( ) ,
194
+ Some ( id) => id. try_into ( ) ? ,
198
195
None => anyhow:: bail!( "Can only authorize for other GitHub users." ) ,
199
196
} ;
197
+
198
+ // Impersonate => change actual gh_id
199
+ if impersonated_gh_id != gh_id {
200
+ impersonated = true ;
201
+ gh_id = impersonated_gh_id;
202
+ }
200
203
} else {
201
204
return Err ( anyhow:: anyhow!(
202
205
"Failed to parse command; expected `as <username> <command...>`."
You can’t perform that action at this time.
0 commit comments