diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts
index d993571f..d64d1757 100644
--- a/front/src/Phaser/Game/GameScene.ts
+++ b/front/src/Phaser/Game/GameScene.ts
@@ -592,7 +592,7 @@ export class GameScene extends ResizableScene implements CenterListener {
}));
// When connection is performed, let's connect SimplePeer
- this.simplePeer = new SimplePeer(this.connection);
+ this.simplePeer = new SimplePeer(this.connection, !this.room.isPublic);
this.GlobalMessageManager = new GlobalMessageManager(this.connection);
const self = this;
diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts
index dfa6c694..eb65b555 100644
--- a/front/src/WebRtc/MediaManager.ts
+++ b/front/src/WebRtc/MediaManager.ts
@@ -342,7 +342,7 @@ export class MediaManager {
* @param reportCallBack
* @param userName
*/
- addActiveVideo(userId: string, reportCallBack: ReportCallback, userName: string = ""){
+ addActiveVideo(userId: string, reportCallBack: ReportCallback|undefined, userName: string = ""){
this.webrtcInAudio.play();
userName = userName.toUpperCase();
@@ -354,18 +354,22 @@ export class MediaManager {
${userName}
-
-
+ ` +
+ ((reportCallBack!==undefined)?`
`:'')
+ +
+ `
`;
layoutManager.add(DivImportance.Normal, userId, html);
- const reportBtn = this.getElementByIdOrFail(`report-${userId}`);
- reportBtn.addEventListener('click', (e: MouseEvent) => {
- e.preventDefault();
- this.showReportModal(userId, userName, reportCallBack);
- });
+ if (reportCallBack) {
+ const reportBtn = this.getElementByIdOrFail(`report-${userId}`);
+ reportBtn.addEventListener('click', (e: MouseEvent) => {
+ e.preventDefault();
+ this.showReportModal(userId, userName, reportCallBack);
+ });
+ }
this.remoteVideo.set(userId, this.getElementByIdOrFail(userId));
}
diff --git a/front/src/WebRtc/SimplePeer.ts b/front/src/WebRtc/SimplePeer.ts
index e9f507a0..5c77ab79 100644
--- a/front/src/WebRtc/SimplePeer.ts
+++ b/front/src/WebRtc/SimplePeer.ts
@@ -29,8 +29,6 @@ export interface PeerConnectionListener {
* This class manages connections to all the peers in the same group as me.
*/
export class SimplePeer {
- private Connection: RoomConnection;
- private WebRtcRoomId: string;
private Users: Array = new Array();
private PeerScreenSharingConnectionArray: Map = new Map();
@@ -40,9 +38,7 @@ export class SimplePeer {
private readonly stopLocalScreenSharingStreamCallback: StopScreenSharingCallback;
private readonly peerConnectionListeners: Array = new Array();
- constructor(Connection: RoomConnection, WebRtcRoomId: string = "test-webrtc") {
- this.Connection = Connection;
- this.WebRtcRoomId = WebRtcRoomId;
+ constructor(private Connection: RoomConnection, private enableReporting: boolean) {
// We need to go through this weird bound function pointer in order to be able to "free" this reference later.
this.sendLocalVideoStreamCallback = this.sendLocalVideoStream.bind(this);
this.sendLocalScreenSharingStreamCallback = this.sendLocalScreenSharingStream.bind(this);
@@ -148,9 +144,11 @@ export class SimplePeer {
mediaManager.removeActiveVideo("" + user.userId);
//TODO ad condition isPublic or annonyme
- mediaManager.addActiveVideo("" + user.userId, (comment: string) => {
- this.reportUser(user.userId, comment);
- }, name);
+ const reportCallback = this.enableReporting ? (comment: string) => {
+ this.reportUser(user.userId, comment);
+ }: undefined;
+
+ mediaManager.addActiveVideo("" + user.userId, reportCallback, name);
const peer = new VideoPeer(user.userId, user.initiator ? user.initiator : false, this.Connection);
// When a connection is established to a video stream, and if a screen sharing is taking place,