diff --git a/src/frontend/app/diffusions/diffusions-list.component.ts b/src/frontend/app/diffusions/diffusions-list.component.ts index aaae624ae4e62606b54adeb550283a9650d845ee..decba033cd556878e27430f7315ee0fa58bd7730 100644 --- a/src/frontend/app/diffusions/diffusions-list.component.ts +++ b/src/frontend/app/diffusions/diffusions-list.component.ts @@ -388,17 +388,12 @@ export class DiffusionsListComponent implements OnInit { } changeRole(user: any, oldRole: any, newRole: any) { - //if (this.diffFormControl !== undefined) { if (newRole.id === 'dest') { this.switchUserWithOldDest(user, oldRole); } else { this.changeUserRole(user, oldRole, newRole); } - if (this.diffFormControl !== undefined) { - this.setFormValues(); - } - //} } switchMode() { @@ -435,6 +430,7 @@ export class DiffusionsListComponent implements OnInit { indexFound = this.diffList[oldRole.id].items.map((item: any) => item.id).indexOf(destUser.id); if (indexFound === -1) { + destUser.item_mode = oldRole.id; this.diffList[oldRole.id].items.push(destUser); } } @@ -443,8 +439,12 @@ export class DiffusionsListComponent implements OnInit { if (indexFound > -1) { this.diffList[oldRole.id].items.splice(indexFound, 1); } + user.item_mode = 'dest'; this.diffList['dest'].items[0] = user; + if (this.diffFormControl !== undefined) { + this.setFormValues(); + } // TO CHANGE DESTINATION IN INDEXING FORM if (this.triggerEvent !== undefined) { this.triggerEvent.emit(allowedEntitiesIds); @@ -466,6 +466,9 @@ export class DiffusionsListComponent implements OnInit { } user.item_mode = newRole.id; this.diffList[newRole.id].items.push(user); + if (this.diffFormControl !== undefined) { + this.setFormValues(); + } } setFormValues() { @@ -475,7 +478,7 @@ export class DiffusionsListComponent implements OnInit { this.diffList[role].items.map((item: any) => { return { id: item.item_id, - mode: item.item_mode, + mode: role, type: item.item_type === 'user_id' ? 'user' : 'entity' } })