From 32d1e0761b15e081be6990a834408d81a8bb9bb6 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 24 Nov 2022 13:09:06 +0100 Subject: [PATCH] MOBILE-4081 wiki: Allow viewing empty subwikis --- src/addons/mod/wiki/components/index/index.ts | 14 ++++---------- .../addon-mod-wiki-subwiki-picker.html | 3 +-- .../components/subwiki-picker/subwiki-picker.ts | 9 +++------ 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/addons/mod/wiki/components/index/index.ts b/src/addons/mod/wiki/components/index/index.ts index 830572a90..1c922bf49 100644 --- a/src/addons/mod/wiki/components/index/index.ts +++ b/src/addons/mod/wiki/components/index/index.ts @@ -638,14 +638,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * @param subwikiId Subwiki ID. * @param userId User ID of the subwiki. * @param groupId Group ID of the subwiki. - * @param canEdit Whether the subwiki can be edited. */ - goToSubwiki(subwikiId: number, userId: number, groupId: number, canEdit: boolean): void { - // Check if the subwiki is disabled. - if (subwikiId <= 0 && !canEdit) { - return; - } - + goToSubwiki(subwikiId: number, userId: number, groupId: number): void { if (subwikiId != this.currentSubwiki!.id || userId != this.currentSubwiki!.userid || groupId != this.currentSubwiki!.groupid) { @@ -828,7 +822,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * @param event Event. */ async showSubwikiPicker(event: MouseEvent): Promise { - const popoverData = await CoreDomUtils.openPopover({ + const subwiki = await CoreDomUtils.openPopover({ component: AddonModWikiSubwikiPickerComponent, componentProps: { subwikis: this.subwikiData.subwikis, @@ -837,8 +831,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp event, }); - if (popoverData) { - this.goToSubwiki(popoverData.id, popoverData.userid, popoverData.groupid, popoverData.canedit); + if (subwiki) { + this.goToSubwiki(subwiki.id, subwiki.userid, subwiki.groupid); } } diff --git a/src/addons/mod/wiki/components/subwiki-picker/addon-mod-wiki-subwiki-picker.html b/src/addons/mod/wiki/components/subwiki-picker/addon-mod-wiki-subwiki-picker.html index 44224516e..aa7de86e6 100644 --- a/src/addons/mod/wiki/components/subwiki-picker/addon-mod-wiki-subwiki-picker.html +++ b/src/addons/mod/wiki/components/subwiki-picker/addon-mod-wiki-subwiki-picker.html @@ -5,8 +5,7 @@

{{ group.label }}

- {{ subwiki.name }} diff --git a/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts b/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts index beb98788c..de8d7a318 100644 --- a/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts +++ b/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts @@ -49,12 +49,9 @@ export class AddonModWikiSubwikiPickerComponent { * @param subwiki The subwiki to open. */ openSubwiki(subwiki: AddonModWikiSubwiki): void { - // Check if the subwiki is disabled. - if (subwiki.id > 0 || subwiki.canedit) { - // Check if it isn't current subwiki. - if (subwiki != this.currentSubwiki) { - PopoverController.dismiss(subwiki); - } + // Check if it isn't current subwiki. + if (subwiki !== this.currentSubwiki) { + PopoverController.dismiss(subwiki); } }