MOBILE-4344 cron: Check notification and messages

main
Alfonso Salces 2023-05-24 15:37:20 +02:00
parent affcf93df8
commit 2738e08abb
2 changed files with 15 additions and 2 deletions

View File

@ -191,7 +191,14 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler,
* @returns Promise resolved when done, rejected if failure.
*/
async execute(siteId?: string): Promise<void> {
if (!CoreSites.isCurrentSite(siteId)) {
const site = CoreSites.getCurrentSite();
if (
!CoreSites.isCurrentSite(siteId) ||
!site ||
site.isFeatureDisabled('CoreMainMenuDelegate_AddonMessages') ||
!site.canUseAdvancedFeature('messaging')
) {
return;
}

View File

@ -67,7 +67,13 @@ export class AddonNotificationsCronHandlerService implements CoreCronHandler {
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async execute(siteId?: string, force?: boolean): Promise<void> {
if (!CoreSites.isCurrentSite(siteId)) {
const site = CoreSites.getCurrentSite();
if (
!CoreSites.isCurrentSite(siteId) ||
!site ||
site.isFeatureDisabled('CoreMainMenuDelegate_AddonNotifications')
) {
return;
}