Skip to content

Commit d72924f

Browse files
fix(request-a-correction): the observable was not initialized properly.
ref: DSC-2525
1 parent 496f8a0 commit d72924f

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/app/shared/context-menu/request-correction/request-correction-menu.component.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Component,
77
Inject,
88
OnDestroy,
9+
OnInit,
910
} from '@angular/core';
1011
import { Router } from '@angular/router';
1112
import {
@@ -24,6 +25,7 @@ import {
2425
} from 'rxjs';
2526
import {
2627
catchError,
28+
shareReplay,
2729
switchMap,
2830
take,
2931
} from 'rxjs/operators';
@@ -58,7 +60,7 @@ import { ContextMenuEntryType } from '../context-menu-entry-type';
5860
BtnDisabledDirective,
5961
],
6062
})
61-
export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent implements OnDestroy {
63+
export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent implements OnInit,OnDestroy {
6264

6365
canCreateCorrection$: Observable<boolean>;
6466
/**
@@ -101,6 +103,14 @@ export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent im
101103
super(injectedContextMenuObject, injectedContextMenuObjectType, ContextMenuEntryType.RequestCorrection);
102104
}
103105

106+
107+
ngOnInit(): void {
108+
this.canCreateCorrection$ = this.notificationService.claimedProfile.pipe(
109+
switchMap(() => this.canCreateCorrection(false)),
110+
shareReplay(1),
111+
);
112+
}
113+
104114
/**
105115
* Open modal
106116
*
@@ -136,10 +146,6 @@ export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent im
136146
this.router.navigate(['workspaceitems', response.id, 'edit']);
137147
}
138148
});
139-
140-
this.canCreateCorrection$ = this.notificationService.claimedProfile.pipe(
141-
switchMap(() => this.canCreateCorrection(false)),
142-
);
143149
}
144150

145151
/**

0 commit comments

Comments
 (0)