@@ -141,12 +141,12 @@ func GetPullRequest(ctx context.Context, client *github.Client, cache *lockdown.
141141 }
142142 login := pr .GetUser ().GetLogin ()
143143 if login != "" {
144- info , err := cache .GetRepoAccessInfo (ctx , login , owner , repo )
144+ isSafeContent , err := cache .IsSafeContent (ctx , login , owner , repo )
145145 if err != nil {
146146 return nil , fmt .Errorf ("failed to check content removal: %w" , err )
147147 }
148148
149- if info . ViewerLogin != login && ! info . IsPrivate && ! info . HasPushAccess {
149+ if ! isSafeContent {
150150 return mcp .NewToolResultError ("access to pull request is restricted by lockdown mode" ), nil
151151 }
152152 }
@@ -303,16 +303,11 @@ func GetPullRequestReviewComments(ctx context.Context, client *github.Client, ca
303303 if user == nil {
304304 continue
305305 }
306- info , err := cache .GetRepoAccessInfo (ctx , user .GetLogin (), owner , repo )
306+ isSafeContent , err := cache .IsSafeContent (ctx , user .GetLogin (), owner , repo )
307307 if err != nil {
308308 return mcp .NewToolResultError (fmt .Sprintf ("failed to check lockdown mode: %v" , err )), nil
309309 }
310- // Do not filter content for private repositories or if the comment author is the viewer
311- if info .IsPrivate || info .ViewerLogin == user .GetLogin () {
312- filteredComments = comments
313- break
314- }
315- if info .HasPushAccess {
310+ if ! isSafeContent {
316311 filteredComments = append (filteredComments , comment )
317312 }
318313 }
@@ -354,14 +349,11 @@ func GetPullRequestReviews(ctx context.Context, client *github.Client, cache *lo
354349 for _ , review := range reviews {
355350 login := review .GetUser ().GetLogin ()
356351 if login != "" {
357- info , err := cache .GetRepoAccessInfo (ctx , login , owner , repo )
352+ isSafeContent , err := cache .IsSafeContent (ctx , login , owner , repo )
358353 if err != nil {
359354 return nil , fmt .Errorf ("failed to check lockdown mode: %w" , err )
360355 }
361- if info .IsPrivate || info .ViewerLogin == login {
362- filteredReviews = reviews
363- }
364- if info .HasPushAccess {
356+ if ! isSafeContent {
365357 filteredReviews = append (filteredReviews , review )
366358 }
367359 reviews = filteredReviews
0 commit comments