Commit d6d5bae0618bdb6db9420f67597f5fe4168c581e
Committed by
Michel Felipe

1 parent
6fca41b5
Exists in
master
and in
6 other branches
Create interface for AddMemberTask
Showing
3 changed files
with
19 additions
and
8 deletions
Show diff stats
src/app/task/types/add-member/add-member-task-accept-component.spec.ts
... | ... | @@ -31,14 +31,14 @@ describe("Components", () => { |
31 | 31 | it("insert role id in roles list when toggle selection", () => { |
32 | 32 | let role = { id: 1 }; |
33 | 33 | helper.component.toggleSelection(<any>role); |
34 | - expect((<any>helper.component.confirmationTask)['roles']).toEqual([role.id]); | |
34 | + expect(helper.component.confirmationTask.roles).toEqual([role.id]); | |
35 | 35 | }); |
36 | 36 | |
37 | 37 | it("remove role id from roles list when toggle selection", () => { |
38 | 38 | let role = { id: 1 }; |
39 | - (<any>helper.component.confirmationTask)['roles'] = [role.id]; | |
39 | + helper.component.confirmationTask.roles = [role.id]; | |
40 | 40 | helper.component.toggleSelection(<any>role); |
41 | - expect((<any>helper.component.confirmationTask)['roles']).toEqual([]); | |
41 | + expect(helper.component.confirmationTask.roles).toEqual([]); | |
42 | 42 | }); |
43 | 43 | }); |
44 | 44 | }); | ... | ... |
src/app/task/types/add-member/add-member-task-accept.component.ts
... | ... | @@ -9,25 +9,25 @@ import { RoleService } from "../../../../lib/ng-noosfero-api/http/role.service"; |
9 | 9 | export class AddMemberTaskAcceptComponent { |
10 | 10 | |
11 | 11 | @Input() task: noosfero.Task; |
12 | - @Input() confirmationTask: noosfero.Task; | |
12 | + @Input() confirmationTask: noosfero.AddMemberTask; | |
13 | 13 | roles: noosfero.Role[]; |
14 | 14 | |
15 | 15 | constructor(private roleService: RoleService) { } |
16 | 16 | |
17 | 17 | ngOnInit() { |
18 | 18 | if (!this.task.target) return; |
19 | - (<any>this.confirmationTask)['roles'] = []; | |
19 | + this.confirmationTask.roles = []; | |
20 | 20 | this.roleService.getByProfile(this.task.target.id).then((result: noosfero.RestResult<noosfero.Role[]>) => { |
21 | 21 | this.roles = result.data; |
22 | 22 | }); |
23 | 23 | } |
24 | 24 | |
25 | 25 | toggleSelection(role: noosfero.Role) { |
26 | - let index = (<any>this.confirmationTask)['roles'].indexOf(role.id); | |
26 | + let index = this.confirmationTask.roles.indexOf(role.id); | |
27 | 27 | if (index >= 0) { |
28 | - (<any>this.confirmationTask)['roles'].splice(index, 1); | |
28 | + this.confirmationTask.roles.splice(index, 1); | |
29 | 29 | } else { |
30 | - (<any>this.confirmationTask)['roles'].push(role.id); | |
30 | + this.confirmationTask.roles.push(role.id); | |
31 | 31 | } |
32 | 32 | } |
33 | 33 | } | ... | ... |