Skip to content

Commit 2638c4c

Browse files
ConfusionOrb221Nathan Buckingham
authored andcommitted
140019: Remove entity type prefix, fix issue with opensearch service link having search before service
1 parent 5f432f8 commit 2638c4c

2 files changed

Lines changed: 2 additions & 47 deletions

File tree

src/app/shared/rss-feed/rss.component.spec.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,6 @@ describe('RssComponent', () => {
264264
setupComponent(['html', 'atom', 'rss'], mockCollection);
265265
});
266266

267-
it('should include "Collection" in the rel="alternate" link titles', () => {
268-
const alternateTags = (linkHeadService.addTag as jasmine.Spy).calls.all()
269-
.map(c => c.args[0])
270-
.filter(tag => tag.rel === 'alternate');
271-
for (const tag of alternateTags) {
272-
expect(tag.title).toContain('Collection');
273-
}
274-
});
275-
276267
it('should include the collection name in the rel="alternate" link titles', () => {
277268
const alternateTags = (linkHeadService.addTag as jasmine.Spy).calls.all()
278269
.map(c => c.args[0])
@@ -282,29 +273,11 @@ describe('RssComponent', () => {
282273
}
283274
});
284275

285-
it('should not include "Community" in the rel="alternate" link titles', () => {
286-
const alternateTags = (linkHeadService.addTag as jasmine.Spy).calls.all()
287-
.map(c => c.args[0])
288-
.filter(tag => tag.rel === 'alternate');
289-
for (const tag of alternateTags) {
290-
expect(tag.title).not.toContain('Community');
291-
}
292-
});
293-
294276
describe('when scoped to a community', () => {
295277
beforeEach(() => {
296278
setupComponent(['html', 'atom', 'rss'], mockCommunity);
297279
});
298280

299-
it('should include "Community" in the rel="alternate" link titles', () => {
300-
const alternateTags = (linkHeadService.addTag as jasmine.Spy).calls.all()
301-
.map(c => c.args[0])
302-
.filter(tag => tag.rel === 'alternate');
303-
for (const tag of alternateTags) {
304-
expect(tag.title).toContain('Community');
305-
}
306-
});
307-
308281
it('should include the community name in the rel="alternate" link titles', () => {
309282
const alternateTags = (linkHeadService.addTag as jasmine.Spy).calls.all()
310283
.map(c => c.args[0])
@@ -313,15 +286,6 @@ describe('RssComponent', () => {
313286
expect(tag.title).toContain(mockCommunity.name);
314287
}
315288
});
316-
317-
it('should not include "Collection" in the rel="alternate" link titles', () => {
318-
const alternateTags = (linkHeadService.addTag as jasmine.Spy).calls.all()
319-
.map(c => c.args[0])
320-
.filter(tag => tag.rel === 'alternate');
321-
for (const tag of alternateTags) {
322-
expect(tag.title).not.toContain('Collection');
323-
}
324-
});
325289
});
326290
});
327291
});

src/app/shared/rss-feed/rss.component.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,8 @@ export class RSSComponent implements OnInit, OnDestroy, OnChanges {
267267
getFirstCompletedRemoteData(),
268268
).subscribe((result) => {
269269
let scopeLabel: string;
270-
let objectType = '';
271270
if (result.hasSucceeded) {
272271
scopeLabel = this.dsoNameService.getName(result.payload);
273-
if (result.payload instanceof Collection) {
274-
objectType = 'Collection';
275-
} else if (result.payload instanceof Community) {
276-
objectType = 'Community';
277-
// If its not a collection or community idk how we got here skip this.
278-
} else {
279-
return;
280-
}
281272
} else {
282273
scopeLabel = 'Sitewide';
283274
}
@@ -288,7 +279,7 @@ export class RSSComponent implements OnInit, OnDestroy, OnChanges {
288279
href,
289280
type: OPENSEARCH_FORMAT_MIME_TYPES[format],
290281
rel: 'alternate',
291-
title: `${objectType} ${scopeLabel} ${format.charAt(0).toUpperCase() + format.slice(1)} Feed`.trim(),
282+
title: `${scopeLabel} ${format.charAt(0).toUpperCase() + format.slice(1)} Feed`.trim(),
292283
});
293284
}
294285
});
@@ -307,7 +298,7 @@ export class RSSComponent implements OnInit, OnDestroy, OnChanges {
307298

308299
// Service discovery link uses the primary (first) format
309300
this.linkHeadService.addTag({
310-
href: environment.rest.baseUrl + '/' + opensearch + '/service',
301+
href: environment.rest.baseUrl + '/' + opensearch.split('/search')[0] || '' + '/service',
311302
type: OPENSEARCH_FORMAT_MIME_TYPES[formats[0]],
312303
rel: 'search',
313304
title: 'DSpace OpenSearch',

0 commit comments

Comments
 (0)