From 6d0473ef4ce4e274055a859dc8195683d28a954a Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 13 Oct 2022 15:19:06 +0200 Subject: [PATCH] MOBILE-4137 bbb: Don't display room info if showroom = false --- .../components/index/index.html | 4 ++-- .../bigbluebuttonbn/components/index/index.ts | 8 +++++-- .../services/bigbluebuttonbn.ts | 21 +++++++++++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.html b/src/addons/mod/bigbluebuttonbn/components/index/index.html index a7b30ba54..f51197f46 100644 --- a/src/addons/mod/bigbluebuttonbn/components/index/index.html +++ b/src/addons/mod/bigbluebuttonbn/components/index/index.html @@ -16,7 +16,7 @@ - +

{{ 'addon.mod_bigbluebuttonbn.mod_form_field_openingtime' | translate }}

@@ -85,7 +85,7 @@
+ *ngIf="meetingInfo && showRoom && (meetingInfo.canjoin || (meetingInfo.statusrunning && meetingInfo.ismoderator))"> {{ 'addon.mod_bigbluebuttonbn.view_conference_action_end' | translate }} diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.ts b/src/addons/mod/bigbluebuttonbn/components/index/index.ts index f7dbbe3f9..95ad3c6c4 100644 --- a/src/addons/mod/bigbluebuttonbn/components/index/index.ts +++ b/src/addons/mod/bigbluebuttonbn/components/index/index.ts @@ -22,7 +22,7 @@ import { CoreGroupInfo, CoreGroups } from '@services/groups'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreUtils } from '@services/utils/utils'; import { Translate } from '@singletons'; -import { AddonModBBB, AddonModBBBData, AddonModBBBMeetingInfoWSResponse, AddonModBBBService } from '../../services/bigbluebuttonbn'; +import { AddonModBBB, AddonModBBBData, AddonModBBBMeetingInfo, AddonModBBBService } from '../../services/bigbluebuttonbn'; /** * Component that displays a Big Blue Button activity. @@ -39,7 +39,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo bbb?: AddonModBBBData; groupInfo?: CoreGroupInfo; groupId = 0; - meetingInfo?: AddonModBBBMeetingInfoWSResponse; + meetingInfo?: AddonModBBBMeetingInfo; constructor( protected content?: IonContent, @@ -57,6 +57,10 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo await this.loadContent(); } + get showRoom(): boolean { + return !!this.meetingInfo && (!this.meetingInfo.features || this.meetingInfo.features.showroom); + } + /** * @inheritdoc */ diff --git a/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts b/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts index 411aa5252..655454fc5 100644 --- a/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts +++ b/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts @@ -19,6 +19,7 @@ import { CoreSite, CoreSiteWSPreSets } from '@classes/site'; import { CoreCourseCommonModWSOptions } from '@features/course/services/course'; import { CoreCourseLogHelper } from '@features/course/services/log-helper'; import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites'; +import { CoreUtils } from '@services/utils/utils'; import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws'; import { makeSingleton, Translate } from '@singletons'; @@ -152,7 +153,7 @@ export class AddonModBBBService { id: number, groupId: number = 0, options: AddonModBBBGetMeetingInfoOptions = {}, - ): Promise { + ): Promise { const site = await CoreSites.getSite(options.siteId); const params: AddonModBBBMeetingInfoWSParams = { @@ -172,11 +173,16 @@ export class AddonModBBBService { preSets.getFromCache = false; } - return site.read( + const meetingInfo = await site.read( 'mod_bigbluebuttonbn_meeting_info', params, preSets, ); + + return { + ...meetingInfo, + features: meetingInfo.features ? CoreUtils.objectToKeyValueMap(meetingInfo.features, 'name', 'isenabled') : undefined, + }; } /** @@ -353,6 +359,17 @@ export type AddonModBBBMeetingInfoWSResponse = { name: string; // Presentation name. }[]; joinurl: string; // Join URL. + features?: { // Enabled features. @since 4.1. + name: string; + isenabled: boolean; + }[]; +}; + +/** + * Meeting info with some calculated data. + */ +export type AddonModBBBMeetingInfo = Omit & { + features?: Record; }; /**