Merge pull request #1942 from albertgasset/MOBILE-3049

MOBILE-3049 sitehome: Fix activities not displayed
main
Juan Leyva 2019-05-24 15:25:51 +02:00 committed by GitHub
commit 3a43264488
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -75,7 +75,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl
*/
protected fetchContent(): Promise<any> {
return this.courseProvider.getSections(this.siteHomeId, false, true).then((sections) => {
this.block = sections[0];
this.block = sections.find((section) => section.section == 0);
if (this.block) {
this.block.hasContent = this.courseHelper.sectionHasContent(this.block);

View File

@ -137,7 +137,7 @@ export class CoreSiteHomeIndexComponent implements OnInit {
return this.courseProvider.getSections(this.siteHomeId, false, true).then((sections) => {
// Check "Include a topic section" setting from numsections.
this.section = config.numsections ? sections[1] : false;
this.section = config.numsections ? sections.find((section) => section.section == 1) : false;
if (this.section) {
this.section.hasContent = this.courseHelper.sectionHasContent(this.section);
this.hasContent = this.courseHelper.addHandlerDataForModules([this.section], this.siteHomeId) || this.hasContent;
@ -164,7 +164,8 @@ export class CoreSiteHomeIndexComponent implements OnInit {
this.blocks = [];
// Cannot get the blocks, just show site main menu if needed.
if (sections[0] && this.courseHelper.sectionHasContent(sections[0])) {
const section = sections.find((section) => section.section == 0);
if (section && this.courseHelper.sectionHasContent(section)) {
this.blocks.push({
name: 'site_main_menu'
});