Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIH-11222 remove host wants to join #2336

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -888,14 +888,11 @@ describe('HearingControlsBaseComponent', () => {
expect(videoCallService.suspendHearing).not.toHaveBeenCalled();
});

it('should dismiss participant if confirmed leaving and another host is present', done => {
it('should dismiss participant if confirmed leaving and another host is present', () => {
component.displayLeaveHearingPopup = true;
const participantsModel = [];
spyOn(component, 'isAnotherHostInHearing').and.returnValue(true);
videoCallServiceSpy.leaveHearing.and.returnValue(Promise.resolve());
component.leaveHearing.subscribe(event => {
done();
});

component.leave(true, participantsModel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export abstract class HearingControlsBaseComponent implements OnInit, OnDestroy
@Output() public togglePanel = new EventEmitter<string>();
@Output() public changeDeviceToggle = new EventEmitter();
@Output() public changeLanguageSelected = new EventEmitter();
@Output() public leaveHearing = new EventEmitter();

audioOnly = false;

Expand Down Expand Up @@ -459,9 +458,7 @@ export abstract class HearingControlsBaseComponent implements OnInit, OnDestroy
const isAnotherHostInHearing = this.isAnotherHostInHearing(participants);

if (isAnotherHostInHearing) {
this.videoCallService.leaveHearing(this.conferenceId, this.participant.id).then(() => {
this.leaveHearing.emit();
});
this.videoCallService.leaveHearing(this.conferenceId, this.participant.id);
} else {
this.videoCallService.suspendHearing(this.conferenceId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<div class="video-wrapper">
<video
appForcePlayVideo
[muted]="shouldMuteHearing()"
id="incomingFeedPrivate"
[srcObject]="presentationStream && !streamInMain ? presentationStream : callStream"
height="auto"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ <h1 #roomTitleLabel class="room-title-label">{{ getCaseNameAndNumber() }}</h1>
[areParticipantsVisible]="areParticipantsVisible"
(leaveConsultation)="leaveConsultation()"
(togglePanel)="togglePanel($event)"
(changeDeviceToggle)="showChooseCameraDialog()"
(leaveHearing)="leaveHearing()">
(changeDeviceToggle)="showChooseCameraDialog()">
[conference]="conference">
</app-private-consultation-room-controls>
</div>
Expand Down Expand Up @@ -70,7 +69,6 @@ <h1 #roomTitleLabel class="room-title-label">{{ getCaseNameAndNumber() }}</h1>
<video
appForcePlayVideo
id="incomingFeedJudgePrivate"
[muted]="shouldMuteHearing()"
[srcObject]="presentationStream && !streamInMain ? presentationStream : callStream"
height="auto"
class="incomingFeedPrivate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import { HearingLayoutService } from 'src/app/services/hearing-layout.service';
import { createParticipantRemoteMuteStoreServiceSpy } from '../services/mock-participant-remote-mute-store.service';
import { ParticipantUpdated } from '../models/video-call-models';
import { PexipDisplayNameModel } from '../../services/conference/models/pexip-display-name.model';
import { WaitingRoomBaseDirective } from '../waiting-room-shared/waiting-room-base.component';
import { FEATURE_FLAGS } from 'src/app/services/launch-darkly.service';
import { ConferenceStatusMessage } from '../../services/models/conference-status-message';
import { audioRecordingServiceSpy } from '../../testing/mocks/mock-audio-recording.service';
Expand Down Expand Up @@ -482,7 +481,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
flush();

expect(videoCallService.startHearing).toHaveBeenCalledWith(component.conference.id, layout);
expect(component.hostWantsToJoinHearing).toBeTrue();
}));

it('should handle api error when start hearing fails', async () => {
Expand All @@ -498,7 +496,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
await component.joinHearingInSession();

expect(videoCallService.joinHearingInSession).toHaveBeenCalledWith(component.conferenceId, component.participant.id);
expect(component.shouldCurrentUserJoinHearing()).toBeTrue();
});

describe('Audio recording and alert notifications', () => {
Expand Down Expand Up @@ -617,7 +614,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
// Assert
expect(component.displayConfirmStartHearingPopup).toBeFalsy();
expect(videoCallService.startHearing).toHaveBeenCalledOnceWith(hearingId, hearingLayout);
expect(component.hostWantsToJoinHearing).toBeTrue();
}));

it('should not enable IM when hearing has not been initalised', () => {
Expand Down Expand Up @@ -660,15 +656,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
expect(component.conferenceStartedBy).toBe(null);
}));

it('should set shouldUpdateHostShowVideo to false when participant not connecting to pexip', async () => {
component.hostWantsToJoinHearing = true;
component.connected = false;

component.updateShowVideo();

expect(component.hostWantsToJoinHearing).toBeFalse();
});

it('should not pull the STAFFMEMBER in to the hearing when STAFFMEMBER is in Waiting Room and hearing started by the JUDGE', () => {
component.ngOnInit();
component.connected = true;
Expand All @@ -689,7 +676,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
component.conferenceStartedBy = component.conference.participants.find(p => p.role === Role.StaffMember).id;
component.participant = component.conference.participants.find(p => p.role === Role.StaffMember);
component.participant.status = ParticipantStatus.InHearing;
component.hostWantsToJoinHearing = true;
component.updateShowVideo();

expect(component.hearing.isInSession()).toBeTrue();
Expand All @@ -709,7 +695,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
component.conferenceStartedBy = component.conference.participants.find(p => p.role === Role.StaffMember).id;
component.participant = component.conference.participants.find(p => p.role === Role.StaffMember);
component.participant.status = ParticipantStatus.InConsultation;
component.hostWantsToJoinHearing = false;
component.updateShowVideo();

expect(component.hearing.isInSession()).toBeFalse();
Expand Down Expand Up @@ -994,38 +979,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
});
});

