From 9ef83b8dc009d709f3967b41d277de4b31daf8b1 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 1 Jul 2017 14:58:46 +0100 Subject: [PATCH] de-lint views/voip/* Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .eslintignore.errorfiles | 4 --- src/components/views/voip/CallView.js | 29 ++++++++--------- src/components/views/voip/IncomingCallBox.js | 23 ++++++-------- src/components/views/voip/VideoFeed.js | 2 +- src/components/views/voip/VideoView.js | 33 ++++++++++---------- 5 files changed, 41 insertions(+), 50 deletions(-) diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index 3d4207caa2..55eaf75e4b 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -111,10 +111,6 @@ src/components/views/settings/ChangePassword.js src/components/views/settings/DevicesPanel.js src/components/views/settings/DevicesPanelEntry.js src/components/views/settings/EnableNotificationsButton.js -src/components/views/voip/CallView.js -src/components/views/voip/IncomingCallBox.js -src/components/views/voip/VideoFeed.js -src/components/views/voip/VideoView.js src/ContentMessages.js src/HtmlUtils.js src/ImageUtils.js diff --git a/src/components/views/voip/CallView.js b/src/components/views/voip/CallView.js index b53794637f..e669f7e0a6 100644 --- a/src/components/views/voip/CallView.js +++ b/src/components/views/voip/CallView.js @@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -var React = require("react"); -var dis = require("../../../dispatcher"); -var CallHandler = require("../../../CallHandler"); -var sdk = require('../../../index'); -var MatrixClientPeg = require("../../../MatrixClientPeg"); +import React from 'react'; +import dis from '../../../dispatcher'; +import CallHandler from '../../../CallHandler'; +import sdk from '../../../index'; +import MatrixClientPeg from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; module.exports = React.createClass({ @@ -73,10 +73,10 @@ module.exports = React.createClass({ }, showCall: function() { - var call; + let call; if (this.props.room) { - var roomId = this.props.room.roomId; + const roomId = this.props.room.roomId; call = CallHandler.getCallForRoom(roomId) || (this.props.ConferenceHandler ? this.props.ConferenceHandler.getConferenceCallForRoom(roomId) : @@ -86,9 +86,7 @@ module.exports = React.createClass({ if (this.call) { this.setState({ call: call }); } - - } - else { + } else { call = CallHandler.getAnyActiveCall(); this.setState({ call: call }); } @@ -109,8 +107,7 @@ module.exports = React.createClass({ call.confUserId ? "none" : "block" ); this.getVideoView().getRemoteVideoElement().style.display = "block"; - } - else { + } else { this.getVideoView().getLocalVideoElement().style.display = "none"; this.getVideoView().getRemoteVideoElement().style.display = "none"; dis.dispatch({action: 'video_fullscreen', fullscreen: false}); @@ -126,11 +123,11 @@ module.exports = React.createClass({ }, render: function() { - var VideoView = sdk.getComponent('voip.VideoView'); + const VideoView = sdk.getComponent('voip.VideoView'); - var voice; + let voice; if (this.state.call && this.state.call.type === "voice" && this.props.showVoice) { - var callRoom = MatrixClientPeg.get().getRoom(this.state.call.roomId); + const callRoom = MatrixClientPeg.get().getRoom(this.state.call.roomId); voice = (
{_t("Active call (%(roomName)s)", {roomName: callRoom.name})} @@ -147,6 +144,6 @@ module.exports = React.createClass({ { voice }
); - } + }, }); diff --git a/src/components/views/voip/IncomingCallBox.js b/src/components/views/voip/IncomingCallBox.js index 1b806fc5b3..c5934b74dc 100644 --- a/src/components/views/voip/IncomingCallBox.js +++ b/src/components/views/voip/IncomingCallBox.js @@ -13,10 +13,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -var React = require('react'); -var MatrixClientPeg = require('../../../MatrixClientPeg'); -var dis = require("../../../dispatcher"); -var CallHandler = require("../../../CallHandler"); +import React from 'react'; +import MatrixClientPeg from '../../../MatrixClientPeg'; +import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; module.exports = React.createClass({ @@ -29,34 +28,32 @@ module.exports = React.createClass({ onAnswerClick: function() { dis.dispatch({ action: 'answer', - room_id: this.props.incomingCall.roomId + room_id: this.props.incomingCall.roomId, }); }, onRejectClick: function() { dis.dispatch({ action: 'hangup', - room_id: this.props.incomingCall.roomId + room_id: this.props.incomingCall.roomId, }); }, render: function() { - var room = null; + let room = null; if (this.props.incomingCall) { room = MatrixClientPeg.get().getRoom(this.props.incomingCall.roomId); } - var caller = room ? room.name : _t("unknown caller"); + const caller = room ? room.name : _t("unknown caller"); let incomingCallText = null; if (this.props.incomingCall) { if (this.props.incomingCall.type === "voice") { incomingCallText = _t("Incoming voice call from %(name)s", {name: caller}); - } - else if (this.props.incomingCall.type === "video") { + } else if (this.props.incomingCall.type === "video") { incomingCallText = _t("Incoming video call from %(name)s", {name: caller}); - } - else { + } else { incomingCallText = _t("Incoming call from %(name)s", {name: caller}); } } @@ -81,6 +78,6 @@ module.exports = React.createClass({ ); - } + }, }); diff --git a/src/components/views/voip/VideoFeed.js b/src/components/views/voip/VideoFeed.js index 0b8d0b20fc..953dbc866f 100644 --- a/src/components/views/voip/VideoFeed.js +++ b/src/components/views/voip/VideoFeed.js @@ -16,7 +16,7 @@ limitations under the License. 'use strict'; -var React = require('react'); +import React from 'react'; module.exports = React.createClass({ displayName: 'VideoFeed', diff --git a/src/components/views/voip/VideoView.js b/src/components/views/voip/VideoView.js index ea37579237..6ebf2078c1 100644 --- a/src/components/views/voip/VideoView.js +++ b/src/components/views/voip/VideoView.js @@ -16,11 +16,11 @@ limitations under the License. 'use strict'; -var React = require('react'); -var ReactDOM = require('react-dom'); +import React from 'react'; +import ReactDOM from 'react-dom'; -var sdk = require('../../../index'); -var dis = require('../../../dispatcher'); +import sdk from '../../../index'; +import dis from '../../../dispatcher'; module.exports = React.createClass({ displayName: 'VideoView', @@ -53,9 +53,10 @@ module.exports = React.createClass({ // this needs to be somewhere at the top of the DOM which // always exists to avoid audio interruptions. // Might as well just use DOM. - var remoteAudioElement = document.getElementById("remoteAudio"); + const remoteAudioElement = document.getElementById("remoteAudio"); if (!remoteAudioElement) { - console.error("Failed to find remoteAudio element - cannot play audio! You need to add an