File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
components/server/ee/src/gitlab Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,13 @@ export class GitLabAppSupport {
2222 const api = new Gitlab ( { oauthToken } ) ;
2323
2424 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 ;
2532
2633 // cf. https://docs.gitlab.com/ee/api/projects.html#list-all-projects
2734 // we are listing only those projects with access level of maintainers.
@@ -34,17 +41,20 @@ export class GitLabAppSupport {
3441 const cloneUrl = anyProject . http_url_to_repo as string ;
3542 const updatedAt = anyProject . last_activity_at as string ;
3643 const accountAvatarUrl = anyProject . owner ?. avatar_url as string ;
44+ const account = fullPath . split ( "/" ) [ 0 ] ;
3745
38- result . push ( {
46+ ( account === usersGitLabAccount ? ownersRepos : result ) . push ( {
3947 name : project . name ,
40- account : fullPath . split ( "/" ) [ 0 ] ,
48+ account,
4149 cloneUrl,
4250 updatedAt,
4351 accountAvatarUrl,
4452 // inUse: // todo(at) compute usage via ProjectHooks API
4553 } )
4654 }
4755
56+ // put owner's repos first. the frontend will pick first account to continue with
57+ result . unshift ( ...ownersRepos ) ;
4858 return result ;
4959 }
5060
You can’t perform that action at this time.
0 commit comments