File tree 1 file changed +12
-2
lines changed
components/server/ee/src/gitlab
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,13 @@ export class GitLabAppSupport {
22
22
const api = new Gitlab ( { oauthToken } ) ;
23
23
24
24
const result : ProviderRepository [ ] = [ ] ;
25
+ const ownersRepos : ProviderRepository [ ] = [ ] ;
26
+
27
+ const identity = params . user . identities . find ( i => i . authProviderId === "Public-GitLab" ) ;
28
+ if ( ! identity ) {
29
+ return result ;
30
+ }
31
+ const usersGitLabAccount = identity . authName ;
25
32
26
33
// cf. https://docs.gitlab.com/ee/api/projects.html#list-all-projects
27
34
// we are listing only those projects with access level of maintainers.
@@ -34,17 +41,20 @@ export class GitLabAppSupport {
34
41
const cloneUrl = anyProject . http_url_to_repo as string ;
35
42
const updatedAt = anyProject . last_activity_at as string ;
36
43
const accountAvatarUrl = anyProject . owner ?. avatar_url as string ;
44
+ const account = fullPath . split ( "/" ) [ 0 ] ;
37
45
38
- result . push ( {
46
+ ( account === usersGitLabAccount ? ownersRepos : result ) . push ( {
39
47
name : project . name ,
40
- account : fullPath . split ( "/" ) [ 0 ] ,
48
+ account,
41
49
cloneUrl,
42
50
updatedAt,
43
51
accountAvatarUrl,
44
52
// inUse: // todo(at) compute usage via ProjectHooks API
45
53
} )
46
54
}
47
55
56
+ // put owner's repos first. the frontend will pick first account to continue with
57
+ result . unshift ( ...ownersRepos ) ;
48
58
return result ;
49
59
}
50
60
You can’t perform that action at this time.
0 commit comments