File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed
src/app/features/settings/notifications Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -137,24 +137,14 @@ export class NotificationsComponent implements OnInit {
137137 onSubscriptionChange ( event : SubscriptionEvent , frequency : SubscriptionFrequency ) {
138138 const user = this . currentUser ( ) ;
139139 if ( ! user ) return ;
140+ const apiEventName = this . FORM_EVENT_TO_API_EVENT [ event as string ] ?? ( event as string ) ;
140141
141- const eventKey = event as unknown as string ;
142+ const id =
143+ event === SubscriptionEvent . GlobalReviews
144+ ? this . notificationSubscriptions ( ) . find ( ( s ) => ( s . event as string ) === 'new_pending_submissions' ) ?. id
145+ : `${ user . id } _${ apiEventName } ` ;
142146
143- const apiEventName = this . FORM_EVENT_TO_API_EVENT [ eventKey ] ?? eventKey ;
144-
145- let id : string | undefined ;
146-
147- if ( event === SubscriptionEvent . GlobalReviews ) {
148- const subs = this . notificationSubscriptions ( ) ;
149- const match = subs . find ( ( s ) => ( s . event as string ) === 'new_pending_submissions' ) ;
150- if ( match ) {
151- id = match . id ;
152- } else {
153- return ;
154- }
155- } else {
156- id = `${ user . id } _${ apiEventName } ` ;
157- }
147+ if ( ! id ) return ;
158148
159149 this . loaderService . show ( ) ;
160150 this . actions . updateNotificationSubscription ( { id, frequency } ) . subscribe ( ( ) => {
You can’t perform that action at this time.
0 commit comments