File tree 1 file changed +15
-1
lines changed
components/server/ee/src/workspace 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -205,13 +205,27 @@ export class WorkspaceFactoryEE extends WorkspaceFactory {
205
205
extensions : config && config . vscode && config . vscode . extensions || [ ]
206
206
}
207
207
208
+ const project = await this . projectDB . findProjectByCloneUrl ( context . prebuiltWorkspace . cloneURL ) ;
209
+ let projectId : string | undefined ;
210
+ // associate with a project, if it's the personal project of the current user
211
+ if ( project ?. userId && project ?. userId === user . id ) {
212
+ projectId = project . id ;
213
+ }
214
+ // associate with a project, if the current user is a team member
215
+ if ( project ?. teamId ) {
216
+ const teams = await this . teamDB . findTeamsByUser ( user . id ) ;
217
+ if ( teams . some ( t => t . id === project ?. teamId ) ) {
218
+ projectId = project . id ;
219
+ }
220
+ }
221
+
208
222
const id = await generateWorkspaceID ( ) ;
209
223
const newWs : Workspace = {
210
224
id,
211
225
type : "regular" ,
212
226
creationTime : new Date ( ) . toISOString ( ) ,
213
227
contextURL : normalizedContextURL ,
214
- projectId : context . prebuiltWorkspace . projectId ,
228
+ projectId,
215
229
description : this . getDescription ( context ) ,
216
230
ownerId : user . id ,
217
231
context : < WorkspaceContext & WithSnapshot & WithPrebuild > {
You can’t perform that action at this time.
0 commit comments