Skip to content

Commit a3b1131

Browse files
committed
Adds launchpad.ignoredOrganizations setting
Adds ignored repos & orgs to the actual GitHub queries
1 parent 26e42b9 commit a3b1131

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
99
### Added
1010

1111
- Adds _Search for Commits within Selection_ command to the editor context menu when there is a selection
12+
- Adds a `gitlens.launchpad.ignoredOrganizations` setting to specify an array of organizations (or users) to ignore in the _Launchpad_
1213

1314
### Changed
1415

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,6 +2961,16 @@
29612961
"scope": "window",
29622962
"order": 10
29632963
},
2964+
"gitlens.launchpad.ignoredOrganizations": {
2965+
"type": "array",
2966+
"default": [],
2967+
"items": {
2968+
"type": "string"
2969+
},
2970+
"markdownDescription": "Specifies the organizations to ignore in the _Launchpad_",
2971+
"scope": "window",
2972+
"order": 11
2973+
},
29642974
"gitlens.launchpad.staleThreshold": {
29652975
"type": [
29662976
"number",

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export interface Config {
9090
};
9191
readonly launchpad: {
9292
readonly allowMultiple: boolean;
93+
readonly ignoredOrganizations: string[];
9394
readonly ignoredRepositories: string[];
9495
readonly staleThreshold: number | null;
9596
readonly indicator: {

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,7 @@ export type TelemetryEvents = {
13111311
/** Sent when the user changes launchpad configuration settings */
13121312
'launchpad/configurationChanged': {
13131313
'config.launchpad.staleThreshold': number | null;
1314+
'config.launchpad.ignoredOrganizations': number;
13141315
'config.launchpad.ignoredRepositories': number;
13151316
'config.launchpad.indicator.enabled': boolean;
13161317
'config.launchpad.indicator.openInEditor': boolean;

src/plus/focus/focusProvider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ export class FocusProvider implements Disposable {
792792
const cfg = configuration.get('launchpad');
793793
this.container.telemetry.sendEvent('launchpad/configurationChanged', {
794794
'config.launchpad.staleThreshold': cfg.staleThreshold,
795+
'config.launchpad.ignoredOrganizations': cfg.ignoredOrganizations?.length ?? 0,
795796
'config.launchpad.ignoredRepositories': cfg.ignoredRepositories?.length ?? 0,
796797
'config.launchpad.indicator.enabled': cfg.indicator.enabled,
797798
'config.launchpad.indicator.openInEditor': cfg.indicator.openInEditor,
@@ -804,6 +805,7 @@ export class FocusProvider implements Disposable {
804805
});
805806

806807
if (
808+
configuration.changed(e, 'launchpad.ignoredOrganizations') ||
807809
configuration.changed(e, 'launchpad.ignoredRepositories') ||
808810
configuration.changed(e, 'launchpad.staleThreshold')
809811
) {

src/plus/integrations/providers/github/github.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,17 +2866,28 @@ export class GitHubApi implements Disposable {
28662866
search += ` user:${options.user}`;
28672867
}
28682868

2869-
if (options?.repos != null && options.repos.length > 0) {
2870-
const repo = ' repo:';
2871-
search += `${repo}${options.repos.join(repo)}`;
2869+
if (options?.repos?.length) {
2870+
search += ` repo:${options.repos.join(' repo:')}`;
2871+
}
2872+
2873+
// Hack for now, ultimately this should be passed in
2874+
const ignoredRepos = configuration.get('launchpad.ignoredRepositories') ?? [];
2875+
if (ignoredRepos.length) {
2876+
search += ` -repo:${ignoredRepos.join(' -repo:')}`;
2877+
}
2878+
2879+
// Hack for now, ultimately this should be passed in
2880+
const ignoredOrgs = configuration.get('launchpad.ignoredOrganizations') ?? [];
2881+
if (ignoredOrgs.length) {
2882+
search += ` -org:${ignoredOrgs.join(' -org:')}`;
28722883
}
28732884

28742885
const rsp = await this.graphql<SearchResult>(
28752886
provider,
28762887
token,
28772888
query,
28782889
{
2879-
search: `${search} is:pr is:open archived:false involves:@me`.trim(),
2890+
search: `is:open is:pr involves:@me archived:false ${search}`.trim(),
28802891
baseUrl: options?.baseUrl,
28812892
avatarSize: options?.avatarSize,
28822893
},

0 commit comments

Comments
 (0)