@@ -27,9 +27,9 @@ import { PaginationToken, generatePaginationToken, parsePaginationToken } from "
2727import  {  ctxUserId  }  from  "../util/request-context" ; 
2828import  {  UserService  }  from  "../user/user-service" ; 
2929import  {  SortOrder  }  from  "@gitpod/public-api/lib/gitpod/v1/sorting_pb" ; 
30- import  {  Project  }  from  "@gitpod/gitpod-protocol" ; 
30+ import  {  CommitContext ,   Project  }  from  "@gitpod/gitpod-protocol" ; 
3131import  {  DeepPartial  }  from  "@gitpod/gitpod-protocol/lib/util/deep-partial" ; 
32- import  {  ContextService  }  from  "../workspace/context-service" ; 
32+ import  {  ContextParser  }  from  "../workspace/context-parser -service" ; 
3333
3434function  buildUpdateObject < T  extends  Record < string ,  any > > ( obj : T ) : Partial < T >  { 
3535    const  update : Partial < T >  =  { } ; 
@@ -56,8 +56,8 @@ export class ConfigurationServiceAPI implements ServiceImpl<typeof Configuration
5656        private  readonly  apiConverter : PublicAPIConverter , 
5757        @inject ( UserService ) 
5858        private  readonly  userService : UserService , 
59-         @inject ( ContextService ) 
60-         private  readonly  contextService :  ContextService , 
59+         @inject ( ContextParser ) 
60+         private  readonly  contextParser :  ContextParser , 
6161    )  { } 
6262
6363    async  createConfiguration ( 
@@ -76,18 +76,20 @@ export class ConfigurationServiceAPI implements ServiceImpl<typeof Configuration
7676            throw  new  ApplicationError ( ErrorCodes . NOT_FOUND ,  "user not found" ) ; 
7777        } 
7878
79-         const  cloneUrl  =  await  this . contextService . parseContextUrlAsCloneUrl ( installer ,  req . cloneUrl ) ; 
80-         if  ( ! cloneUrl )  { 
79+         const  context  =  await  this . contextParser . handle ( { } ,   installer ,  req . cloneUrl ) ; 
80+         if  ( ! CommitContext . is ( context ) )  { 
8181            throw  new  ApplicationError ( ErrorCodes . BAD_REQUEST ,  "clone_url is not valid" ) ; 
8282        } 
8383
84+         // The dashboard, for example, does not provide an explicit name, so we infer it 
85+         const  name  =  req . name  ||  ( context . repository . displayName  ??  context . repository . name ) ; 
86+ 
8487        const  project  =  await  this . projectService . createProject ( 
8588            { 
8689                teamId : req . organizationId , 
87-                 name :  req . name , 
88-                 cloneUrl, 
90+                 name, 
91+                 cloneUrl :  context . repository . cloneUrl , 
8992                appInstallationId : "" , 
90-                 slug : "" , 
9193            } , 
9294            installer , 
9395        ) ; 
0 commit comments