From f548281a078b1c713f7d9007e46ee00b07b0b00c Mon Sep 17 00:00:00 2001
From: Lucas Zawacki <lfzawacki@gmail.com>
Date: Fri, 13 Sep 2019 18:30:18 -0300
Subject: [PATCH] Fix random swappings happening outside of the media service

---
 .../ui/components/actions-bar/component.jsx   | 27 ++++++++++---------
 .../external-video-player/modal/component.jsx |  2 --
 .../external-video-player/modal/container.jsx |  3 ---
 3 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx
index ce24a364b8..e55b04a570 100755
--- a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx
@@ -20,20 +20,21 @@ class ActionsBar extends PureComponent {
       isVideoBroadcasting,
     } = this.props;
 
-    if (!isThereCurrentPresentation && !isSharingVideo && !isVideoBroadcasting) {
-      if (!getSwapLayout()) {
-        toggleSwapLayout();
-      }
-    }
+    //  TODO: THIS BREAKS AUTO SWAP BIGLY AND SHOULD BE FIXED IN MEDIA CONTAINER
+    //    if (!isThereCurrentPresentation && !isSharingVideo && !isVideoBroadcasting) {
+    //      if (!getSwapLayout()) {
+    //        toggleSwapLayout();
+    //      }
+    //    }
 
-    if (!prevIsThereCurrPresentation
-      && isThereCurrentPresentation
-      && !isSharingVideo
-      && !isVideoBroadcasting) {
-      if (getSwapLayout()) {
-        toggleSwapLayout();
-      }
-    }
+    //    if (!prevIsThereCurrPresentation
+    //      && isThereCurrentPresentation
+    //      && !isSharingVideo
+    //      && !isVideoBroadcasting) {
+    //      if (getSwapLayout()) {
+    //        toggleSwapLayout();
+    //      }
+    //    }
   }
 
   render() {
diff --git a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx
index 33846be633..d93b215845 100644
--- a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/component.jsx
@@ -60,14 +60,12 @@ class ExternalVideoModal extends Component {
     const {
       startWatching,
       closeModal,
-      toggleLayout,
       isSwapped,
     } = this.props;
 
     const { url } = this.state;
 
     startWatching(url.trim());
-    if (isSwapped) toggleLayout();
     closeModal();
   }
 
diff --git a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/container.jsx b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/container.jsx
index 6d53925557..9df57b0e62 100644
--- a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/container.jsx
@@ -3,7 +3,6 @@ import { withTracker } from 'meteor/react-meteor-data';
 import { withModalMounter } from '/imports/ui/components/modal/service';
 import ExternalVideoModal from './component';
 import { startWatching, getVideoUrl } from '../service';
-import mediaService from '/imports/ui/components/media/service';
 
 const ExternalVideoModalContainer = props => <ExternalVideoModal {...props} />;
 
@@ -13,6 +12,4 @@ export default withModalMounter(withTracker(({ mountModal }) => ({
   },
   startWatching,
   videoUrl: getVideoUrl(),
-  toggleLayout: mediaService.toggleSwapLayout,
-  isSwapped: mediaService.getSwapLayout(),
 }))(ExternalVideoModalContainer));
-- 
GitLab