diff --git a/src/app/core/feedback/feedback-data.service.spec.ts b/src/app/core/feedback/feedback-data.service.spec.ts index adf42bab63..4bb5e642c2 100644 --- a/src/app/core/feedback/feedback-data.service.spec.ts +++ b/src/app/core/feedback/feedback-data.service.spec.ts @@ -8,7 +8,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s import { HttpClient } from '@angular/common/http'; import { Store } from '@ngrx/store'; import { CoreState } from '../core.reducers'; -import { DSOChangeAnalyzer } from 'src/app/core/data/dso-change-analyzer.service'; +import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; import { Feedback } from './models/feedback.model'; describe('FeedbackDataService', () => { @@ -85,16 +85,4 @@ describe('FeedbackDataService', () => { }); }); - - describe('createFeedback', () => { - beforeEach(() => { - spyOn(service, 'create'); - service.createFeedback(feedbackPayload); - }); - - it('should call postToEndpoint with the payload', () => { - expect(service.create).toHaveBeenCalledWith(feedbackPayload); - }); - }); - }); diff --git a/src/app/core/feedback/feedback-data.service.ts b/src/app/core/feedback/feedback-data.service.ts index dc008e46ea..8f6d4e3ecf 100644 --- a/src/app/core/feedback/feedback-data.service.ts +++ b/src/app/core/feedback/feedback-data.service.ts @@ -3,17 +3,16 @@ import { Observable } from 'rxjs'; import { DataService } from '../data/data.service'; import { Feedback } from './models/feedback.model'; import { FEEDBACK } from './models/feedback.resource-type'; -import { dataService } from 'src/app/core/cache/builders/build-decorators'; -import { RequestService } from 'src/app/core/data/request.service'; -import { RemoteDataBuildService } from 'src/app/core/cache/builders/remote-data-build.service'; +import { dataService } from '../cache/builders/build-decorators'; +import { RequestService } from '../data/request.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { Store } from '@ngrx/store'; -import { ObjectCacheService } from 'src/app/core/cache/object-cache.service'; -import { HALEndpointService } from 'src/app/core/shared/hal-endpoint.service'; -import { NotificationsService } from 'src/app/shared/notifications/notifications.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; import { HttpClient } from '@angular/common/http'; -import { DSOChangeAnalyzer } from 'src/app/core/data/dso-change-analyzer.service'; -import { getFirstSucceededRemoteData, getRemoteDataPayload } from 'src/app/core/shared/operators'; -import { RemoteData } from 'src/app/core/data/remote-data'; +import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; +import { getFirstSucceededRemoteData, getRemoteDataPayload } from '../shared/operators'; /** * Service for checking and managing the feedback @@ -21,41 +20,30 @@ import { RemoteData } from 'src/app/core/data/remote-data'; @Injectable() @dataService(FEEDBACK) export class FeedbackDataService extends DataService { - protected linkPath = 'feedbacks'; + protected linkPath = 'feedbacks'; - constructor( - protected requestService: RequestService, - protected rdbService: RemoteDataBuildService, - protected store: Store, - protected objectCache: ObjectCacheService, - protected halService: HALEndpointService, - protected notificationsService: NotificationsService, - protected http: HttpClient, - protected comparator: DSOChangeAnalyzer, - ) { - super(); - } + constructor( + protected requestService: RequestService, + protected rdbService: RemoteDataBuildService, + protected store: Store, + protected objectCache: ObjectCacheService, + protected halService: HALEndpointService, + protected notificationsService: NotificationsService, + protected http: HttpClient, + protected comparator: DSOChangeAnalyzer, + ) { + super(); + } - /** - * Get feedback from its id - * @param uuid string the id of the feedback - */ - getFeedback(uuid: string): Observable { - return this.findById(uuid).pipe( - getFirstSucceededRemoteData(), - getRemoteDataPayload(), - ); - } - - - /** - * Create feedback - * @param payload feedback to be sent - * @return Observable - * server response - */ - createFeedback(payload: Feedback): Observable> { - return this.create(payload); - } + /** + * Get feedback from its id + * @param uuid string the id of the feedback + */ + getFeedback(uuid: string): Observable { + return this.findById(uuid).pipe( + getFirstSucceededRemoteData(), + getRemoteDataPayload(), + ); + } } diff --git a/src/app/core/feedback/feedback.guard.ts b/src/app/core/feedback/feedback.guard.ts index 2d9f5bdc7a..63353a60ff 100644 --- a/src/app/core/feedback/feedback.guard.ts +++ b/src/app/core/feedback/feedback.guard.ts @@ -1,7 +1,7 @@ import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree } from '@angular/router'; import { Observable } from 'rxjs'; import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service'; -import { FeatureID } from 'src/app/core/data/feature-authorization/feature-id'; +import { FeatureID } from '../data/feature-authorization/feature-id'; import { Injectable } from '@angular/core'; /** @@ -10,11 +10,11 @@ import { Injectable } from '@angular/core'; @Injectable() export class FeedbackGuard implements CanActivate { - constructor(private authorizationService: AuthorizationDataService) { - } + constructor(private authorizationService: AuthorizationDataService) { + } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { - return this.authorizationService.isAuthorized(FeatureID.CanSendFeedback); - } + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { + return this.authorizationService.isAuthorized(FeatureID.CanSendFeedback); + } } diff --git a/src/app/core/feedback/models/feedback.resource-type.ts b/src/app/core/feedback/models/feedback.resource-type.ts index 2b6fa76213..89b28c6cb0 100644 --- a/src/app/core/feedback/models/feedback.resource-type.ts +++ b/src/app/core/feedback/models/feedback.resource-type.ts @@ -6,5 +6,4 @@ import { ResourceType } from '../../shared/resource-type'; * Needs to be in a separate file to prevent circular * dependencies in webpack. */ - export const FEEDBACK = new ResourceType('feedback'); diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.html b/src/app/info/feedback/feedback-form/feedback-form.component.html index a413e10767..4239c9d2b3 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.html +++ b/src/app/info/feedback/feedback-form/feedback-form.component.html @@ -30,7 +30,7 @@
-
+
diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts index b23940537e..ea70fd8c10 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts @@ -3,16 +3,16 @@ import { FeedbackDataService } from '../../../core/feedback/feedback-data.servic import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { FeedbackFormComponent } from './feedback-form.component'; import { TranslateModule } from '@ngx-translate/core'; -import { NO_ERRORS_SCHEMA, DebugElement } from '@angular/core'; +import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; -import { RouteService } from 'src/app/core/services/route.service'; -import { routeServiceStub } from 'src/app/shared/testing/route-service.stub'; +import { RouteService } from '../../../core/services/route.service'; +import { routeServiceStub } from '../../../shared/testing/route-service.stub'; import { FormBuilder } from '@angular/forms'; -import { NotificationsService } from 'src/app/shared/notifications/notifications.service'; -import { NotificationsServiceStub } from 'src/app/shared/testing/notifications-service.stub'; -import { AuthService } from 'src/app/core/auth/auth.service'; -import { AuthServiceStub } from 'src/app/shared/testing/auth-service.stub'; -import { of } from 'rxjs/internal/observable/of'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; +import { AuthService } from '../../../core/auth/auth.service'; +import { AuthServiceStub } from '../../../shared/testing/auth-service.stub'; +import { of } from 'rxjs'; import { Feedback } from '../../../core/feedback/models/feedback.model'; diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.ts b/src/app/info/feedback/feedback-form/feedback-form.component.ts index 552959d7f9..d2fd9f3715 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.ts @@ -2,11 +2,11 @@ import { RemoteData } from '../../../core/data/remote-data'; import { NoContent } from '../../../core/shared/NoContent.model'; import { FeedbackDataService } from '../../../core/feedback/feedback-data.service'; import { Component, OnInit } from '@angular/core'; -import { RouteService } from 'src/app/core/services/route.service'; +import { RouteService } from '../../../core/services/route.service'; import { FormBuilder, Validators } from '@angular/forms'; -import { NotificationsService } from 'src/app/shared/notifications/notifications.service'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { TranslateService } from '@ngx-translate/core'; -import { AuthService } from 'src/app/core/auth/auth.service'; +import { AuthService } from '../../../core/auth/auth.service'; import { EPerson } from '../../../core/eperson/models/eperson.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators';