Commit f68015db2026d81a50097f75947000733748b83b

Authored by Carlos Purificação
1 parent 479a013a

Fixed merge request issues

src/app/layout/blocks/login-block/login-block.component.spec.ts
@@ -5,7 +5,7 @@ import {ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder'; @@ -5,7 +5,7 @@ import {ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder';
5 import {providers} from 'ng-forward/cjs/testing/providers'; 5 import {providers} from 'ng-forward/cjs/testing/providers';
6 import {LoginBlockComponent} from './login-block.component'; 6 import {LoginBlockComponent} from './login-block.component';
7 import * as helpers from "./../../../../spec/helpers"; 7 import * as helpers from "./../../../../spec/helpers";
8 -import {SessionService, AuthService, AuthController, IAuthEvents, AUTH_EVENTS} from "./../../../login"; 8 +import {SessionService, AuthService, AuthController, AuthEvents} from "./../../../login";
9 9
10 const htmlTemplate: string = '<noosfero-login-block></noosfero-login-block>'; 10 const htmlTemplate: string = '<noosfero-login-block></noosfero-login-block>';
11 11
@@ -92,16 +92,18 @@ describe(&quot;Components&quot;, () =&gt; { @@ -92,16 +92,18 @@ describe(&quot;Components&quot;, () =&gt; {
92 * Simulate the AuthService loginSuccess event 92 * Simulate the AuthService loginSuccess event
93 */ 93 */
94 function simulateLoginEvent() { 94 function simulateLoginEvent() {
95 - let localScope: ng.IScope = helper.component["$scope"];  
96 - localScope.$emit(AUTH_EVENTS.loginSuccess); 95 + let successEvent: string = AuthEvents[AuthEvents.loginSuccess];
  96 +
  97 + (<any>helper.component.authService)[successEvent].next(user);
97 } 98 }
98 99
99 /** 100 /**
100 * Simulate the AuthService logoutSuccess event 101 * Simulate the AuthService logoutSuccess event
101 */ 102 */
102 function simulateLogoutEvent() { 103 function simulateLogoutEvent() {
103 - let localScope: ng.IScope = helper.component["$scope"];  
104 - localScope.$emit(AUTH_EVENTS.logoutSuccess); 104 + let successEvent: string = AuthEvents[AuthEvents.logoutSuccess];
  105 +
  106 + (<any>helper.component.authService)[successEvent].next(user);
105 } 107 }
106 }); 108 });
107 109
src/app/layout/blocks/login-block/login-block.component.ts
1 import {Input, Inject, Component} from "ng-forward"; 1 import {Input, Inject, Component} from "ng-forward";
2 -import {SessionService, AuthService, IAuthEvents, AUTH_EVENTS} from "./../../../login"; 2 +import {SessionService, AuthService, AuthEvents} from "./../../../login";
3 3
4 /** 4 /**
5 * @ngdoc controller 5 * @ngdoc controller
@@ -35,15 +35,15 @@ export class LoginBlockComponent { @@ -35,15 +35,15 @@ export class LoginBlockComponent {
35 constructor( 35 constructor(
36 private session: SessionService, 36 private session: SessionService,
37 private $state: ng.ui.IStateService, 37 private $state: ng.ui.IStateService,
38 - private authService: AuthService, 38 + public authService: AuthService,
39 private $scope: ng.IScope) { 39 private $scope: ng.IScope) {
40 this.currentUser = this.session.currentUser(); 40 this.currentUser = this.session.currentUser();
41 41
42 - this.$scope.$on(AUTH_EVENTS.loginSuccess, () => { 42 + this.authService.subscribe(AuthEvents[AuthEvents.loginSuccess], () => {
43 this.currentUser = this.session.currentUser(); 43 this.currentUser = this.session.currentUser();
44 }); 44 });
45 45
46 - this.$scope.$on(AUTH_EVENTS.logoutSuccess, () => { 46 + this.authService.subscribe(AuthEvents[AuthEvents.logoutSuccess], () => {
47 this.currentUser = this.session.currentUser(); 47 this.currentUser = this.session.currentUser();
48 }); 48 });
49 49
src/lib/ng-noosfero-api/interfaces/person.ts
@@ -6,7 +6,5 @@ namespace noosfero { @@ -6,7 +6,5 @@ namespace noosfero {
6 * A representation of a Person in Noosfero. 6 * A representation of a Person in Noosfero.
7 */ 7 */
8 export interface Person extends Profile { 8 export interface Person extends Profile {
9 - created_at: string;  
10 - identifier: string;  
11 } 9 }
12 } 10 }
13 \ No newline at end of file 11 \ No newline at end of file
src/lib/ng-noosfero-api/interfaces/profile.ts
@@ -22,6 +22,14 @@ namespace noosfero { @@ -22,6 +22,14 @@ namespace noosfero {
22 * @returns {string} The unque identifier for the Profile 22 * @returns {string} The unque identifier for the Profile
23 */ 23 */
24 identifier: string; 24 identifier: string;
  25 +
  26 + /**
  27 + * @ngdoc property
  28 + * @name created_at
  29 + * @propertyOf noofero.Profile
  30 + * @returns {string} The timestamp this object was created
  31 + */
  32 + created_at: string;
25 33
26 /** 34 /**
27 * @ngdoc property 35 * @ngdoc property
src/spec/mocks.ts
@@ -68,6 +68,7 @@ export var mocks: any = { @@ -68,6 +68,7 @@ export var mocks: any = {
68 mocks.authService['logoutSuccess'].event(param); 68 mocks.authService['logoutSuccess'].event(param);
69 } 69 }
70 }, 70 },
  71 + login: () => { },
71 logout: () => { }, 72 logout: () => { },
72 subscribe: (eventName: string, fn: Function) => { 73 subscribe: (eventName: string, fn: Function) => {
73 mocks.authService[eventName].subscribe(fn); 74 mocks.authService[eventName].subscribe(fn);