diff --git a/src/app/features/project/settings/components/index.ts b/src/app/features/project/settings/components/index.ts index b1d1cc40d..48f7a5372 100644 --- a/src/app/features/project/settings/components/index.ts +++ b/src/app/features/project/settings/components/index.ts @@ -3,7 +3,6 @@ export { ProjectSettingNotificationsComponent } from './project-setting-notifica export { SettingsAccessRequestsCardComponent } from './settings-access-requests-card/settings-access-requests-card.component'; export { SettingsProjectAffiliationComponent } from './settings-project-affiliation/settings-project-affiliation.component'; export { SettingsProjectFormCardComponent } from './settings-project-form-card/settings-project-form-card.component'; -export { SettingsRedirectLinkComponent } from './settings-redirect-link/settings-redirect-link.component'; export { SettingsStorageLocationCardComponent } from './settings-storage-location-card/settings-storage-location-card.component'; export { SettingsViewOnlyLinksCardComponent } from './settings-view-only-links-card/settings-view-only-links-card.component'; export { SettingsWikiCardComponent } from './settings-wiki-card/settings-wiki-card.component'; diff --git a/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.html b/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.html deleted file mode 100644 index e89fe4f2f..000000000 --- a/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.html +++ /dev/null @@ -1,39 +0,0 @@ - -

{{ 'myProjects.settings.redirectLink' | translate }}

