From 14e56e82c58e62e10543130e82e31ad26d34a51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Mon, 16 Oct 2023 17:43:08 +0200 Subject: [PATCH] MOBILE-4362 activitymodules: Fix activity modules block icons --- .../activitymodules/activitymodules.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts b/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts index 01b9c54ee..44321c5b8 100644 --- a/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts +++ b/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts @@ -22,6 +22,7 @@ import { Translate } from '@singletons'; import { CoreUtils } from '@services/utils/utils'; import { CoreNavigator } from '@services/navigator'; import { CoreCourseHelper } from '@features/course/services/course-helper'; +import { CoreUrlUtils } from '@services/utils/url'; /** * Component to render an "activity modules" block. @@ -68,23 +69,22 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i } section.modules.forEach((mod) => { - if (!CoreCourseHelper.canUserViewModule(mod, section) || !CoreCourse.moduleHasView(mod) || - modFullNames[mod.modname] !== undefined) { + if (archetypes[mod.modname] !== undefined || + !CoreCourseHelper.canUserViewModule(mod, section) || + !CoreCourse.moduleHasView(mod)) { // Ignore this module. return; } // Get the archetype of the module type. - if (archetypes[mod.modname] === undefined) { - archetypes[mod.modname] = CoreCourseModuleDelegate.supportsFeature( - mod.modname, - CoreConstants.FEATURE_MOD_ARCHETYPE, - CoreConstants.MOD_ARCHETYPE_OTHER, - ); - } + archetypes[mod.modname] = CoreCourseModuleDelegate.supportsFeature( + mod.modname, + CoreConstants.FEATURE_MOD_ARCHETYPE, + CoreConstants.MOD_ARCHETYPE_OTHER, + ); // Get the full name of the module type. - if (archetypes[mod.modname] == CoreConstants.MOD_ARCHETYPE_RESOURCE) { + if (archetypes[mod.modname] === CoreConstants.MOD_ARCHETYPE_RESOURCE) { // All resources are gathered in a single "Resources" option. if (!modFullNames['resources']) { modFullNames['resources'] = Translate.instant('core.resources'); @@ -92,7 +92,11 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i } else { modFullNames[mod.modname] = mod.modplural; } - modIcons[mod.modname] = mod.modicon; + + // If this is not a theme image, leave it undefined to avoid having specific activity icons. + if (CoreUrlUtils.isThemeImageUrl(mod.modicon)) { + modIcons[mod.modname] = mod.modicon; + } }); }); // Sort the modnames alphabetically.