Skip to content

Commit 5e61135

Browse files
authored
Merge pull request #3267 from dpalou/MOBILE-3833
Mobile 3833
2 parents c644eeb + b0f0900 commit 5e61135

File tree

4 files changed

+45
-17
lines changed

4 files changed

+45
-17
lines changed

scripts/langindex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@
461461
"addon.mod_bigbluebuttonbn.view_message_session_started_at": "bigbluebuttonbn",
462462
"addon.mod_bigbluebuttonbn.view_message_viewer": "bigbluebuttonbn",
463463
"addon.mod_bigbluebuttonbn.view_message_viewers": "bigbluebuttonbn",
464+
"addon.mod_bigbluebuttonbn.view_nojoin": "bigbluebuttonbn",
464465
"addon.mod_book.errorchapter": "book",
465466
"addon.mod_book.modulenameplural": "book",
466467
"addon.mod_book.navnexttitle": "book",

src/addons/mod/bigbluebuttonbn/components/index/index.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,23 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
8181
return;
8282
}
8383

84-
this.meetingInfo = await AddonModBBB.getMeetingInfo(this.bbb.id, this.groupId, {
85-
cmId: this.module.id,
86-
});
87-
88-
if (this.meetingInfo.statusrunning && this.meetingInfo.userlimit > 0) {
89-
const count = (this.meetingInfo.participantcount || 0) + (this.meetingInfo.moderatorcount || 0);
90-
if (count === this.meetingInfo.userlimit) {
91-
this.meetingInfo.statusmessage = Translate.instant('addon.mod_bigbluebuttonbn.userlimitreached');
84+
try {
85+
this.meetingInfo = await AddonModBBB.getMeetingInfo(this.bbb.id, this.groupId, {
86+
cmId: this.module.id,
87+
});
88+
89+
if (this.meetingInfo.statusrunning && this.meetingInfo.userlimit > 0) {
90+
const count = (this.meetingInfo.participantcount || 0) + (this.meetingInfo.moderatorcount || 0);
91+
if (count === this.meetingInfo.userlimit) {
92+
this.meetingInfo.statusmessage = Translate.instant('addon.mod_bigbluebuttonbn.userlimitreached');
93+
}
9294
}
95+
} catch (error) {
96+
if (error && error.errorcode === 'restrictedcontextexception') {
97+
error.message = Translate.instant('addon.mod_bigbluebuttonbn.view_nojoin');
98+
}
99+
100+
throw error;
93101
}
94102
}
95103

src/addons/mod/bigbluebuttonbn/lang.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"view_message_moderators": "moderators",
1515
"view_message_session_started_at": "This session started at",
1616
"view_message_viewer": "viewer",
17-
"view_message_viewers": "viewers"
17+
"view_message_viewers": "viewers",
18+
"view_nojoin": "You do not have a role that is allowed to join this session."
1819
}

src/core/features/course/components/module-summary/module-summary.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,35 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
174174
this.componentId = this.module.id;
175175
this.externalUrl = this.module.url;
176176
this.courseId = this.courseId || this.module.course;
177-
178-
this.modicon = await CoreCourseModuleDelegate.getModuleIconSrc(this.module.modname, this.module.modicon, this.module);
179177
this.moduleNameTranslated = CoreCourse.translateModuleName(this.module.modname || '');
180178

181179
this.blog = await AddonBlog.isPluginEnabled();
182180

183-
await Promise.all([
184-
this.getPackageStatus(),
185-
this.fetchGrades(),
186-
this.fetchCourse(),
187-
]);
181+
try {
182+
await Promise.all([
183+
this.loadModIcon(),
184+
this.getPackageStatus(),
185+
this.fetchGrades(),
186+
this.fetchCourse(),
187+
]);
188+
} catch (error) {
189+
CoreDomUtils.showErrorModal(error);
190+
}
188191

189192
this.loaded = true;
190193
}
191194

195+
/**
196+
* Load the module icon.
197+
*/
198+
protected async loadModIcon(): Promise<void> {
199+
if (!this.module) {
200+
return;
201+
}
202+
203+
this.modicon = await CoreCourseModuleDelegate.getModuleIconSrc(this.module.modname, this.module.modicon, this.module);
204+
}
205+
192206
/**
193207
* Updage package status.
194208
*
@@ -235,7 +249,11 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
235249
return;
236250
}
237251

238-
this.grades = await CoreGradesHelper.getModuleGrades(this.courseId, this.moduleId);
252+
try {
253+
this.grades = await CoreGradesHelper.getModuleGrades(this.courseId, this.moduleId);
254+
} catch {
255+
// Cannot get grades, don't display them.
256+
}
239257
}
240258

241259
/**

0 commit comments

Comments
 (0)