44 *--------------------------------------------------------------------------------------------*/
55
66import * as buffer from 'buffer' ;
7- import { ApolloQueryResult , DocumentNode , FetchResult , MutationOptions , NetworkStatus , QueryOptions } from 'apollo-boost' ;
7+ import { ApolloQueryResult , DocumentNode , FetchResult , MutationOptions , NetworkStatus , OperationVariables , QueryOptions } from 'apollo-boost' ;
88import LRUCache from 'lru-cache' ;
99import * as vscode from 'vscode' ;
1010import { AuthenticationError , AuthProvider , GitHubServerType , isSamlError } from '../common/authentication' ;
@@ -172,6 +172,7 @@ export class GitHubRepository extends Disposable {
172172 // eslint-disable-next-line rulesdir/no-any-except-union-method-signature
173173 private _queriesSchema : any ;
174174 private _areQueriesLimited : boolean = false ;
175+ get areQueriesLimited ( ) : boolean { return this . _areQueriesLimited ; }
175176
176177 private _onDidAddPullRequest : vscode . EventEmitter < PullRequestModel > = this . _register ( new vscode . EventEmitter ( ) ) ;
177178 public readonly onDidAddPullRequest : vscode . Event < PullRequestModel > = this . _onDidAddPullRequest . event ;
@@ -277,7 +278,7 @@ export class GitHubRepository extends Disposable {
277278 }
278279 }
279280
280- query = async < T > ( query : QueryOptions , ignoreSamlErrors : boolean = false , legacyFallback ?: { query : DocumentNode } ) : Promise < ApolloQueryResult < T > > => {
281+ query = async < T > ( query : QueryOptions , ignoreSamlErrors : boolean = false , legacyFallback ?: { query : DocumentNode , variables ?: OperationVariables } ) : Promise < ApolloQueryResult < T > > => {
281282 const gql = this . authMatchesServer && this . hub && this . hub . graphql ;
282283 if ( ! gql ) {
283284 const logValue = ( query . query . definitions [ 0 ] as { name : { value : string } | undefined } ) . name ?. value ;
@@ -299,6 +300,7 @@ export class GitHubRepository extends Disposable {
299300 Logger . error ( `Error querying GraphQL API (${ logInfo } ): ${ e . message } ${ gqlErrors ? `. ${ gqlErrors . map ( error => error . extensions ?. code ) . join ( ',' ) } ` : '' } ` , this . id ) ;
300301 if ( legacyFallback ) {
301302 query . query = legacyFallback . query ;
303+ query . variables = legacyFallback . variables ;
302304 return this . query ( query , ignoreSamlErrors ) ;
303305 }
304306
@@ -426,7 +428,7 @@ export class GitHubRepository extends Disposable {
426428 }
427429
428430 if ( oldHub !== this . _hub ) {
429- if ( this . _areQueriesLimited || this . _credentialStore . areScopesOld ( this . remote . authProviderId ) ) {
431+ if ( this . _areQueriesLimited || this . _credentialStore . areScopesOld ( this . remote . authProviderId ) || ( this . remote . authProviderId === AuthProvider . githubEnterprise ) ) {
430432 this . _areQueriesLimited = true ;
431433 this . _queriesSchema = mergeQuerySchemaWithShared ( sharedSchema . default as any , limitedSchema . default as any ) ;
432434 } else {
@@ -1330,6 +1332,14 @@ export class GitHubRepository extends Disposable {
13301332 first : 100 ,
13311333 after : after ,
13321334 } ,
1335+ } , false , {
1336+ query : schema . GetAssignableUsers ,
1337+ variables : {
1338+ owner : remote . owner ,
1339+ name : remote . repositoryName ,
1340+ first : 100 ,
1341+ after : after ,
1342+ }
13331343 } ) ;
13341344
13351345 } else {
0 commit comments