- -
-
- - - -
- - @if (redirectForm.get('isEnabled')?.value) { -
- - - -
- -
- -
- } -
-
diff --git a/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.spec.ts b/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.spec.ts deleted file mode 100644 index 73ad22188..000000000 --- a/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SettingsRedirectLinkComponent } from './settings-redirect-link.component'; - -describe('SettingsRedirectLinkComponent', () => { - let component: SettingsRedirectLinkComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [SettingsRedirectLinkComponent], - }).compileComponents(); - - fixture = TestBed.createComponent(SettingsRedirectLinkComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.ts b/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.ts deleted file mode 100644 index c208f2c75..000000000 --- a/src/app/features/project/settings/components/settings-redirect-link/settings-redirect-link.component.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { TranslatePipe } from '@ngx-translate/core'; - -import { Button } from 'primeng/button'; -import { Card } from 'primeng/card'; -import { Checkbox } from 'primeng/checkbox'; - -import { ChangeDetectionStrategy, Component, DestroyRef, effect, inject, input, output } from '@angular/core'; -import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; - -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; - -import { RedirectLinkDataModel, RedirectLinkForm } from '../../models'; - -@Component({ - selector: 'osf-settings-redirect-link', - imports: [Card, Checkbox, TranslatePipe, ReactiveFormsModule, TextInputComponent, Button], - templateUrl: './settings-redirect-link.component.html', - styleUrl: '../../settings.component.scss', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class SettingsRedirectLinkComponent { - private readonly destroyRef = inject(DestroyRef); - - redirectUrlDataInput = input.required(); - redirectUrlDataChange = output(); - - inputLimits = InputLimits; - - redirectForm = new FormGroup({ - isEnabled: new FormControl(false, { - nonNullable: true, - validators: [Validators.required], - }), - url: new FormControl('', [CustomValidators.requiredTrimmed(), CustomValidators.linkValidator()]), - label: new FormControl('', [CustomValidators.requiredTrimmed()]), - }); - - constructor() { - this.setupFormSubscriptions(); - this.setupInputEffects(); - } - - private setupFormSubscriptions(): void { - this.redirectForm.controls.isEnabled?.valueChanges - .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe((isEnabled) => { - if (!isEnabled) { - this.redirectForm.get('url')?.setValue(''); - this.redirectForm.get('label')?.setValue(''); - this.emitFormData(); - } - }); - } - - saveRedirectSettings(): void { - if (this.redirectForm.valid) { - this.emitFormData(); - } - } - - private setupInputEffects(): void { - effect(() => { - const inputData = this.redirectUrlDataInput(); - this.redirectForm.patchValue( - { - isEnabled: inputData.isEnabled, - url: inputData.url, - label: inputData.label, - }, - { emitEvent: false } - ); - - this.redirectForm.markAsPristine(); - }); - } - - get hasChanges(): boolean { - return this.redirectForm.dirty; - } - - private emitFormData(): void { - const formValue = this.redirectForm.value; - this.redirectUrlDataChange.emit({ - isEnabled: formValue.isEnabled || false, - url: formValue.url || '', - label: formValue.label || '', - }); - } -} diff --git a/src/app/features/project/settings/mappers/settings.mapper.ts b/src/app/features/project/settings/mappers/settings.mapper.ts index 9ebc60308..96429ca98 100644 --- a/src/app/features/project/settings/mappers/settings.mapper.ts +++ b/src/app/features/project/settings/mappers/settings.mapper.ts @@ -21,9 +21,6 @@ export class SettingsMapper { accessRequestsEnabled: result.attributes.access_requests_enabled, anyoneCanComment: result.attributes.anyone_can_comment, anyoneCanEditWiki: result.attributes.anyone_can_edit_wiki, - redirectLinkEnabled: result.attributes.redirect_link_enabled, - redirectLinkLabel: result.attributes.redirect_link_label, - redirectLinkUrl: result.attributes.redirect_link_url, wikiEnabled: result.attributes.wiki_enabled, }, } as ProjectSettingsModel; diff --git a/src/app/features/project/settings/models/index.ts b/src/app/features/project/settings/models/index.ts index 282b281d1..5d0d33700 100644 --- a/src/app/features/project/settings/models/index.ts +++ b/src/app/features/project/settings/models/index.ts @@ -3,6 +3,4 @@ export * from './project-details.model'; export * from './project-details-json-api.model'; export * from './project-settings.model'; export * from './project-settings-response.model'; -export * from './redirect-link-data.model'; -export * from './redirect-link-form.model'; export * from './right-control.model'; diff --git a/src/app/features/project/settings/models/project-settings-response.model.ts b/src/app/features/project/settings/models/project-settings-response.model.ts index 49c6255c2..5a27c0e97 100644 --- a/src/app/features/project/settings/models/project-settings-response.model.ts +++ b/src/app/features/project/settings/models/project-settings-response.model.ts @@ -3,9 +3,6 @@ export interface ProjectSettingsAttributes { anyone_can_comment: boolean; anyone_can_edit_wiki: boolean; wiki_enabled: boolean; - redirect_link_enabled: boolean; - redirect_link_url: string; - redirect_link_label: string; } export interface RelatedLink { diff --git a/src/app/features/project/settings/models/project-settings.model.ts b/src/app/features/project/settings/models/project-settings.model.ts index d59109d38..8b565e6bc 100644 --- a/src/app/features/project/settings/models/project-settings.model.ts +++ b/src/app/features/project/settings/models/project-settings.model.ts @@ -4,9 +4,6 @@ export interface ProjectSettingsModel { accessRequestsEnabled: boolean; anyoneCanComment: boolean; anyoneCanEditWiki: boolean; - redirectLinkEnabled: boolean; - redirectLinkLabel: string; - redirectLinkUrl: string; wikiEnabled: boolean; }; lastFetched?: number; diff --git a/src/app/features/project/settings/models/redirect-link-data.model.ts b/src/app/features/project/settings/models/redirect-link-data.model.ts deleted file mode 100644 index f85e7b63b..000000000 --- a/src/app/features/project/settings/models/redirect-link-data.model.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface RedirectLinkDataModel { - isEnabled: boolean; - url: string; - label: string; -} diff --git a/src/app/features/project/settings/models/redirect-link-form.model.ts b/src/app/features/project/settings/models/redirect-link-form.model.ts deleted file mode 100644 index 1e9deaa7e..000000000 --- a/src/app/features/project/settings/models/redirect-link-form.model.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { FormControl } from '@angular/forms'; - -export interface RedirectLinkForm { - isEnabled: FormControl; - url: FormControl; - label: FormControl; -} diff --git a/src/app/features/project/settings/settings.component.html b/src/app/features/project/settings/settings.component.html index 5584dfb98..9b82a527c 100644 --- a/src/app/features/project/settings/settings.component.html +++ b/src/app/features/project/settings/settings.component.html @@ -43,11 +43,6 @@ [notifications]="notifications()" /> - - ({ isEnabled: false, url: '', label: '' }); accessRequest = signal(false); wikiEnabled = signal(false); anyoneCanEditWiki = signal(false); @@ -146,11 +143,6 @@ export class SettingsComponent implements OnInit { this.syncSettingsChanges('anyone_can_edit_wiki', newValue); } - onRedirectUrlDataRequestChange(data: RedirectLinkDataModel): void { - this.redirectUrlData.set(data); - this.syncSettingsChanges('redirectUrl', data); - } - onNotificationRequestChange(data: { event: SubscriptionEvent; frequency: SubscriptionFrequency }): void { const id = `${this.projectId()}_${data.event}`; const frequency = data.frequency; @@ -208,24 +200,16 @@ export class SettingsComponent implements OnInit { }); } - private syncSettingsChanges(changedField: string, value: boolean | RedirectLinkDataModel): void { + private syncSettingsChanges(changedField: string, value: boolean): void { const payload: Partial = {}; switch (changedField) { case 'access_requests_enabled': case 'wiki_enabled': - case 'redirect_link_enabled': case 'anyone_can_edit_wiki': case 'anyone_can_comment': payload[changedField] = value as boolean; break; - case 'redirectUrl': - if (typeof value === 'object') { - payload['redirect_link_enabled'] = value.isEnabled; - payload['redirect_link_url'] = value.isEnabled ? value.url : undefined; - payload['redirect_link_label'] = value.isEnabled ? value.label : undefined; - } - break; } const model = { @@ -251,12 +235,6 @@ export class SettingsComponent implements OnInit { this.wikiEnabled.set(settings.attributes.wikiEnabled); this.anyoneCanEditWiki.set(settings.attributes.anyoneCanEditWiki); this.anyoneCanComment.set(settings.attributes.anyoneCanComment); - - this.redirectUrlData.set({ - isEnabled: settings.attributes.redirectLinkEnabled, - url: settings.attributes.redirectLinkUrl, - label: settings.attributes.redirectLinkLabel, - }); } }); diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index f0a62a800..2ac4cb0e1 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -408,8 +408,6 @@ "wikiConfigureText": "Create a link to share this project so those who have the link can view—but not edit—the project.", "emailNotifications": "Email Notifications", "emailNotificationsText": "These notification settings only apply to you. They do NOT affect any other contributor on this project.", - "redirectLink": "Redirect Link", - "redirectLinkText": "Redirect visitors from your project page to an external webpage", "projectAffiliation": "Project Affiliation / Branding", "projectsCanBeAffiliated": "Projects can be affiliated with institutions that have created OSF for Institutions accounts. This allows:", "institutionalLogos": "institutional logos to be displayed on public projects", @@ -422,7 +420,6 @@ "url": "URL", "label": "Label", "storageLocationMessage": "Storage location cannot be changed after project is created.", - "redirectUrlPlaceholder": "Send people who visit your OSF project page to this link instead", "invalidUrl": "Please enter a valid URL, such as: https://example.com", "disabledForWiki": "This feature is disabled for wikis of private projects.", "enabledForWiki": "This feature is enabled for wikis of private projects.",