MDL-73197 mod_bigbluebuttonbn: Fix activity join message

* When schedule is assigned to an activity, the Room still shows as ready to be joined, even if the room is still not open.
This commit is contained in:
Laurent David
2022-03-30 13:41:34 +02:00
parent efda17d3b0
commit 52fdeaf112
+26 -8
View File
@@ -25,7 +25,6 @@ use Firebase\JWT\Key;
use mod_bigbluebuttonbn\local\config;
use mod_bigbluebuttonbn\local\exceptions\bigbluebutton_exception;
use mod_bigbluebuttonbn\local\exceptions\meeting_join_exception;
use mod_bigbluebuttonbn\local\exceptions\server_not_available_exception;
use mod_bigbluebuttonbn\local\helpers\roles;
use mod_bigbluebuttonbn\local\proxy\bigbluebutton_proxy;
use stdClass;
@@ -261,19 +260,13 @@ class meeting {
// If user is administrator, moderator or if is viewer and no waiting is required, join allowed.
if ($meetinginfo->statusrunning) {
$meetinginfo->statusmessage = get_string('view_message_conference_in_progress', 'bigbluebuttonbn');
$meetinginfo->startedat = floor(intval($info['startTime']) / 1000); // Milliseconds.
$meetinginfo->moderatorcount = $info['moderatorCount'];
$meetinginfo->moderatorplural = $info['moderatorCount'] > 1;
$meetinginfo->participantcount = $participantcount - $meetinginfo->moderatorcount;
$meetinginfo->participantplural = $meetinginfo->participantcount > 1;
} else {
if ($instance->user_must_wait_to_join() && !$instance->user_can_force_join()) {
$meetinginfo->statusmessage = get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn');
} else {
$meetinginfo->statusmessage = get_string('view_message_conference_room_ready', 'bigbluebuttonbn');
}
}
$meetinginfo->statusmessage = $this->get_status_message($meetinginfo, $instance);
$presentation = $instance->get_presentation(); // This is for internal use.
if (!empty($presentation)) {
@@ -289,6 +282,31 @@ class meeting {
return $meetinginfo;
}
/**
* Deduce status message from the current meeting info and the instance
*
* Returns the human-readable message depending on if the user must wait to join, the meeting has not
* yet started ...
* @param object $meetinginfo
* @param instance $instance
* @return string
*/
protected function get_status_message(object $meetinginfo, instance $instance): string {
if ($meetinginfo->statusrunning) {
return get_string('view_message_conference_in_progress', 'bigbluebuttonbn');
}
if ($instance->user_must_wait_to_join() && !$instance->user_can_force_join()) {
return get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn');
}
if ($instance->before_start_time()) {
return get_string('view_message_conference_not_started', 'bigbluebuttonbn');
}
if ($instance->has_ended()) {
return get_string('view_message_conference_has_ended', 'bigbluebuttonbn');
}
return get_string('view_message_conference_room_ready', 'bigbluebuttonbn');
}
/**
* Gets a meeting info object cached or fetched from the live session.
*