@@ -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}
0 commit comments