From 52fdeaf1128463541ab1d0b6445c297cf0146e69 Mon Sep 17 00:00:00 2001 From: Laurent David Date: Fri, 18 Feb 2022 06:58:23 +0100 Subject: [PATCH] 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. --- mod/bigbluebuttonbn/classes/meeting.php | 34 +++++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/mod/bigbluebuttonbn/classes/meeting.php b/mod/bigbluebuttonbn/classes/meeting.php index 9c503d4b154..7a821cc4dd6 100644 --- a/mod/bigbluebuttonbn/classes/meeting.php +++ b/mod/bigbluebuttonbn/classes/meeting.php @@ -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. *