Skip to content

Commit 9202925

Browse files
committed
Merge branch 'dspace-cris-2024_02_x' into dspace-cris-2025_02_x
# Conflicts: # bitbucket-pipelines.yml
2 parents 76c61e1 + a5dc6f1 commit 9202925

File tree

21 files changed

+211
-33
lines changed

21 files changed

+211
-33
lines changed

bitbucket-pipelines.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ definitions:
299299
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='test--${CLOUDFRONT_NAME}'].Id" --output text)
300300
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
301301

302+
- step: &check-branch-name-allowed
303+
name: Check allowed branch name
304+
image: alpine:latest
305+
script:
306+
- |
307+
if [[ "$BITBUCKET_BRANCH" = "main-cris" ]] || [[ "$BITBUCKET_BRANCH" == dspace-cris-20*_02_x ]] || [[ "$BITBUCKET_BRANCH" == prod/* ]] || [[ "$BITBUCKET_BRANCH" == test/* ]]; then
308+
echo "Branch $BITBUCKET_BRANCH is allowed."
309+
else
310+
echo "This pipeline can only run on main-cris, dspace-cris-20*_02_x, prod/**, or test/**"
311+
exit 1
312+
fi
313+
302314
pipelines:
303315
custom:
304316
e2e-on-custom-backend:
@@ -312,6 +324,12 @@ pipelines:
312324
- step: *build-and-push
313325
- step: *deploy-on-dev
314326
- step: *find-and-invalidate-cloudfront-dev
327+
deploy-on-staging:
328+
- step: *check-branch-name-allowed
329+
- step: *angular-build
330+
- step: *build-and-push
331+
- step: *deploy-on-staging
332+
- step: *find-and-invalidate-cloudfront-staging
315333
turn-on-dev:
316334
- step: *turn-on-dev
317335
turn-on-staging:
@@ -320,11 +338,12 @@ pipelines:
320338
- step: *turn-on-test
321339
branches:
322340
'main-cris':
341+
- step: *check-branch-name-allowed
323342
- step: *preliminary-operation
324343
- step: *angular-build
325344
- parallel: *parallel-run-tests
326-
- step: *build-and-push
327-
'dspace-cris-2025_02_x':
345+
'dspace-cris-20*_02_x':
346+
- step: *check-branch-name-allowed
328347
- step: *preliminary-operation
329348
- step: *angular-build
330349
- parallel: *parallel-run-tests
@@ -334,6 +353,7 @@ pipelines:
334353
- step: *deploy-on-staging
335354
- step: *find-and-invalidate-cloudfront-staging
336355
'prod/**':
356+
- step: *check-branch-name-allowed
337357
- step: *preliminary-operation
338358
- step: *angular-build
339359
- parallel: *parallel-run-tests
@@ -343,6 +363,7 @@ pipelines:
343363
- step: *deploy-on-staging
344364
- step: *find-and-invalidate-cloudfront-staging
345365
'test/**':
366+
- step: *check-branch-name-allowed
346367
- step: *preliminary-operation
347368
- step: *angular-build
348369
- parallel: *parallel-run-tests

src/app/breadcrumbs/breadcrumbs.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
</ng-template>
1515

1616
<ng-template #activeBreadcrumb let-text="text">
17-
<li class="breadcrumb-item active" aria-current="page"><div class="breadcrumb-item-limiter"><span class="text-truncate" [innerHTML]="text | translate"></span></div></li>
17+
<li class="breadcrumb-item active" aria-current="page"><div class="breadcrumb-item-limiter"><span class="text-truncate" [innerHTML]="text | translate | dsEscapeHtml"></span></div></li>
1818
</ng-template>
1919
</ng-container>
20-

src/app/breadcrumbs/breadcrumbs.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
1010
import { TranslateModule } from '@ngx-translate/core';
1111
import { Observable } from 'rxjs';
1212

13+
import { EscapeHtmlPipe } from '../shared/utils/escape-html.pipe';
1314
import { VarDirective } from '../shared/utils/var.directive';
1415
import { Breadcrumb } from './breadcrumb/breadcrumb.model';
1516
import { BreadcrumbsService } from './breadcrumbs.service';
@@ -22,7 +23,7 @@ import { BreadcrumbsService } from './breadcrumbs.service';
2223
templateUrl: './breadcrumbs.component.html',
2324
styleUrls: ['./breadcrumbs.component.scss'],
2425
standalone: true,
25-
imports: [VarDirective, NgIf, NgTemplateOutlet, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule],
26+
imports: [VarDirective, NgIf, NgTemplateOutlet, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule, EscapeHtmlPipe],
2627
})
2728
export class BreadcrumbsComponent {
2829

src/app/core/locale/locale.service.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { PLATFORM_ID } from '@angular/core';
12
import {
23
TestBed,
34
waitForAsync,
@@ -34,6 +35,7 @@ describe('LocaleService test suite', () => {
3435
let routeService;
3536
let document;
3637
let spyOnGetLanguage;
38+
const platformId = 'browser';
3739

3840

3941
const translateServiceStub: any = {
@@ -72,6 +74,7 @@ describe('LocaleService test suite', () => {
7274
{ provide: RouteService, useValue: routeServiceStub },
7375
{ provide: TranslateService, useValue: translateServiceStub },
7476
{ provide: Document, useValue: document },
77+
{ provide: PLATFORM_ID, useValue: platformId },
7578
],
7679
});
7780
}));
@@ -82,7 +85,7 @@ describe('LocaleService test suite', () => {
8285
routeService = TestBed.inject(RouteService);
8386
window = new NativeWindowRef();
8487
document = { documentElement: { lang: 'en' } };
85-
service = new LocaleService(window, cookieService, translateService, authService, routeService, document);
88+
service = new LocaleService(window, cookieService, translateService, authService, routeService, document, platformId);
8689
serviceAsAny = service;
8790
spyOnGet = spyOn(cookieService, 'get');
8891
spyOnSet = spyOn(cookieService, 'set');

src/app/core/locale/locale.service.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import { DOCUMENT } from '@angular/common';
1+
import {
2+
DOCUMENT,
3+
isPlatformBrowser,
4+
} from '@angular/common';
25
import {
36
Inject,
47
Injectable,
8+
PLATFORM_ID,
59
} from '@angular/core';
610
import { TranslateService } from '@ngx-translate/core';
711
import {
@@ -58,6 +62,7 @@ export class LocaleService {
5862
protected authService: AuthService,
5963
protected routeService: RouteService,
6064
@Inject(DOCUMENT) protected document: any,
65+
@Inject(PLATFORM_ID) protected platformId: string,
6166
) {
6267
this.initDefaults();
6368
}
@@ -69,7 +74,9 @@ export class LocaleService {
6974
this.routeService.getQueryParameterValue('lang').subscribe(lang => {
7075
if (lang && this.translate.getLangs().includes(lang)) {
7176
this.setCurrentLanguageCode(lang);
72-
this.routeService.removeQueryParam('lang');
77+
if (isPlatformBrowser(this.platformId)) {
78+
this.routeService.removeQueryParam('lang');
79+
}
7380
}
7481
});
7582
}

src/app/core/locale/server-locale.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { DOCUMENT } from '@angular/common';
22
import {
33
Inject,
44
Injectable,
5+
PLATFORM_ID,
56
} from '@angular/core';
67
import { TranslateService } from '@ngx-translate/core';
78
import {
@@ -44,8 +45,9 @@ export class ServerLocaleService extends LocaleService {
4445
protected authService: AuthService,
4546
protected routeService: RouteService,
4647
@Inject(DOCUMENT) protected document: any,
48+
@Inject(PLATFORM_ID) protected platformId: string,
4749
) {
48-
super(_window, cookie, translate, authService, routeService, document);
50+
super(_window, cookie, translate, authService, routeService, document, platformId);
4951
}
5052

5153
/**

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/longtext/longtext.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="{{field.styleValue}}">
33
<ds-truncatable [id]="truncableId">
44
<ds-truncatable-part [id]="truncableId" [minLines]="3">
5-
<span [innerHTML]="formatText(metadataValue.value)" data-test="formatted-text"></span>
5+
<span [innerHTML]="metadataValue.value | dsEscapeHtml" data-test="formatted-text"></span>
66
</ds-truncatable-part>
77
</ds-truncatable>
88
</div>

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/longtext/longtext.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
22

33
import { TruncatableComponent } from '../../../../../../../shared/truncatable/truncatable.component';
44
import { TruncatablePartComponent } from '../../../../../../../shared/truncatable/truncatable-part/truncatable-part.component';
5+
import { EscapeHtmlPipe } from '../../../../../../../shared/utils/escape-html.pipe';
56
import { RenderingTypeValueModelComponent } from '../rendering-type-value.model';
67

78
/**
@@ -13,7 +14,7 @@ import { RenderingTypeValueModelComponent } from '../rendering-type-value.model'
1314
templateUrl: './longtext.component.html',
1415
styleUrls: ['./longtext.component.scss'],
1516
standalone: true,
16-
imports: [TruncatableComponent, TruncatablePartComponent],
17+
imports: [TruncatableComponent, TruncatablePartComponent, EscapeHtmlPipe],
1718
})
1819
export class LongtextComponent extends RenderingTypeValueModelComponent {
1920

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div [class]="field.styleValue">
2-
<span class="text-value" [attr.lang]="metadataValue.language" [innerHTML]="formatText(metadataValue.value)"></span>
2+
<span class="text-value" [attr.lang]="metadataValue.language" [innerHTML]="metadataValue.value | dsEscapeHtml"></span>
33
</div>

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/text/text.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component } from '@angular/core';
22

3+
import { EscapeHtmlPipe } from '../../../../../../../shared/utils/escape-html.pipe';
34
import { RenderingTypeValueModelComponent } from '../rendering-type-value.model';
45

56
/**
@@ -11,6 +12,9 @@ import { RenderingTypeValueModelComponent } from '../rendering-type-value.model'
1112
templateUrl: './text.component.html',
1213
styleUrls: ['./text.component.scss'],
1314
standalone: true,
15+
imports: [
16+
EscapeHtmlPipe,
17+
],
1418
})
1519
export class TextComponent extends RenderingTypeValueModelComponent {
1620

0 commit comments

Comments
 (0)