From 25047f57a9562af317471ad77960e2ed4b507b1d Mon Sep 17 00:00:00 2001
From: Tainan Felipe <tainanfelipe214@gmail.com>
Date: Wed, 24 Apr 2019 14:19:35 -0300
Subject: [PATCH] Remove stop video button of video modal

---
 .../actions-dropdown/component.jsx            |  3 +-
 .../ui/components/actions-bar/component.jsx   |  2 ++
 .../ui/components/actions-bar/container.jsx   |  2 ++
 .../external-video-player/modal/component.jsx | 30 +++----------------
 .../external-video-player/modal/container.jsx |  3 +-
 .../external-video-player/modal/styles.scss   | 25 +---------------
 bigbluebutton-html5/private/locales/en.json   |  1 -
 7 files changed, 12 insertions(+), 54 deletions(-)

diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx
index 27514cf55b..22f4602b83 100755
--- a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx
@@ -107,6 +107,7 @@ class ActionsDropdown extends Component {
       allowExternalVideo,
       handleTakePresenter,
       isSharingVideo,
+      stopExternalVideoShare,
     } = this.props;
 
     const {
@@ -168,7 +169,7 @@ class ActionsDropdown extends Component {
               : intl.formatMessage(intlMessages.stopExternalVideoLabel)}
             description="External Video"
             key="external-video"
-            onClick={this.handleExternalVideoClick}
+            onClick={isSharingVideo ? stopExternalVideoShare : this.handleExternalVideoClick}
           />
         )
         : null),
diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx
index 37880b7e93..2a8120b625 100755
--- a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx
@@ -31,6 +31,7 @@ class ActionsBar extends React.PureComponent {
       parseCurrentSlideContent,
       isSharingVideo,
       screenShareEndAlert,
+      stopExternalVideoShare,
     } = this.props;
 
     const {
@@ -59,6 +60,7 @@ class ActionsBar extends React.PureComponent {
             handleTakePresenter,
             intl,
             isSharingVideo,
+            stopExternalVideoShare,
           }}
           />
           <QuickPollDropdown
diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx
index 821fa91e5c..cadcf4155d 100644
--- a/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx
@@ -8,6 +8,7 @@ import PresentationService from '/imports/ui/components/presentation/service';
 import ActionsBar from './component';
 import Service from './service';
 import VideoService from '../video-provider/service';
+import ExternalVideoService from '/imports/ui/components/external-video-player/service';
 import {
   shareScreen, unshareScreen, isVideoBroadcasting, screenShareEndAlert,
 } from '../screenshare/service';
@@ -32,6 +33,7 @@ export default withTracker(() => {
   return {
     isUserPresenter: Service.isUserPresenter(),
     isUserModerator: Service.isUserModerator(),
+    stopExternalVideoShare: ExternalVideoService.stopWatching,
     handleExitVideo: () => VideoService.exitVideo(),
     handleJoinVideo: () => VideoService.joinVideo(),
     handleShareScreen: onFail => shareScreen(onFail),
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 7e26af5c7c..0d0c2c1619 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
@@ -14,10 +14,6 @@ const intlMessages = defineMessages({
     id: 'app.externalVideo.start',
     description: 'Share youtube video',
   },
-  stop: {
-    id: 'app.externalVideo.stop',
-    description: 'Stop sharing video',
-  },
   urlError: {
     id: 'app.externalVideo.urlError',
     description: 'Not a video URL error',
@@ -56,7 +52,6 @@ class ExternalVideoModal extends Component {
     };
 
     this.startWatchingHandler = this.startWatchingHandler.bind(this);
-    this.stopWatchingHandler = this.stopWatchingHandler.bind(this);
     this.updateVideoUrlHandler = this.updateVideoUrlHandler.bind(this);
     this.renderUrlError = this.renderUrlError.bind(this);
     this.updateVideoUrlHandler = this.updateVideoUrlHandler.bind(this);
@@ -70,13 +65,6 @@ class ExternalVideoModal extends Component {
     closeModal();
   }
 
-  stopWatchingHandler() {
-    const { stopWatching, closeModal } = this.props;
-
-    stopWatching();
-    closeModal();
-  }
-
   updateVideoUrlHandler(ev) {
     this.setState({ url: ev.target.value });
   }
@@ -146,20 +134,10 @@ class ExternalVideoModal extends Component {
           </div>
 
           <Button
-            className={
-              sharing
-                ? styles.stopBtn
-                : styles.startBtn
-            }
-            label={
-              sharing
-                ? intl.formatMessage(intlMessages.stop)
-                : intl.formatMessage(intlMessages.start)}
-            onClick={
-              sharing
-                ? this.stopWatchingHandler
-                : this.startWatchingHandler}
-            disabled={!sharing && startDisabled}
+            className={styles.startBtn}
+            label={intl.formatMessage(intlMessages.start)}
+            onClick={this.startWatchingHandler}
+            disabled={startDisabled}
           />
         </div>
       </ModalBase>
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 d97e542a50..c99597273c 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
@@ -2,7 +2,7 @@ import React from 'react';
 import { withTracker } from 'meteor/react-meteor-data';
 import { withModalMounter } from '/imports/ui/components/modal/service';
 import ExternalVideoModal from './component';
-import { startWatching, stopWatching, getVideoId } from '../service';
+import { startWatching, getVideoId } from '../service';
 
 const ExternalVideoModalContainer = props => <ExternalVideoModal {...props} />;
 
@@ -11,6 +11,5 @@ export default withModalMounter(withTracker(({ mountModal }) => ({
     mountModal(null);
   },
   startWatching,
-  stopWatching,
   videoId: getVideoId(),
 }))(ExternalVideoModalContainer));
diff --git a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/styles.scss b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/styles.scss
index a045330d45..e5fe49bf34 100755
--- a/bigbluebutton-html5/imports/ui/components/external-video-player/modal/styles.scss
+++ b/bigbluebutton-html5/imports/ui/components/external-video-player/modal/styles.scss
@@ -68,14 +68,9 @@
   font-size: var(--font-size-large);
 }
 
-.startBtn,
-.stopBtn {
+.startBtn {
   display: flex;
   align-self: center;
-}
-
-
-.startBtn {
   &:focus {
     outline: none !important;
   }
@@ -93,24 +88,6 @@
   background-color: var(--color-link) !important;
 }
 
-.stopBtn {
-  &:focus {
-    outline: none !important;
-  }
-
-  i{
-    color: red;
-  }
-
-
-  width: 40%;
-  display: block;
-  position: absolute;
-  bottom:   20px;
-  color: var(--color-white) !important;
-  background-color: red !important;
-}
-
 .title {
   text-align: center;
   font-weight: 400;
diff --git a/bigbluebutton-html5/private/locales/en.json b/bigbluebutton-html5/private/locales/en.json
index 352761bb03..2a769ccd4c 100755
--- a/bigbluebutton-html5/private/locales/en.json
+++ b/bigbluebutton-html5/private/locales/en.json
@@ -573,7 +573,6 @@
     "app.createBreakoutRoom.leastOneWarnBreakout": "You must place at least one user in a breakout room.",
     "app.createBreakoutRoom.modalDesc": "Complete the steps below to create rooms in your session, To add participants to a room.",
     "app.externalVideo.start": "Share a new video",
-    "app.externalVideo.stop": "Stop sharing video",
     "app.externalVideo.title": "Share a YouTube video",
     "app.externalVideo.input": "YouTube video URL",
     "app.externalVideo.urlInput": "Add YouTube URL",
-- 
GitLab