File tree 7 files changed +31
-34
lines changed
7 files changed +31
-34
lines changed Original file line number Diff line number Diff line change 14
14
15
15
16
16
class IdentityFilterSet (FilterSet ):
17
+ ids = CharMultiValueFilter (field_name = "pk" )
17
18
idp_ids = CharMultiValueFilter (field_name = "idp_id" )
18
19
has_idp_id = BooleanFilter (field_name = "idp_id" , lookup_expr = "isnull" , exclude = True )
19
20
member_of_organisations = CharMultiValueFilter (
Original file line number Diff line number Diff line change @@ -106,15 +106,15 @@ export default class CasesIndexController extends TableController {
106
106
return filters ;
107
107
} ) ;
108
108
109
- async fetchAccesses ( idpIds ) {
110
- if ( ! idpIds ) {
109
+ async fetchAccesses ( ids ) {
110
+ if ( ! ids ) {
111
111
return [ ] ;
112
112
}
113
113
114
114
try {
115
115
const accesses = (
116
116
await this . store . query ( "case-access" , {
117
- filter : { idpIds : idpIds . join ( "," ) } ,
117
+ filter : { identityIds : ids . join ( "," ) } ,
118
118
} )
119
119
) . map ( ( access ) => access . get ( "caseId" ) ) ;
120
120
Original file line number Diff line number Diff line change @@ -15,17 +15,7 @@ export default class CaseTransfer extends Component {
15
15
16
16
@action
17
17
selectNewAssignees ( value ) {
18
- this . newAssignees = value . map ( ( assignee ) => assignee . idpId ) ;
19
- }
20
-
21
- idpIdsToIds ( idpIds ) {
22
- const idpIdSet = new Set ( idpIds ) ;
23
- return this . store . peekAll ( "identity" ) . reduce ( ( ids , identity ) => {
24
- if ( idpIdSet . has ( identity . idpId ) ) {
25
- return ids . push ( identity . id ) , ids ;
26
- }
27
- return ids ;
28
- } , [ ] ) ;
18
+ this . newAssignees = value . map ( ( assignee ) => assignee . id ) ;
29
19
}
30
20
31
21
@action
@@ -35,12 +25,12 @@ export default class CaseTransfer extends Component {
35
25
36
26
const body = {
37
27
case_ids : this . args . cases ,
38
- new_assignees : this . idpIdsToIds ( this . newAssignees ) ,
28
+ new_assignees : this . newAssignees ,
39
29
to_remove_assignees : [ ] ,
40
30
} ;
41
31
42
32
if ( this . removeAccess ) {
43
- body . to_remove_assignees = this . idpIdsToIds ( this . args . toRemove ) ;
33
+ body . to_remove_assignees = this . args . toRemove ;
44
34
}
45
35
46
36
const headers = adapter . headers ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export default class FiltersIdentityComponent extends Component {
17
17
: this . args . selected ;
18
18
19
19
return this . identityOptions . value ?. filter ( ( option ) =>
20
- selected . includes ( option . idpId ) ,
20
+ selected . includes ( option . id ) ,
21
21
) ;
22
22
}
23
23
@@ -26,9 +26,9 @@ export default class FiltersIdentityComponent extends Component {
26
26
return [ ] ;
27
27
}
28
28
29
- let idpIds = this . args . selected ;
29
+ let ids = this . args . selected ;
30
30
if ( typeof this . args . selected !== "string" ) {
31
- idpIds = this . args . selected . join ( "," ) ;
31
+ ids = this . args . selected . join ( "," ) ;
32
32
}
33
33
34
34
try {
@@ -37,7 +37,7 @@ export default class FiltersIdentityComponent extends Component {
37
37
"identity" ,
38
38
{
39
39
filter : {
40
- idpIds ,
40
+ ids ,
41
41
} ,
42
42
} ,
43
43
{ adapterOptions : { customEndpoint : "public-identities" } } ,
@@ -66,7 +66,6 @@ export default class FiltersIdentityComponent extends Component {
66
66
filter : {
67
67
search,
68
68
isOrganisation : false ,
69
- has_idp_id : true ,
70
69
} ,
71
70
} ,
72
71
{ adapterOptions : { customEndpoint : "public-identities" } } ,
Original file line number Diff line number Diff line change @@ -133,17 +133,15 @@ export default class IdentityFormComponent extends Component {
133
133
try {
134
134
let message = this . intl . t ( "components.identity-form.delete.prompt" ) ;
135
135
136
- if ( this . args . identity . idpId ) {
137
- const accesses = yield this . store . query ( "case-access" , {
138
- filter : { idpIds : this . args . identity . idpId } ,
139
- } ) ;
140
- message += `\n${ this . intl . t (
141
- "components.identity-form.delete.promptInfo" ,
142
- {
143
- caseAmount : accesses . length ,
144
- } ,
145
- ) } `;
146
- }
136
+ const accesses = yield this . store . query ( "case-access" , {
137
+ filter : { identityIds : this . args . identity . id } ,
138
+ } ) ;
139
+ message += `\n${ this . intl . t (
140
+ "components.identity-form.delete.promptInfo" ,
141
+ {
142
+ caseAmount : accesses . length ,
143
+ } ,
144
+ ) } `;
147
145
148
146
const modal = UIkit . modal . confirm ( message ) ;
149
147
// We need to add css white-space rule for the new line
Original file line number Diff line number Diff line change @@ -65,8 +65,17 @@ export default class WorkItemsIndexController extends TableController {
65
65
}
66
66
67
67
if ( this . filters . identities ) {
68
+ const idSet = new Set ( arrayFromString ( this . filters . identities ) ) ;
69
+ const assignedUsers = this . store
70
+ . peekAll ( "identity" )
71
+ . reduce ( ( ids , identity ) => {
72
+ if ( idSet . has ( identity . id ) ) {
73
+ return ids . push ( identity . idpId ) , ids ;
74
+ }
75
+ return ids ;
76
+ } , [ ] ) ;
68
77
filter . push ( {
69
- assignedUsers : arrayFromString ( this . filters . identities ) ,
78
+ assignedUsers,
70
79
invert : Boolean ( this . invertedFilters . identities ) ,
71
80
} ) ;
72
81
}
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export default class TableController extends Controller {
61
61
if ( Array . isArray ( eventOrValue ) ) {
62
62
this . filters [ type ] = stringFromArray (
63
63
eventOrValue ,
64
- type === "identities" ? "idpId " : "value" ,
64
+ type === "identities" ? "id " : "value" ,
65
65
) ;
66
66
} else {
67
67
this . filters [ type ] = eventOrValue . target ?. value ?? eventOrValue ;
You can’t perform that action at this time.
0 commit comments