1
1
import { AccessibleResource , DetailedSiteInfo , OAuthProvider , ProductJira } from './authInfo' ;
2
+
2
3
import { Authenticator } from './authenticator' ;
3
4
import { CredentialManager } from './authStore' ;
4
- import { Container } from '../container' ;
5
5
6
6
export class JiraAuthentictor implements Authenticator {
7
7
public async getOAuthSiteDetails (
8
8
provider : OAuthProvider ,
9
9
userId : string ,
10
10
resources : AccessibleResource [ ] ,
11
11
) : Promise < DetailedSiteInfo [ ] > {
12
+ let newSites : DetailedSiteInfo [ ] = [ ] ;
13
+
12
14
const apiUri = provider === OAuthProvider . JiraCloudStaging ? 'api.stg.atlassian.com' : 'api.atlassian.com' ;
13
15
14
16
//TODO: [VSCODE-505] call serverInfo endpoint when it supports OAuth
15
17
//const baseUrlString = await getJiraCloudBaseUrl(`https://${apiUri}/ex/jira/${newResource.id}/rest/2`, authInfo.access);
16
18
17
- const newSites = resources . map ( async ( r ) => {
19
+ newSites = resources . map ( ( r ) => {
18
20
const credentialId = CredentialManager . generateCredentialId ( ProductJira . key , userId ) ;
19
21
20
- const siteDetails : DetailedSiteInfo = {
22
+ return {
21
23
avatarUrl : r . avatarUrl ,
22
24
baseApiUrl : `https://${ apiUri } /ex/jira/${ r . id } /rest` ,
23
25
baseLinkUrl : r . url ,
@@ -28,16 +30,10 @@ export class JiraAuthentictor implements Authenticator {
28
30
isCloud : true ,
29
31
userId : userId ,
30
32
credentialId : credentialId ,
31
- hasResolutionField : false ,
33
+ hasResolutionField : false , // this field is populated in loginManager.ts
32
34
} ;
33
-
34
- const client = await Container . clientManager . jiraClient ( siteDetails ) ;
35
- const fields = await client . getFields ( ) ;
36
- siteDetails . hasResolutionField = fields . some ( ( f ) => f . id === 'resolution' ) ;
37
-
38
- return siteDetails ;
39
35
} ) ;
40
36
41
- return await Promise . all ( newSites ) ;
37
+ return newSites ;
42
38
}
43
39
}
0 commit comments