@@ -331,12 +331,13 @@ export class DeatilComponent implements OnInit, OnDestroy {
331331 }
332332 } ) ;
333333
334+ this . isInProfileInfo ( ) ;
335+
334336 this . subscriptions . push ( projectSub$ ) ;
335337 } else if ( this . listType === "program" ) {
336338 const program$ = this . programDataService . program$
337339 . pipe (
338340 filter ( program => ! ! program ) ,
339-
340341 tap ( program => {
341342 if ( program ) {
342343 this . info . set ( program ) ;
@@ -369,17 +370,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
369370 } ,
370371 } ) ;
371372
372- const profileInfoSub$ = this . authService . profile . subscribe ( {
373- next : profile => {
374- this . profile = profile ;
375-
376- if ( this . info ( ) ) {
377- this . isInProject = this . info ( )
378- ?. collaborators . map ( ( person : Collaborator ) => person . userId )
379- . includes ( profile . id ) ;
380- }
381- } ,
382- } ) ;
373+ this . isInProfileInfo ( ) ;
383374
384375 const profileIdDataSub$ = this . profileDataService
385376 . getProfileId ( )
@@ -394,10 +385,26 @@ export class DeatilComponent implements OnInit, OnDestroy {
394385 this . isSubscriptionActive . set ( r . isSubscribed ) ;
395386 } ) ;
396387
397- this . subscriptions . push ( profileDataSub$ , profileIdDataSub$ , profileInfoSub$ ) ;
388+ this . subscriptions . push ( profileDataSub$ , profileIdDataSub$ ) ;
398389 }
399390 }
400391
392+ private isInProfileInfo ( ) : void {
393+ const profileInfoSub$ = this . authService . profile . subscribe ( {
394+ next : profile => {
395+ this . profile = profile ;
396+
397+ if ( this . info ( ) ) {
398+ this . isInProject = this . info ( )
399+ ?. collaborators . map ( ( person : Collaborator ) => person . userId )
400+ . includes ( profile . id ) ;
401+ }
402+ } ,
403+ } ) ;
404+
405+ this . subscriptions . push ( profileInfoSub$ ) ;
406+ }
407+
401408 /**
402409 * Инициализация строки для back компонента в зависимости от типа данных
403410 */
0 commit comments