@@ -73,7 +73,6 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn
73
73
@Input ( ) serviceId : number ;
74
74
@Input ( ) onlyAllowed : boolean ;
75
75
@Input ( ) consentStatuses : ConsentStatus [ ] ;
76
- @Input ( ) includeConsents = false ;
77
76
@Output ( ) loading$ : EventEmitter < Observable < boolean > > = new EventEmitter < Observable < boolean > > ( ) ;
78
77
79
78
consents : Consent [ ] ;
@@ -127,9 +126,6 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn
127
126
if ( ! this . authResolver . isPerunAdminOrObserver ( ) ) {
128
127
this . displayedColumns = this . displayedColumns . filter ( ( column ) => column !== 'id' ) ;
129
128
}
130
- if ( this . includeConsents ) {
131
- this . displayedColumns . push ( 'consentStatus' ) ;
132
- }
133
129
134
130
this . dataSource = new DynamicDataSource < RichUser > (
135
131
this . dynamicPaginatingService ,
@@ -158,6 +154,7 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn
158
154
if ( this . dataSource ) {
159
155
this . child . paginator . pageIndex = 0 ;
160
156
this . loadUsersPage ( ) ;
157
+ this . loadConsents ( ) ;
161
158
}
162
159
}
163
160
@@ -196,7 +193,7 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn
196
193
}
197
194
198
195
loadConsents ( ) : void {
199
- if ( this . includeConsents ) {
196
+ if ( this . displayedColumns . includes ( 'consentStatus' ) ) {
200
197
this . consentService
201
198
. getConsentHubByFacility ( this . facilityId )
202
199
. subscribe ( ( consentHub ) =>
@@ -256,7 +253,7 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn
256
253
257
254
getConsentsForUsers ( users : RichUser [ ] ) : UserWithConsentStatus [ ] | RichUser [ ] {
258
255
const result : UserWithConsentStatus [ ] = [ ] ;
259
- if ( this . includeConsents ) {
256
+ if ( this . displayedColumns . includes ( 'consentStatus' ) ) {
260
257
users . forEach ( ( user ) => {
261
258
const uwc : UserWithConsentStatus = user ;
262
259
uwc . consent = this . translate . instant (
0 commit comments