Skip to content

Commit 8d0f4c5

Browse files
committed
Check comment locations before merging them from a fork
1 parent 38beeb6 commit 8d0f4c5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

fork/fork.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,20 @@ func (fork *Fork) filterOwnerComments(repo repository.Repo) error {
472472
if err != nil {
473473
return false, nil
474474
}
475-
// TODO(ojarjur): Also support pulling comment edits from forks
476-
if c.Original == "" && fork.isOwner(c.Author) {
477-
return true, nil
475+
if c.Original != "" {
476+
// Ignore comment edits.
477+
// TODO(ojarjur): Also support pulling comment edits from forks
478+
return false, nil
478479
}
479-
return false, nil
480+
if !fork.isOwner(c.Author) {
481+
// Ignore comments that aren't from the repository owner.
482+
return false, nil
483+
}
484+
if c.Location != nil && c.Location.Check(repo) != nil {
485+
// Ignore comments at non-existant locations.
486+
return false, nil
487+
}
488+
return true, nil
480489
})
481490
}
482491

0 commit comments

Comments
 (0)