Skip to content

Commit 37ac449

Browse files
authored
Merge pull request DSpace#1848 from atmire/w2p-94485_Fix-regressions
Regression fixes
2 parents 001d6dc + b9ac08e commit 37ac449

7 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/app/core/auth/auth-request.service.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ describe(`AuthRequestService`, () => {
111111
body: undefined,
112112
options,
113113
}));
114-
expect((service as any).fetchRequest).toHaveBeenCalledWith(requestID);
115114
});
116115
});
117116
});
@@ -151,7 +150,6 @@ describe(`AuthRequestService`, () => {
151150
body: { content: 'something' },
152151
options,
153152
}));
154-
expect((service as any).fetchRequest).toHaveBeenCalledWith(requestID);
155153
});
156154
});
157155
});

src/app/core/auth/auth-request.service.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export abstract class AuthRequestService {
5858
public postToEndpoint(method: string, body?: any, options?: HttpOptions): Observable<RemoteData<AuthStatus>> {
5959
const requestId = this.requestService.generateRequestId();
6060

61-
this.halService.getEndpoint(this.linkName).pipe(
61+
const endpoint$ = this.halService.getEndpoint(this.linkName);
62+
63+
endpoint$.pipe(
6264
filter((href: string) => isNotEmpty(href)),
6365
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
6466
distinctUntilChanged(),
@@ -68,7 +70,9 @@ export abstract class AuthRequestService {
6870
this.requestService.send(request);
6971
});
7072

71-
return this.fetchRequest(requestId);
73+
return endpoint$.pipe(
74+
switchMap(() => this.fetchRequest(requestId)),
75+
);
7276
}
7377

7478
/**
@@ -79,7 +83,9 @@ export abstract class AuthRequestService {
7983
public getRequest(method: string, options?: HttpOptions, ...linksToFollow: FollowLinkConfig<any>[]): Observable<RemoteData<AuthStatus>> {
8084
const requestId = this.requestService.generateRequestId();
8185

82-
this.halService.getEndpoint(this.linkName).pipe(
86+
const endpoint$ = this.halService.getEndpoint(this.linkName);
87+
88+
endpoint$.pipe(
8389
filter((href: string) => isNotEmpty(href)),
8490
map((endpointURL) => this.getEndpointByMethod(endpointURL, method, ...linksToFollow)),
8591
distinctUntilChanged(),
@@ -89,7 +95,9 @@ export abstract class AuthRequestService {
8995
this.requestService.send(request);
9096
});
9197

92-
return this.fetchRequest(requestId, ...linksToFollow);
98+
return endpoint$.pipe(
99+
switchMap(() => this.fetchRequest(requestId, ...linksToFollow)),
100+
);
93101
}
94102
/**
95103
* Factory function to create the request object to send. This needs to be a POST client side and

src/app/page-error/themed-page-error.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PageErrorComponent } from './page-error.component';
66
* Themed wrapper for PageErrorComponent
77
*/
88
@Component({
9-
selector: 'ds-themed-search-page',
9+
selector: 'ds-themed-page-error',
1010
styleUrls: [],
1111
templateUrl: '../shared/theme-support/themed.component.html',
1212
})

src/app/page-internal-server-error/themed-page-internal-server-error.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PageInternalServerErrorComponent } from './page-internal-server-error.c
66
* Themed wrapper for PageInternalServerErrorComponent
77
*/
88
@Component({
9-
selector: 'ds-themed-search-page',
9+
selector: 'ds-themed-page-internal-server-error',
1010
styleUrls: [],
1111
templateUrl: '../shared/theme-support/themed.component.html',
1212
})

src/app/pagenotfound/themed-pagenotfound.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PageNotFoundComponent } from './pagenotfound.component';
66
* Themed wrapper for PageNotFoundComponent
77
*/
88
@Component({
9-
selector: 'ds-themed-search-page',
9+
selector: 'ds-themed-pagenotfound',
1010
styleUrls: [],
1111
templateUrl: '../shared/theme-support/themed.component.html',
1212
})

src/app/shared/theme-support/theme.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ describe('ThemeService', () => {
413413
link.setAttribute('rel', 'stylesheet');
414414
link.setAttribute('type', 'text/css');
415415
link.setAttribute('class', 'theme-css');
416-
link.setAttribute('href', '/custom-theme.css');
416+
link.setAttribute('href', 'custom-theme.css');
417417

418418
expect(headSpy.appendChild).toHaveBeenCalledWith(link);
419419
});

src/app/shared/theme-support/theme.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class ThemeService {
182182
link.setAttribute('rel', 'stylesheet');
183183
link.setAttribute('type', 'text/css');
184184
link.setAttribute('class', 'theme-css');
185-
link.setAttribute('href', `/${encodeURIComponent(themeName)}-theme.css`);
185+
link.setAttribute('href', `${encodeURIComponent(themeName)}-theme.css`);
186186
// wait for the new css to download before removing the old one to prevent a
187187
// flash of unstyled content
188188
link.onload = () => {

0 commit comments

Comments
 (0)