From a06e002c28c27b8dfc92d74f5debc9e6fb70690f Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 6 May 2021 20:09:25 +0100 Subject: [PATCH] Distinguish between an unknown meeting, and an meeting that's ended --- .../DimensionBigBlueButtonService.ts | 20 +++++++++++++------ .../bigbluebutton/bigbluebutton.component.ts | 8 +++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/api/dimension/DimensionBigBlueButtonService.ts b/src/api/dimension/DimensionBigBlueButtonService.ts index 862a268..9b6b675 100644 --- a/src/api/dimension/DimensionBigBlueButtonService.ts +++ b/src/api/dimension/DimensionBigBlueButtonService.ts @@ -265,19 +265,27 @@ export class DimensionBigBlueButtonService { @QueryParam("meetingId") meetingId: string, @QueryParam("meetingPassword") password: string, ): Promise { - // Check if the meeting is actually running. If not, return an error - let isMeetingRunningParameters = { + // Check if the meeting exists and is running. If not, return an error for each case + let getMeetingInfoParameters = { meetingID: meetingId, } - const isMeetingRunningResponse = await this.makeBBBApiCall("GET", "isMeetingRunning", isMeetingRunningParameters, null); - if (isMeetingRunningResponse.running[0].toLowerCase() !== "true") { - // This meeting is not running, inform the user + const getMeetingInfoResponse = await this.makeBBBApiCall("GET", "getMeetingInfo", getMeetingInfoParameters, null); + LogService.info("BigBlueButton", getMeetingInfoResponse) + if (getMeetingInfoResponse.returncode[0] === "FAILED") { + // This meeting does not exist, inform the user return new ApiError( 400, - {error: "This meeting does not exist or has ended."}, + {error: "This meeting does not exist."}, "UNKNOWN_MEETING_ID", ); + } else if (getMeetingInfoResponse.running[0] === "false" && getMeetingInfoResponse.endTime[0] !== "0") { + // This meeting did exist, but has ended. Inform the user + return new ApiError( + 400, + {error: "This meeting has ended."}, + "MEETING_HAS_ENDED", + ); } let joinQueryParameters = { diff --git a/web/app/widget-wrappers/bigbluebutton/bigbluebutton.component.ts b/web/app/widget-wrappers/bigbluebutton/bigbluebutton.component.ts index 5b00d73..b50aecf 100644 --- a/web/app/widget-wrappers/bigbluebutton/bigbluebutton.component.ts +++ b/web/app/widget-wrappers/bigbluebutton/bigbluebutton.component.ts @@ -152,12 +152,18 @@ export class BigBlueButtonWidgetWrapperComponent extends CapableWidget implement if ("errorCode" in response) { // This is an instance of ApiError if (response.errorCode === "UNKNOWN_MEETING_ID") { - // It's likely that everyone has left the meeting, and it's been garbage collected. + // This meeting ID is invalid. // Inform the user that they should try and start a new meeting this.statusMessage = "This meeting has ended or otherwise does not exist.
Please start a new meeting."; return; } + if (response.errorCode === "MEETING_HAS_ENDED") { + // It's likely that everyone has left the meeting, and it's been garbage collected. + // Inform the user that they should try and start a new meeting + this.statusMessage = "This meeting has ended.
Please start a new meeting."; + return; + } // Otherwise this is a generic error this.statusMessage = "An error occurred while loading the meeting"; }