@@ -22,10 +22,10 @@ use crate::{git2_ops::GitRepo, state::write_file_secure};
2222pub struct GitHubConfig {
2323 pub token : String ,
2424 pub api_base : String ,
25- /// GitHub usernames whose PRs should be synced .
26- /// When non-empty, only PRs from these authors will be synced .
27- /// When empty, PRs from forks will be excluded .
28- pub sync_authors : Vec < String > ,
25+ /// GitHub usernames whose PRs should be displayed prominently in status .
26+ /// When non-empty, PRs from other authors will be shown dimmed/collapsed .
27+ /// No longer used for filtering during sync .
28+ pub display_authors : Vec < String > ,
2929}
3030
3131/// Repository identification (owner/repo extracted from remote URL)
@@ -241,7 +241,7 @@ pub struct CachedPrUser {
241241/// Result from list_prs operations, containing both filtered PRs and all author mappings
242242#[ derive( Debug ) ]
243243pub struct PrListResult {
244- /// Filtered PRs (by sync_authors or fork filter)
244+ /// PRs filtered to exclude forks
245245 pub prs : std:: collections:: HashMap < String , PullRequest > ,
246246 /// All branch -> author mappings (before filtering)
247247 pub all_authors : std:: collections:: HashMap < String , String > ,
@@ -303,7 +303,7 @@ impl GitHubClient {
303303
304304 /// Load config from environment/git config/config file
305305 pub fn from_env ( repo_id : & RepoIdentifier ) -> Result < Self , GitHubError > {
306- let ( token, sync_authors ) = find_github_config ( & repo_id. host ) ?;
306+ let ( token, display_authors ) = find_github_config ( & repo_id. host ) ?;
307307 let api_base = if repo_id. host == "github.com" {
308308 "https://api.github.com" . to_string ( )
309309 } else {
@@ -312,7 +312,7 @@ impl GitHubClient {
312312 Ok ( Self :: new ( GitHubConfig {
313313 token,
314314 api_base,
315- sync_authors ,
315+ display_authors ,
316316 } ) )
317317 }
318318
@@ -449,25 +449,11 @@ impl GitHubClient {
449449 . map ( |pr| ( pr. head . ref_name . clone ( ) , pr. user . login . clone ( ) ) )
450450 . collect ( ) ;
451451
452- // Build map of head branch name -> PR, filtering out irrelevant PRs
452+ // Build map of head branch name -> PR, filtering out PRs from forks
453453 let prs: std:: collections:: HashMap < String , PullRequest > = all_prs
454454 . into_iter ( )
455455 . filter ( |pr| {
456- // If sync_authors is configured, only include PRs from those authors
457- if !self . config . sync_authors . is_empty ( ) {
458- let included = self . config . sync_authors . contains ( & pr. user . login ) ;
459- if !included {
460- tracing:: debug!(
461- "Skipping PR #{} '{}' - author '{}' not in sync_authors" ,
462- pr. number,
463- pr. title,
464- pr. user. login
465- ) ;
466- }
467- return included;
468- }
469-
470- // Otherwise, filter out PRs from forks
456+ // Filter out PRs from forks (we can't track remote branches for forks)
471457 if pr. is_from_fork ( ) {
472458 tracing:: debug!(
473459 "Skipping PR #{} '{}' - from fork (head: {:?})" ,
@@ -477,7 +463,6 @@ impl GitHubClient {
477463 ) ;
478464 return false ;
479465 }
480-
481466 true
482467 } )
483468 . map ( |pr| ( pr. head . ref_name . clone ( ) , pr) )
@@ -568,14 +553,9 @@ impl GitHubClient {
568553 Ok ( PrListResult { prs, all_authors } )
569554 }
570555
571- /// Check if a PR should be included based on sync_authors and fork filtering
556+ /// Check if a PR should be included based on fork filtering
572557 fn should_include_pr ( & self , pr : & PullRequest ) -> bool {
573- // If sync_authors is configured, only include PRs from those authors
574- if !self . config . sync_authors . is_empty ( ) {
575- return self . config . sync_authors . contains ( & pr. user . login ) ;
576- }
577-
578- // Otherwise, filter out PRs from forks
558+ // Filter out PRs from forks (we can't track remote branches for forks)
579559 !pr. is_from_fork ( )
580560 }
581561
@@ -774,28 +754,36 @@ fn load_github_config_file() -> Option<GitHubConfigFile> {
774754 serde_yaml:: from_str ( & contents) . ok ( )
775755}
776756
757+ /// Load display_authors from the GitHub config file.
758+ /// Returns an empty vec if the config file doesn't exist or has no display_authors.
759+ pub fn load_display_authors ( ) -> Vec < String > {
760+ load_github_config_file ( )
761+ . map ( |c| c. display_authors )
762+ . unwrap_or_default ( )
763+ }
764+
777765/// Find GitHub token and config from various sources
778766fn find_github_config ( host : & str ) -> Result < ( String , Vec < String > ) , GitHubError > {
779767 let config_file = load_github_config_file ( ) ;
780- let sync_authors = config_file
768+ let display_authors = config_file
781769 . as_ref ( )
782- . map ( |c| c. sync_authors . clone ( ) )
770+ . map ( |c| c. display_authors . clone ( ) )
783771 . unwrap_or_default ( ) ;
784772
785773 // 1. Check GITHUB_TOKEN env var
786774 if let Ok ( token) = std:: env:: var ( "GITHUB_TOKEN" )
787775 && !token. is_empty ( )
788776 {
789777 tracing:: debug!( "Using GitHub token from GITHUB_TOKEN env var" ) ;
790- return Ok ( ( token, sync_authors ) ) ;
778+ return Ok ( ( token, display_authors ) ) ;
791779 }
792780
793781 // 2. Check GH_TOKEN env var (used by gh CLI)
794782 if let Ok ( token) = std:: env:: var ( "GH_TOKEN" )
795783 && !token. is_empty ( )
796784 {
797785 tracing:: debug!( "Using GitHub token from GH_TOKEN env var" ) ;
798- return Ok ( ( token, sync_authors ) ) ;
786+ return Ok ( ( token, display_authors ) ) ;
799787 }
800788
801789 // 3. Check git config github.token
@@ -807,7 +795,7 @@ fn find_github_config(host: &str) -> Result<(String, Vec<String>), GitHubError>
807795 let token = String :: from_utf8_lossy ( & output. stdout ) . trim ( ) . to_string ( ) ;
808796 if !token. is_empty ( ) {
809797 tracing:: debug!( "Using GitHub token from git config" ) ;
810- return Ok ( ( token, sync_authors ) ) ;
798+ return Ok ( ( token, display_authors ) ) ;
811799 }
812800 }
813801
@@ -818,12 +806,12 @@ fn find_github_config(host: &str) -> Result<(String, Vec<String>), GitHubError>
818806 && let Some ( token) = hosts. get ( host)
819807 {
820808 tracing:: debug!( "Using GitHub token from config file (host-specific)" ) ;
821- return Ok ( ( token. clone ( ) , sync_authors ) ) ;
809+ return Ok ( ( token. clone ( ) , display_authors ) ) ;
822810 }
823811 // Fall back to default token
824812 if let Some ( token) = config. default_token {
825813 tracing:: debug!( "Using GitHub token from config file (default)" ) ;
826- return Ok ( ( token, sync_authors ) ) ;
814+ return Ok ( ( token, display_authors ) ) ;
827815 }
828816 }
829817
@@ -835,11 +823,10 @@ fn find_github_config(host: &str) -> Result<(String, Vec<String>), GitHubError>
835823struct GitHubConfigFile {
836824 default_token : Option < String > ,
837825 hosts : Option < std:: collections:: HashMap < String , String > > ,
838- /// GitHub usernames whose PRs should be synced.
839- /// When set, only PRs from these authors will be synced.
840- /// When empty/unset, PRs from forks will be excluded.
826+ /// GitHub usernames whose PRs should be displayed prominently in status.
827+ /// When set, PRs from other authors will be shown dimmed/collapsed.
841828 #[ serde( default ) ]
842- sync_authors : Vec < String > ,
829+ display_authors : Vec < String > ,
843830}
844831
845832/// Get path to GitHub config file
@@ -857,7 +844,7 @@ pub fn save_github_token(token: &str) -> Result<()> {
857844 . place_config_file ( "github.yaml" )
858845 . context ( "Failed to create config directory" ) ?;
859846
860- // Load existing config to preserve other settings (like sync_authors )
847+ // Load existing config to preserve other settings (like display_authors )
861848 let mut config = load_github_config_file ( ) . unwrap_or_default ( ) ;
862849 config. default_token = Some ( token. to_string ( ) ) ;
863850
0 commit comments