Skip to content

fix: keep the org filter when a repo is excluded from the search - #187

Open
davinkevin wants to merge 1 commit into
pvcnt:mainfrom
davinkevin:fix-keep-org-filter-with-excluded-repo
Open

fix: keep the org filter when a repo is excluded from the search#187
davinkevin wants to merge 1 commit into
pvcnt:mainfrom
davinkevin:fix-keep-org-filter-with-excluded-repo

Conversation

@davinkevin

Copy link
Copy Markdown
Contributor

Hi 👋

Excluding a repository from a section makes it return pull requests from the whole of GitHub.

With a connection filtered on the example org, and this query in a section:

is:open draft:false -repo:example/foo

prepareQuery() returns is:open draft:false -repo:example/foo type:pr archived:false sort:updated: the org:example term is gone.

It comes from the workaround for #48: terms with the org qualifier are dropped as soon as the query has a repo one, but has() only looks at the qualifier and never at the exclusion flag, so -repo: takes that path as well. Only a positive repo: restricts the search to a set of repositories and should replace org:, an excluded one should not — GitHub handles org:x -repo:x/y just fine.

I gave has() an optional exclude option instead of changing its default behaviour, so the other call site (has("archived")) keeps working as before. The mixed case repo:example/foo -repo:example/bar still drops the org filter.

Tests added for both cases.

Terms with an excluded "repo" qualifier were handled like positive ones,
which dropped the "org" qualifier and turned the query into a search over
the whole of GitHub.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant