Skip to content

Commit 2bf55dd

Browse files
committed
fix(settings): updated tokens and notifications
1 parent fc5c303 commit 2bf55dd

7 files changed

Lines changed: 36 additions & 17 deletions

File tree

src/app/features/settings/notifications/notifications.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ <h2>{{ 'settings.notifications.notificationPreferences.title' | translate }}</h2
103103
<p-skeleton width="30rem" height="1rem"></p-skeleton>
104104

105105
<section class="notification-configuration">
106-
@for (_ of [1, 2, 3, 4, 5]; track $index) {
106+
@for (_ of [1, 2, 3]; track $index) {
107107
<p-skeleton width="20rem" height="2rem"></p-skeleton>
108108
<p-skeleton class="dropdown" height="3rem"></p-skeleton>
109109
}

src/app/features/settings/notifications/notifications.component.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ export class NotificationsComponent implements OnInit {
6868
[EmailPreferencesFormControls.SubscribeOsfHelpEmail]: this.fb.control(false, { nonNullable: true }),
6969
});
7070

71-
protected readonly SUBSCRIPTION_EVENTS = SUBSCRIPTION_EVENTS;
72-
protected subscriptionFrequencyOptions = Object.entries(SubscriptionFrequency).map(([key, value]) => ({
71+
readonly SUBSCRIPTION_EVENTS = SUBSCRIPTION_EVENTS;
72+
subscriptionFrequencyOptions = Object.entries(SubscriptionFrequency).map(([key, value]) => ({
7373
label: key,
7474
value,
7575
}));
76-
protected notificationSubscriptionsForm = this.fb.group(
76+
77+
notificationSubscriptionsForm = this.fb.group(
7778
SUBSCRIPTION_EVENTS.reduce(
7879
(control, { event }) => {
7980
control[event] = this.fb.control<SubscriptionFrequency>(SubscriptionFrequency.Never, { nonNullable: true });
@@ -127,11 +128,9 @@ export class NotificationsComponent implements OnInit {
127128
const id = `${user.id}_${event}`;
128129

129130
this.loaderService.show();
130-
this.actions.updateNotificationSubscription({ id, frequency }).subscribe({
131-
complete: () => {
132-
this.loaderService.hide();
133-
this.toastService.showSuccess('settings.notifications.notificationPreferences.successUpdate');
134-
},
131+
this.actions.updateNotificationSubscription({ id, frequency }).subscribe(() => {
132+
this.loaderService.hide();
133+
this.toastService.showSuccess('settings.notifications.notificationPreferences.successUpdate');
135134
});
136135
}
137136

@@ -144,9 +143,11 @@ export class NotificationsComponent implements OnInit {
144143

145144
private updateNotificationSubscriptionsForm() {
146145
const patch: Record<string, SubscriptionFrequency> = {};
146+
147147
for (const sub of this.notificationSubscriptions()) {
148148
patch[sub.event] = sub.frequency;
149149
}
150+
150151
this.notificationSubscriptionsForm.patchValue(patch);
151152
}
152153
}

src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
class="w-12rem btn-full-width"
5050
[label]="'settings.tokens.form.buttons.cancel' | translate"
5151
severity="info"
52-
(click)="dialogRef.close()"
52+
(onClick)="dialogRef.close()"
5353
/>
5454
<p-button
5555
class="w-12rem btn-full-width"

src/app/features/settings/tokens/pages/token-details/token-details.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h1>{{ token()?.name }}</h1>
1919
class="btn-full-width"
2020
[label]="'settings.tokens.details.deleteButton' | translate"
2121
severity="danger"
22-
(click)="deleteToken()"
22+
(onClick)="deleteToken()"
2323
/>
2424
</div>
2525
</div>

src/app/features/settings/tokens/store/tokens.selectors.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export class TokensSelectors {
1111
return state.scopes.data;
1212
}
1313

14-
@Selector([TokensState])
15-
static isScopesLoading(state: TokensStateModel) {
16-
return state.scopes.isLoading;
17-
}
18-
1914
@Selector([TokensState])
2015
static getTokens(state: TokensStateModel): TokenModel[] {
2116
return state.tokens.data;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { TokensComponent } from './tokens.component';
4+
5+
import { OSFTestingModule } from '@testing/osf.testing.module';
6+
7+
describe.skip('TokensComponent', () => {
8+
let component: TokensComponent;
9+
let fixture: ComponentFixture<TokensComponent>;
10+
11+
beforeEach(async () => {
12+
await TestBed.configureTestingModule({
13+
imports: [TokensComponent, OSFTestingModule],
14+
}).compileComponents();
15+
16+
fixture = TestBed.createComponent(TokensComponent);
17+
component = fixture.componentInstance;
18+
fixture.detectChanges();
19+
});
20+
21+
it('should create', () => {
22+
expect(component).toBeTruthy();
23+
});
24+
});

src/app/shared/services/my-resources.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { environment } from 'src/environments/environment';
2323
providedIn: 'root',
2424
})
2525
export class MyResourcesService {
26-
private apiUrl = environment.apiUrl;
2726
private sortFieldMap: Record<string, string> = {
2827
title: 'title',
2928
dateModified: 'date_modified',

0 commit comments

Comments
 (0)