Skip to content

Commit 6411eda

Browse files
Mattia VianelliAndrea Barbasso
authored andcommitted
Merged in task/dspace-cris-2024_02_x/DSC-2650 (pull request DSpace#4298)
DSC-2650 Removed duplicated text and last updated date text, fixed repository name retrieval Approved-by: Andrea Barbasso
2 parents 6a43cea + 8cedef9 commit 6411eda

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ <h2 class="mb-3">{{ 'info.end-user-agreement.head' | translate }}</h2>
88

99
<ng-template #defaultContent>
1010
<div class="default-agreement-content">
11-
<h1>{{ 'info.end-user-agreement.head' | translate }}</h1>
12-
<p><em>Last updated May 4, 2023</em></p>
1311

1412
<h2>Agreement to terms</h2>
15-
<p>These Terms of Use constitute a legally binding agreement made between you, whether personally or on behalf of an entity ("you") and {{ 'repository.title' | translate }} ("Company", "we", "us", or "our"), concerning your access to and use of this website as well as any other media form, media channel, mobile website or mobile application related, linked, or otherwise connected thereto (collectively, the "Site"). You agree that by accessing the Site, you have read, understood, and agreed to be bound by all of these Terms of Use and any future amendments thereof.</p>
13+
<p>These Terms of Use constitute a legally binding agreement made between you, whether personally or on behalf of an entity ("you") and {{ repositoryName$ | async }} ("Company", "we", "us", or "our"), concerning your access to and use of this website as well as any other media form, media channel, mobile website or mobile application related, linked, or otherwise connected thereto (collectively, the "Site"). You agree that by accessing the Site, you have read, understood, and agreed to be bound by all of these Terms of Use and any future amendments thereof.</p>
1614
<p>Supplemental terms and conditions or documents that may be posted on the Site from time to time are hereby expressly incorporated herein by reference. We reserve the right, in our sole discretion, to make changes or modifications to these Terms of Use at any time and for any reason. We will alert you about any changes by updating the "Last updated" date of these Terms of Use, and you waive any right to receive specific notice of each such change. Please ensure that you check the applicable Terms every time you use our Site so that you understand which Terms apply. You will be subject to, and will be deemed to have been made aware of and to have accepted, the changes in any revised Terms of Use by your continued use of the Site after the date such revised Terms of Use are posted.</p>
1715
<p>The information provided on the Site is not intended for distribution to or use by any person or entity in any jurisdiction or country where such distribution or use would be contrary to law or regulation or which would subject us to any registration requirement within such jurisdiction or country. Accordingly, those persons who choose to access the Site from other locations do so on their own initiative and are solely responsible for compliance with local laws, if and to the extent local laws are applicable.</p>
1816

src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import {
1212
of,
1313
} from 'rxjs';
1414

15+
import { Root } from '../../../core/data/root.model';
16+
import { RootDataService } from '../../../core/data/root-data.service';
1517
import { SiteDataService } from '../../../core/data/site-data.service';
1618
import { LocaleService } from '../../../core/locale/locale.service';
1719
import { MathService } from '../../../core/shared/math.service';
1820
import { Site } from '../../../core/shared/site.model';
21+
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
1922
import { EndUserAgreementContentComponent } from './end-user-agreement-content.component';
2023

2124
describe('EndUserAgreementContentComponent', () => {
@@ -24,6 +27,7 @@ describe('EndUserAgreementContentComponent', () => {
2427

2528
let siteServiceStub: any;
2629
let localeServiceStub: any;
30+
let rootServiceStub: any;
2731

2832
const site: Site = Object.assign(new Site(), {
2933
metadata: {
@@ -38,6 +42,10 @@ describe('EndUserAgreementContentComponent', () => {
3842
},
3943
});
4044

45+
const root: Root = Object.assign(new Root(), {
46+
dspaceName: 'Test Repository',
47+
});
48+
4149
beforeEach(waitForAsync(() => {
4250

4351
localeServiceStub = {
@@ -50,11 +58,15 @@ describe('EndUserAgreementContentComponent', () => {
5058
return of(site);
5159
},
5260
};
61+
rootServiceStub = {
62+
findRoot: jasmine.createSpy('findRoot').and.returnValue(createSuccessfulRemoteDataObject$(root)),
63+
};
5364
TestBed.configureTestingModule({
5465
imports: [TranslateModule.forRoot(), EndUserAgreementContentComponent],
5566
providers: [{ provide: SiteDataService, useValue: siteServiceStub },
5667
{ provide: LocaleService, useValue: localeServiceStub },
5768
{ provide: MathService, useValue: {} },
69+
{ provide: RootDataService, useValue: rootServiceStub },
5870
],
5971
schemas: [NO_ERRORS_SCHEMA],
6072
})

src/app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ import {
1414
} from '@ngx-translate/core';
1515
import {
1616
BehaviorSubject,
17+
Observable,
1718
Subscription,
1819
} from 'rxjs';
20+
import { map } from 'rxjs/operators';
1921

22+
import { Root } from '../../../core/data/root.model';
23+
import { RootDataService } from '../../../core/data/root-data.service';
2024
import { SiteDataService } from '../../../core/data/site-data.service';
2125
import { LocaleService } from '../../../core/locale/locale.service';
2226
import { MetadatumViewModel } from '../../../core/shared/metadata.models';
27+
import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators';
2328
import { isNotEmpty } from '../../../shared/empty.util';
2429
import { MarkdownViewerComponent } from '../../../shared/markdown-viewer/markdown-viewer.component';
2530

@@ -42,11 +47,14 @@ export class EndUserAgreementContentComponent implements OnInit, OnDestroy {
4247

4348
userAgreementText$: BehaviorSubject<string | null> = new BehaviorSubject(null);
4449

50+
repositoryName$: Observable<string>;
51+
4552
fallbackText = 'info.end-user-agreement.content.fallback';
4653

4754
constructor(private siteService: SiteDataService,
4855
private localeService: LocaleService,
4956
private translateService: TranslateService,
57+
private rootService: RootDataService,
5058
) {
5159
}
5260

@@ -55,6 +63,11 @@ export class EndUserAgreementContentComponent implements OnInit, OnDestroy {
5563
}
5664

5765
ngOnInit(): void {
66+
this.repositoryName$ = this.rootService.findRoot(true).pipe(
67+
getFirstSucceededRemoteDataPayload(),
68+
map((payload: Root) => payload.dspaceName),
69+
);
70+
5871
this.subs.push(
5972
this.siteService.find().subscribe((site) => {
6073
const langCode = this.localeService.getCurrentLanguageCode();

0 commit comments

Comments
 (0)