describe('shouldUnmuteForHearing', () => {
let superShouldUnmuteForHearing: jasmine.SpyObj<any>;

beforeEach(() => {
superShouldUnmuteForHearing = spyOn(WaitingRoomBaseDirective.prototype, 'shouldUnmuteForHearing');
});

it('should return false when super.shouldUnmuteForHearing is false hostWantsToJoinHearing is false', () => {
superShouldUnmuteForHearing.and.returnValue(false);
component.hostWantsToJoinHearing = false;
expect(component.shouldUnmuteForHearing()).toBe(false);
});

it('should return false when super.shouldUnmuteForHearing is false hostWantsToJoinHearing is true', () => {
superShouldUnmuteForHearing.and.returnValue(false);
component.hostWantsToJoinHearing = true;
expect(component.shouldUnmuteForHearing()).toBe(false);
});

it('should return false when super.shouldUnmuteForHearing is true hostWantsToJoinHearing is false', () => {
superShouldUnmuteForHearing.and.returnValue(true);
component.hostWantsToJoinHearing = false;
expect(component.shouldUnmuteForHearing()).toBe(false);
});

it('should return true when super.shouldUnmuteForHearing is true hostWantsToJoinHearing is true', () => {
superShouldUnmuteForHearing.and.returnValue(true);
component.hostWantsToJoinHearing = true;
expect(component.shouldUnmuteForHearing()).toBe(true);
});
});

describe('updateSpotlightStateOnParticipantDisconnectDuringConference', () => {
it('should do nothing if the conference is not in session', () => {
// Arrange
Expand Down Expand Up @@ -1128,11 +1081,6 @@ describe('JudgeWaitingRoomComponent when conference exists', () => {
// Assert
expect(videoControlCacheServiceSpy.setSpotlightStatus).toHaveBeenCalledOnceWith(participant.id, false);
});

it('should return hostWantsToJoinHearing false when leave hearing button has been clicked', () => {
component.leaveHearing();
expect(component.hostWantsToJoinHearing).toBeFalse();
});
});

describe('joinHearingClicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import { getCountdownComplete } from '../store/selectors/conference.selectors';
export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implements OnDestroy, OnInit {
continueWithNoRecording = false;
expanedPanel = true;
hostWantsToJoinHearing = false;
displayConfirmStartHearingPopup: boolean;
displayJoinHearingPopup: boolean;

Expand Down Expand Up @@ -325,7 +324,6 @@ export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implemen

this.hearingLayoutService.currentLayout$.pipe(take(1)).subscribe(async layout => {
try {
this.hostWantsToJoinHearing = true;
await this.videoCallService.startHearing(this.hearing.id, layout);
} catch (err) {
this.logger.error(`${this.loggerPrefixJudge} Failed to ${action} a hearing for conference`, err, {
Expand Down Expand Up @@ -364,17 +362,11 @@ export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implemen
}

async joinHearingInSession() {
this.hostWantsToJoinHearing = true;
await this.videoCallService.joinHearingInSession(this.conferenceId, this.participant.id);
}

shouldCurrentUserJoinHearing(): boolean {
return this.participant.status === ParticipantStatus.InHearing || this.hostWantsToJoinHearing;
}

resetVideoFlags() {
super.resetVideoFlags();
this.hostWantsToJoinHearing = false;
return this.participant.status === ParticipantStatus.InHearing;
}

audioRestartCallback(continueWithNoRecording: boolean) {
Expand Down Expand Up @@ -427,14 +419,6 @@ export class JudgeWaitingRoomComponent extends WaitingRoomBaseDirective implemen
}
}

leaveHearing() {
this.hostWantsToJoinHearing = false;
}

shouldUnmuteForHearing(): boolean {
return super.shouldUnmuteForHearing() && this.hostWantsToJoinHearing;
}

setTrapFocus() {
ModalTrapFocus.trap('video-container');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ <h1 #roomTitleLabel class="room-title-label">{{ getCaseNameAndNumber() }}</h1>
<video
appForcePlayVideo
id="incomingFeedPrivate"
[muted]="shouldMuteHearing()"
[srcObject]="presentationStream && !streamInMain ? presentationStream : callStream"
poster="/assets/images/empty_crest.jpg"
>
Expand Down
Loading