@@ -49,6 +49,7 @@ import {
4949 AcceptRequestAccess ,
5050 AddContributor ,
5151 BulkAddContributors ,
52+ BulkAddContributorsFromParentProject ,
5253 BulkUpdateContributors ,
5354 ContributorsSelectors ,
5455 CreateViewOnlyLink ,
@@ -159,6 +160,7 @@ export class ContributorsComponent implements OnInit {
159160 deleteContributor : DeleteContributor ,
160161 bulkUpdateContributors : BulkUpdateContributors ,
161162 bulkAddContributors : BulkAddContributors ,
163+ bulkAddContributorsFromParentProject : BulkAddContributorsFromParentProject ,
162164 addContributor : AddContributor ,
163165 createViewOnlyLink : CreateViewOnlyLink ,
164166 deleteViewOnlyLink : DeleteViewOnlyLink ,
@@ -246,17 +248,19 @@ export class ContributorsComponent implements OnInit {
246248
247249 openAddContributorDialog ( ) {
248250 const addedContributorIds = this . initialContributors ( ) . map ( ( x ) => x . userId ) ;
249- const rootParentId = this . resourceDetails ( ) . rootParentId ?? this . resourceId ( ) ;
251+ const resourceDetails = this . resourceDetails ( ) ;
252+ const resourceId = this . resourceId ( ) ;
253+ const rootParentId = resourceDetails . rootParentId ?? resourceId ;
250254
251255 this . loaderService . show ( ) ;
252256
253257 this . actions
254- . getResourceWithChildren ( rootParentId , this . resourceId ( ) , this . resourceType ( ) )
258+ . getResourceWithChildren ( rootParentId , resourceId , this . resourceType ( ) )
255259 . pipe ( takeUntilDestroyed ( this . destroyRef ) )
256260 . subscribe ( ( ) => {
257261 this . loaderService . hide ( ) ;
258262
259- const components = this . mapNodesToComponentCheckboxItems ( this . resourceChildren ( ) , this . resourceId ( ) ) ;
263+ const components = this . mapNodesToComponentCheckboxItems ( this . resourceChildren ( ) , resourceId ) ;
260264
261265 this . customDialogService
262266 . open ( AddContributorDialogComponent , {
@@ -265,15 +269,22 @@ export class ContributorsComponent implements OnInit {
265269 data : {
266270 addedContributorIds,
267271 components,
268- resourceName : this . resourceDetails ( ) . title ,
272+ resourceName : resourceDetails . title ,
273+ parentResourceName : resourceDetails . parent ?. title ,
274+ allowAddingContributorsFromParentProject :
275+ this . resourceType ( ) === ResourceType . Project &&
276+ resourceDetails . rootParentId &&
277+ resourceDetails . rootParentId !== resourceId ,
269278 } ,
270279 } )
271280 . onClose . pipe (
272281 filter ( ( res : ContributorDialogAddModel ) => ! ! res ) ,
273282 takeUntilDestroyed ( this . destroyRef )
274283 )
275284 . subscribe ( ( res : ContributorDialogAddModel ) => {
276- if ( res . type === AddContributorType . Unregistered ) {
285+ if ( res . type === AddContributorType . ParentProject ) {
286+ this . addContributorsFromParentProjectToComponents ( ) ;
287+ } else if ( res . type === AddContributorType . Unregistered ) {
277288 this . openAddUnregisteredContributorDialog ( ) ;
278289 } else {
279290 this . addContributorsToComponents ( res ) ;
@@ -303,6 +314,13 @@ export class ContributorsComponent implements OnInit {
303314 . subscribe ( ( ) => this . toastService . showSuccess ( 'project.contributors.toastMessages.multipleAddSuccessMessage' ) ) ;
304315 }
305316
317+ private addContributorsFromParentProjectToComponents ( ) : void {
318+ this . actions
319+ . bulkAddContributorsFromParentProject ( this . resourceId ( ) , this . resourceType ( ) )
320+ . pipe ( takeUntilDestroyed ( this . destroyRef ) )
321+ . subscribe ( ( ) => this . toastService . showSuccess ( 'project.contributors.toastMessages.multipleAddSuccessMessage' ) ) ;
322+ }
323+
306324 openAddUnregisteredContributorDialog ( ) {
307325 this . customDialogService
308326 . open ( AddUnregisteredContributorDialogComponent , {
0 commit comments