File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
addon/notifications/providers
pushnotifications/providers Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ export class AddonNotificationsPushClickHandler implements CorePushNotifications
3939 * @return Whether the notification click is handled by this handler
4040 */
4141 handles ( notification : any ) : boolean | Promise < boolean > {
42+ if ( ! notification . moodlecomponent ) {
43+ // The notification doesn't come from Moodle. Handle it.
44+ return true ;
45+ }
46+
4247 if ( this . utils . isTrueOrOne ( notification . notif ) ) {
4348 // Notification clicked, mark as read. Don't block for this.
4449 const notifId = notification . savedmessageid || notification . id ;
@@ -74,7 +79,7 @@ export class AddonNotificationsPushClickHandler implements CorePushNotifications
7479 // Try to handle the appurl.
7580 if ( notification . customdata && notification . customdata . appurl ) {
7681 switch ( notification . customdata . appurlopenin ) {
77- case 'inappbrowser ' :
82+ case 'inapp ' :
7883 this . utils . openInApp ( notification . customdata . appurl ) ;
7984
8085 return ;
Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ export class CoreCoursesEnrolPushClickHandler implements CorePushNotificationsCl
3737 * @return Whether the notification click is handled by this handler
3838 */
3939 handles ( notification : any ) : boolean | Promise < boolean > {
40- return this . utils . isTrueOrOne ( notification . notif ) && notification . moodlecomponent . indexOf ( 'enrol_' ) === 0 &&
41- notification . name == 'expiry_notification' ;
40+ return this . utils . isTrueOrOne ( notification . notif ) && notification . moodlecomponent &&
41+ notification . moodlecomponent . indexOf ( 'enrol_' ) === 0 && notification . name == 'expiry_notification' ;
4242 }
4343
4444 /**
Original file line number Diff line number Diff line change @@ -124,7 +124,10 @@ export class CorePushNotificationsDelegate {
124124 * @return Promise resolved with boolean: whether the handler feature is disabled.
125125 */
126126 protected isFeatureDisabled ( handler : CorePushNotificationsClickHandler , siteId : string ) : Promise < boolean > {
127- if ( handler . featureName ) {
127+ if ( ! siteId ) {
128+ // Notification doesn't belong to a site. Assume all handlers are enabled.
129+ return Promise . resolve ( false ) ;
130+ } else if ( handler . featureName ) {
128131 // Check if the feature is disabled.
129132 return this . sitesProvider . isFeatureDisabled ( handler . featureName , siteId ) ;
130133 } else {
You can’t perform that action at this time.
0 commit comments