diff --git a/src/app/shared/rss-feed/rss.component.spec.ts b/src/app/shared/rss-feed/rss.component.spec.ts index fd7f2c53216..61b54a11251 100644 --- a/src/app/shared/rss-feed/rss.component.spec.ts +++ b/src/app/shared/rss-feed/rss.component.spec.ts @@ -1,5 +1,4 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; import { ConfigurationDataService } from '../../core/data/configuration-data.service'; import { RemoteData } from '../../core/data/remote-data'; import { GroupDataService } from '../../core/eperson/group-data.service'; @@ -23,7 +22,6 @@ import { RouterMock } from '../mocks/router.mock'; describe('RssComponent', () => { let comp: RSSComponent; - let options: SortOptions; let fixture: ComponentFixture; let uuid: string; let query: string; @@ -63,7 +61,6 @@ describe('RssComponent', () => { pageSize: 10, currentPage: 1 }), - sort: new SortOptions('dc.title', SortDirection.ASC), })); groupDataService = jasmine.createSpyObj('groupsDataService', { findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), @@ -88,7 +85,6 @@ describe('RssComponent', () => { })); beforeEach(() => { - options = new SortOptions('dc.title', SortDirection.DESC); uuid = '2cfcf65e-0a51-4bcb-8592-b8db7b064790'; query = 'test'; fixture = TestBed.createComponent(RSSComponent); @@ -96,18 +92,18 @@ describe('RssComponent', () => { }); it('should formulate the correct url given params in url', () => { - const route = comp.formulateRoute(uuid, 'opensearch', options, query); - expect(route).toBe('/opensearch/search?format=atom&scope=2cfcf65e-0a51-4bcb-8592-b8db7b064790&sort=dc.title&sort_direction=DESC&query=test'); + const route = comp.formulateRoute(uuid, 'opensearch/search', query); + expect(route).toBe('/opensearch/search?format=atom&scope=2cfcf65e-0a51-4bcb-8592-b8db7b064790&query=test'); }); it('should skip uuid if its null', () => { - const route = comp.formulateRoute(null, 'opensearch', options, query); - expect(route).toBe('/opensearch/search?format=atom&sort=dc.title&sort_direction=DESC&query=test'); + const route = comp.formulateRoute(null, 'opensearch/search', query); + expect(route).toBe('/opensearch/search?format=atom&query=test'); }); it('should default to query * if none provided', () => { - const route = comp.formulateRoute(null, 'opensearch', options, null); - expect(route).toBe('/opensearch/search?format=atom&sort=dc.title&sort_direction=DESC&query=*'); + const route = comp.formulateRoute(null, 'opensearch/search', null); + expect(route).toBe('/opensearch/search?format=atom&query=*'); }); }); diff --git a/src/app/shared/rss-feed/rss.component.ts b/src/app/shared/rss-feed/rss.component.ts index 3fdb859bdce..8a33aeeb689 100644 --- a/src/app/shared/rss-feed/rss.component.ts +++ b/src/app/shared/rss-feed/rss.component.ts @@ -12,7 +12,6 @@ import { ConfigurationDataService } from '../../core/data/configuration-data.ser import { getFirstCompletedRemoteData } from '../../core/shared/operators'; import { environment } from '../../../../src/environments/environment'; import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service'; -import { SortOptions } from '../../core/cache/models/sort-options.model'; import { PaginationService } from '../../core/pagination/pagination.service'; import { Router } from '@angular/router'; import { map, switchMap } from 'rxjs/operators'; @@ -39,7 +38,6 @@ export class RSSComponent implements OnInit, OnDestroy { uuid: string; configuration$: Observable; - sortOption$: Observable; subs: Subscription[] = []; @@ -93,7 +91,7 @@ export class RSSComponent implements OnInit, OnDestroy { return null; } this.uuid = this.groupDataService.getUUIDFromString(this.router.url); - const route = environment.rest.baseUrl + this.formulateRoute(this.uuid, openSearchUri, searchOptions.sort, searchOptions.query); + const route = environment.rest.baseUrl + this.formulateRoute(this.uuid, openSearchUri, searchOptions.query); this.addLinks(route); this.linkHeadService.addTag({ href: environment.rest.baseUrl + '/' + openSearchUri + '/service', @@ -109,24 +107,20 @@ export class RSSComponent implements OnInit, OnDestroy { * Function created a route given the different params available to opensearch * @param uuid The uuid if a scope is present * @param opensearch openSearch uri - * @param sort The sort options for the opensearch request * @param query The query string that was provided in the search * @returns The combine URL to opensearch */ - formulateRoute(uuid: string, opensearch: string, sort: SortOptions, query: string): string { - let route = 'search?format=atom'; + formulateRoute(uuid: string, opensearch: string, query: string): string { + let route = '?format=atom'; if (uuid) { route += `&scope=${uuid}`; } - if (sort && sort.direction && sort.field && sort.field !== 'id') { - route += `&sort=${sort.field}&sort_direction=${sort.direction}`; - } if (query) { route += `&query=${query}`; } else { route += `&query=*`; } - route = '/' + opensearch + '/' + route; + route = '/' + opensearch + route; return route; }