Merge pull request #3948 from KDSBrowne/x0-lint-Client

[HTML5] - Fix client lint issues
This commit is contained in:
Anton Georgiev 2017-05-25 13:57:04 -04:00 committed by GitHub
commit 250c6cdb8b
44 changed files with 214 additions and 169 deletions

View File

@ -35,7 +35,8 @@ export default class SIPBridge extends BaseAudioBridge {
}
};
// Checks periodically until a call is established so we can successfully end the call clean state
// Checks periodically until a call is established so we can successfully
// end the call clean state
triedHangup = false;
// function to initiate call

View File

@ -6,7 +6,10 @@ import SIPBridge from '../bridge/sip';
export default class AudioManager {
constructor(userData) {
const MEDIA_CONFIG = Meteor.settings.public.media;
const audioBridge = MEDIA_CONFIG.useSIPAudio ? new SIPBridge(userData) : new VertoBridge(userData);
const audioBridge = MEDIA_CONFIG.useSIPAudio
? new SIPBridge(userData)
: new VertoBridge(userData);
if (!(audioBridge instanceof BaseAudioBridge)) {
throw 'Audio Bridge not compatible';
}

View File

@ -136,7 +136,9 @@ export default function handleCaptionUpdate({ payload }) {
//every other object, so that Captions collection could be updated in a proper order
let tempObj = objectsToUpdate.splice(i, 1);
let extraString = tempObj[0].captionHistory.captions.slice(CAPTION_CHUNK_LENGTH);
tempObj[0].captionHistory.captions = tempObj[0].captionHistory.captions.slice(0, CAPTION_CHUNK_LENGTH);
tempObj[0].captionHistory.captions =
tempObj[0].captionHistory.captions.slice(0, CAPTION_CHUNK_LENGTH);
maxIndex += 1;
let tempIndex = tempObj[0].captionHistory.next;

View File

@ -5,9 +5,9 @@ import { BREAK_LINE } from '/imports/utils/lineEndings.js';
/**
* Remove any system message from the user with userId.
*
*
* @param {string} meetingId
* @param {string} userId
* @param {string} userId
*/
export default function clearUserSystemMessages(meetingId, userId) {
@ -18,9 +18,9 @@ export default function clearUserSystemMessages(meetingId, userId) {
const selector = {
meetingId,
"message.from_userid": CHAT_CONFIG.type_system,
"message.to_userid": userId,
}
'message.from_userid': CHAT_CONFIG.type_system,
'message.to_userid': userId,
};
return Chat.remove(selector, Logger.info(`Removing system messages from: (${userId})`));
};

View File

@ -4,7 +4,7 @@ import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import { isAllowedTo } from '/imports/startup/server/userPermissions';
Meteor.publish('chat', function(credentials) {
Meteor.publish('chat', function (credentials) {
if (!isAllowedTo('subscribeChat', credentials)) {
this.error(new Meteor.Error(402, "The user was not authorized to subscribe for 'chats'"));
}

View File

@ -3,9 +3,8 @@ import Meetings from '/imports/api/meetings';
const getConferenceBridge = () => {
const Meeting = Meetings.findOne();
return Meeting.voiceConf;
}
};
export {
getConferenceBridge,
}
};

View File

@ -4,7 +4,7 @@ import Polls from '/imports/api/polls';
import { check } from 'meteor/check';
import { logger } from '/imports/startup/server/logger';
Meteor.publish('polls', function(credentials) {
Meteor.publish('polls', function (credentials) {
//checking if it is allowed to see Poll Collection in general
if (!isAllowedTo('subscribePoll', credentials)) {
this.error(new Meteor.Error(402, "The user was not authorized to subscribe for 'polls'"));

View File

@ -29,7 +29,9 @@ export default function handleEmojiStatus({ payload }) {
}
if (numChanged) {
return Logger.info(`Assigned user emoji status '${status}' id=${userId} meeting=${meetingId}`);
return Logger.info('Assigned user emoji status'
+ status + ' id=' + userId + ' meeting=' + meetingId
);
}
};

View File

@ -28,7 +28,9 @@ export default function handleListeningOnly({ payload }) {
}
if (numChanged) {
return Logger.info(`Assigned listen only status '${listenOnly}' user=${userId} meeting=${meetingId}`);
return Logger.info(
`Assigned listen only status '${listenOnly}' user=${userId} meeting=${meetingId}`
);
}
};

View File

@ -50,7 +50,8 @@ export default function handleLockedStatusChange({ payload }) {
muteToggle(credentials, userId, true);
}
return Logger.info(`Assigned locked status '${isLocked ? 'locked' : 'unlocked'}' id=${userId} meeting=${meetingId}`);
return Logger.info(`Assigned locked status '${isLocked
? 'locked' : 'unlocked'}' id=${userId} meeting=${meetingId}`);
}
};

View File

@ -45,7 +45,9 @@ export default function handleValidateAuthToken({ payload }) {
addWelcomeChatMessage(meetingId, userId);
}
return Logger.info(`Validated auth token as '${validStatus}' user=${userId} meeting=${meetingId}`);
return Logger.info('Validated auth token as ' + validStatus +
+' user=' + userId + ' meeting=' + meetingId
);
}
};

View File

@ -36,7 +36,8 @@ export default function assignPresenter(credentials, userId) {
assigned_by: requesterUserId,
};
Logger.verbose(`User '${userId}' setted as presenter by '${requesterUserId}' from meeting '${meetingId}'`);
Logger.verbose(`User '${userId}' setted as presenterby '${
requesterUserId}' from meeting '${meetingId}'`);
return RedisPubSub.publish(CHANNEL, EVENT_NAME, payload);
};

View File

@ -57,7 +57,8 @@ export default function listenOnlyToggle(credentials, isJoining = true) {
name: User.user.name,
};
Logger.verbose(`User '${requesterUserId}' ${isJoining ? 'joined' : 'left'} global audio from meeting '${meetingId}'`);
Logger.verbose(`User '${requesterUserId}' ${isJoining
? 'joined' : 'left'} global audio from meeting '${meetingId}'`);
return RedisPubSub.publish(CHANNEL, EVENT_NAME, payload);
};

View File

@ -32,7 +32,8 @@ export default function muteToggle(credentials, userId, isMuted = true) {
requester_id: requesterUserId,
};
Logger.verbose(`User '${userId}' was ${!isMuted ? 'un' : ''}muted by '${requesterUserId}' from meeting '${meetingId}'`);
Logger.verbose(`User '${userId}' was ${!isMuted ? 'un' : ''}muted by '${
requesterUserId}' from meeting '${meetingId}'`);
return RedisPubSub.publish(CHANNEL, EVENT_NAME, payload);
};

View File

@ -25,7 +25,8 @@ export default function setEmojiStatus(credentials, userId, status) {
meeting_id: meetingId,
};
Logger.verbose(`User '${userId}' emoji status updated to '${status}' by '${requesterUserId}' from meeting '${meetingId}'`);
Logger.verbose(`User '${userId}' emoji status updated to '${status}' by '${
requesterUserId}' from meeting '${meetingId}'`);
return RedisPubSub.publish(CHANNEL, EVENT_NAME, payload);
};

View File

@ -42,7 +42,9 @@ export default function validateAuthToken(credentials) {
reply_to: `${meetingId}/${requesterUserId}`,
};
Logger.info(`User '${requesterUserId}' is trying to validate auth token for meeting '${meetingId}'`);
Logger.info(`User '${
requesterUserId
}' is trying to validate auth tokenfor meeting '${meetingId}'`);
return RedisPubSub.publish(CHANNEL, EVENT_NAME, payload, header);
};

View File

@ -29,7 +29,7 @@ export default function addUser(meetingId, user) {
dummyUser.clientType === 'HTML5' &&
user.role === ROLE_MODERATOR &&
!ALLOW_HTML5_MODERATOR) {
user.role = ROLE_VIEWER;
user.role = ROLE_VIEWER;
}
const modifier = {

View File

@ -32,7 +32,8 @@ export default function setConnectionStatus(meetingId, userId, status = 'online'
}
if (numChanged) {
return Logger.info(`Updated connection status user=${userId} status=${status} meeting=${meetingId}`);
return Logger.info(`Updated connection status user=${userId} status=${
status} meeting=${meetingId}`);
}
};

14
bigbluebutton-html5/imports/startup/client/auth.js Normal file → Executable file
View File

@ -46,7 +46,11 @@ export function authenticatedRouteHandler(nextState, replace, callback) {
Auth.authenticate()
.then(callback)
.catch(reason => {
logClient('error', { error: reason, method: 'authenticatedRouteHandler', credentialsSnapshot });
logClient('error', {
error: reason,
method: 'authenticatedRouteHandler',
credentialsSnapshot,
});
// make sure users who did not connect are not added to the meeting
// do **not** use the custom call - it relies on expired data
@ -77,8 +81,8 @@ function _addReconnectObservable() {
/**
* Check if should revalidate the auth
* @param {Object} status
* @param {String} lastStatus
* @param {Object} status
* @param {String} lastStatus
*/
export function shouldAuthenticate(status, lastStatus) {
return lastStatus != null && lastStatus === STATUS_CONNECTING && status.connected;
@ -86,8 +90,8 @@ export function shouldAuthenticate(status, lastStatus) {
/**
* Check if the isn't the first connection try, preventing to authenticate on login.
* @param {Object} status
* @param {string} lastStatus
* @param {Object} status
* @param {string} lastStatus
*/
export function updateStatus(status, lastStatus) {
return status.retryCount > 0 && lastStatus !== STATUS_CONNECTING ? status.status : lastStatus;

View File

@ -15,9 +15,9 @@ class IntlStartup extends Component {
this.state = {
messages: {},
appLocale : this.props.locale,
appLocale: this.props.locale,
};
this.fetchLocalizedMessages = this.fetchLocalizedMessages.bind(this);
}
@ -32,7 +32,7 @@ class IntlStartup extends Component {
if (response.ok) {
return response.json();
} else {
this.setState({appLocale: 'en'});
this.setState({ appLocale: 'en' });
return response.json();
}
})
@ -53,7 +53,7 @@ class IntlStartup extends Component {
componentWillUpdate(nextProps, nextState) {
if (this.props.locale !== nextProps.locale) {
this.setState({appLocale: nextProps.locale});
this.setState({ appLocale: nextProps.locale });
this.fetchLocalizedMessages(nextProps.locale);
}
}

View File

@ -128,17 +128,14 @@ export function isAllowedTo(action, credentials) {
userId,
});
const allowedToInitiateRequest =
user &&
const allowedToInitiateRequest = user &&
user.authToken === authToken &&
user.validated &&
user.clientType === 'HTML5' &&
user.user &&
user.user.connection_status === 'online';
const listOfSafeActions = [
'logoutSelf',
];
const listOfSafeActions = ['logoutSelf'];
const requestIsSafe = listOfSafeActions.includes(action);
@ -151,10 +148,10 @@ export function isAllowedTo(action, credentials) {
let result = false;
// check role specific actions
if ('MODERATOR' === user.user.role) {
if (user.user.role === 'MODERATOR') {
logger.debug('user permissions moderator case');
result = result || moderator[action];
} else if ('VIEWER' === user.user.role) {
} else if (user.user.role === 'VIEWER') {
logger.debug('user permissions viewer case');
result = result || viewer(meetingId, userId)[action];
}

View File

@ -17,13 +17,13 @@ class AboutContainer extends Component {
}
}
const getClientBuildInfo = () => {
const getClientBuildInfo = function () {
return {
clientBuild: Meteor.settings.public.app.html5ClientBuild,
copyright: Meteor.settings.public.app.copyright,
};
};
export default createContainer(() => {
export default createContainer(function () {
return getClientBuildInfo();
}, AboutContainer);

View File

@ -16,7 +16,7 @@ export default class ActionsBar extends Component {
return (
<div className={styles.actionsbar}>
<div className={styles.left}>
<ActionsDropdown {...{isUserPresenter}}/>
<ActionsDropdown {...{ isUserPresenter }}/>
</div>
<div className={styles.center}>
<MuteAudioContainer />

View File

@ -47,7 +47,9 @@ class EmojiMenu extends Component {
// even after the DropdownTrigger inject an onClick handler
onClick={() => null}>
<div id="currentStatus" hidden>
{intl.formatMessage(intlMessages.currentStatusDesc, { 0: userEmojiStatus}) }
{
intl.formatMessage(intlMessages.currentStatusDesc, { 0: userEmojiStatus })
}
</div>
</Button>
</DropdownTrigger>
@ -223,7 +225,7 @@ const intlMessages = defineMessages({
currentStatusDesc: {
id: 'app.actionsBar.currentStatusDesc',
description: 'Aria description for status button',
}
},
});
EmojiMenu.propTypes = propTypes;

View File

@ -16,7 +16,7 @@ export default class JoinVideo extends React.Component {
icon={'video_off'}
size={'lg'}
circle={true}
style={{visibility: 'hidden'}}
style={{ visibility: 'hidden' }}
/>
);
}

View File

@ -16,7 +16,7 @@ class AudioTestContainer extends Component {
}
}
export default createContainer(() => {
export default createContainer(function () {
return {
handlePlayAudioSample: () => {
const snd = new Audio('resources/sounds/audioSample.mp3');

View File

@ -123,9 +123,9 @@ class MessageForm extends Component {
disabled={disabled}
label={intl.formatMessage(messages.submitLabel)}
hideLabel={true}
icon={"send"}
onClick={()=>{}}
/>
icon={'send'}
onClick={this.handleMessageKeyDown({ keyCode: 13 })}
/>
</form>
);
}

View File

@ -97,8 +97,8 @@ const getUser = (userID, userName) => {
if (!user) {
return null;
}
return mapUser(user.user);
return mapUser(user.user);
};
const getPublicMessages = () => {

View File

@ -17,6 +17,6 @@ class ClosedCaptionsContainer extends Component {
}
}
export default createContainer(() => {
export default createContainer(function () {
return ClosedCaptionsService.getCCData();
}, ClosedCaptionsContainer);

View File

@ -1,6 +1,6 @@
import React, { Component, PropTypes } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import Button from '/imports/ui/components/button/component'
import Button from '/imports/ui/components/button/component';
import styles from './styles.scss';
@ -63,7 +63,11 @@ class ErrorScreen extends Component {
{children}
</div>
<div className={styles.content}>
<Button size={"sm"} label={intl.formatMessage(intlMessages.leave)} onClick={this.onClick}/>
<Button
size={'sm'}
onClick={this.onClick}
label={intl.formatMessage(intlMessages.leave)}
/>
</div>
</div>
);

View File

@ -1,59 +1,63 @@
import React, { Component } from 'react';
import SettingsDropdown from './component';
import Service from './service';
export default class SettingsDropdownContainer extends Component {
constructor(props) {
super(props);
this.state = {
isFullScreen: false,
};
this.handleFullscreenChange = this.handleFullscreenChange.bind(this);
}
componentDidMount() {
const fullscreenChangedEvents = ['fullscreenchange',
'webkitfullscreenchange',
'mozfullscreenchange',
'MSFullscreenChange',];
fullscreenChangedEvents.forEach(event =>
document.addEventListener(event, this.handleFullscreenChange));
}
componentWillUnmount() {
const fullscreenChangedEvents = ['fullscreenchange',
'webkitfullscreenchange',
'mozfullscreenchange',
'MSFullscreenChange',];
fullscreenChangedEvents.forEach(event =>
document.removeEventListener(event, this.fullScreenToggleCallback));
}
handleFullscreenChange() {
if (document.fullscreenElement
|| document.webkitFullscreenElement
|| document.mozFullScreenElement
|| document.msFullscreenElement) {
this.setState({ isFullScreen: true });
} else {
this.setState({ isFullScreen: false });
}
}
render() {
const handleToggleFullscreen = Service.toggleFullScreen;
const isFullScreen = this.state.isFullScreen;
return (
<SettingsDropdown
handleToggleFullscreen={handleToggleFullscreen}
isFullScreen={isFullScreen}
/>
);
}
}
import React, { Component } from 'react';
import SettingsDropdown from './component';
import Service from './service';
export default class SettingsDropdownContainer extends Component {
constructor(props) {
super(props);
this.state = {
isFullScreen: false,
};
this.handleFullscreenChange = this.handleFullscreenChange.bind(this);
}
componentDidMount() {
const fullscreenChangedEvents = [
'fullscreenchange',
'webkitfullscreenchange',
'mozfullscreenchange',
'MSFullscreenChange',
];
fullscreenChangedEvents.forEach(event =>
document.addEventListener(event, this.handleFullscreenChange));
}
componentWillUnmount() {
const fullscreenChangedEvents = [
'fullscreenchange',
'webkitfullscreenchange',
'mozfullscreenchange',
'MSFullscreenChange',
];
fullscreenChangedEvents.forEach(event =>
document.removeEventListener(event, this.fullScreenToggleCallback));
}
handleFullscreenChange() {
if (document.fullscreenElement
|| document.webkitFullscreenElement
|| document.mozFullScreenElement
|| document.msFullscreenElement) {
this.setState({ isFullScreen: true });
} else {
this.setState({ isFullScreen: false });
}
}
render() {
const handleToggleFullscreen = Service.toggleFullScreen;
const isFullScreen = this.state.isFullScreen;
return (
<SettingsDropdown
handleToggleFullscreen={handleToggleFullscreen}
isFullScreen={isFullScreen}
/>
);
}
}

View File

@ -1,35 +1,34 @@
toggleFullScreen = () => {
let element = document.documentElement;
if (document.fullscreenElement
|| document.webkitFullscreenElement
|| document.mozFullScreenElement
|| document.msFullscreenElement) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
// If the page is not currently fullscreen, make fullscreen
} else {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
};
export {
toggleFullScreen,
};
toggleFullScreen = () => {
let element = document.documentElement;
if (document.fullscreenElement
|| document.webkitFullscreenElement
|| document.mozFullScreenElement
|| document.msFullscreenElement) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
// If the page is not currently fullscreen, make fullscreen
} else {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
};
export {
toggleFullScreen,
};

View File

@ -18,7 +18,7 @@ class SettingsContainer extends Component {
}
}
export default createContainer(() => {
export default createContainer(function () {
return {
audio: SettingsService.audio,
video: SettingsService.video,

View File

@ -29,7 +29,7 @@ const updateSettings = (obj) => {
Settings.save();
};
const getAvailableLocales = () => {
const getAvailableLocales = function () {
return fetch('/html5client/locales').then(locales => locales.json());
};

View File

@ -194,7 +194,10 @@ class ApplicationMenu extends BaseMenu {
) : null }
</select>
</div>
<div id="changeLangLabel" aria-label={intl.formatMessage(intlMessages.ariaLanguageLabel)}></div>
<div
id="changeLangLabel"
aria-label={intl.formatMessage(intlMessages.ariaLanguageLabel)}>
</div>
</div>
</div>
<hr className={styles.separator}/>

View File

@ -13,7 +13,7 @@ class ApplicationContainer extends Component {
);
}
}
export default createContainer(() => {
export default createContainer(function () {
return {
fontSizes: [
'12px',

View File

@ -13,6 +13,6 @@ class ClosedCaptionsMenuContainer extends Component {
}
}
export default createContainer(() => {
export default createContainer(function () {
return Service.getClosedCaptionSettings();
}, ClosedCaptionsMenuContainer);

View File

@ -164,7 +164,7 @@ const userFindSorting = {
const getUsers = () => {
let users = Users
.find({ "user.connection_status": 'online' }, userFindSorting)
.find({ 'user.connection_status': 'online' }, userFindSorting)
.fetch();
return users

View File

@ -401,7 +401,11 @@ class UserListItem extends Component {
userNameSub = userNameSub.join(' ');
const { disablePrivateChat, disableCam, disableMic, lockedLayout, disablePublicChat } = meeting.roomLockSettings;
const { disablePrivateChat,
disableCam,
disableMic,
loSckedLayout,
disablePublicChat, } = meeting.roomLockSettings;
return (
<div className={styles.userName}>

2
bigbluebutton-html5/imports/ui/services/auth/index.js Executable file → Normal file
View File

@ -201,4 +201,4 @@ class Auth {
};
let AuthSingleton = new Auth();
export default AuthSingleton;
export default AuthSingleton;

View File

@ -3,21 +3,21 @@ import { check } from 'meteor/check';
let collection = new Mongo.Collection(null);
function findById(notificationId) {
check(notificationId, String);
collection.find({ notificationId });
check(notificationId, String);
collection.find({ notificationId });
}
function add(notification) {
check(notification.notification, String);
collection.insert(notification);
check(notification.notification, String);
collection.insert(notification);
}
function remove(notificationId) {
check(notificationId, String);
collection.remove({ notificationId });
check(notificationId, String);
collection.remove({ notificationId });
}
const NotificationCollection = {findById, add, remove,};
const NotificationCollection = { findById, add, remove, };
export default NotificationCollection;

View File

@ -7,28 +7,28 @@ class NotificationService {
* @param {Object} database
*/
constructor(database) {
this.database = database;
this.database = database;
}
/**
* @param {string} notificationID
*/
get(notificationID) {
this.database.findById(notificationID);
this.database.findById(notificationID);
}
/**
* @param {Object} notification
*/
add(notification) {
this.database.add(notification);
this.database.add(notification);
}
/**
* @param {string} notificationID
*/
remove(notificationID) {
this.database.remove(notificationID);
this.database.remove(notificationID);
}
}

View File

@ -1,4 +1,13 @@
const EMOJI_STATUSES = ['away', 'raiseHand', 'neutral', 'confused', 'sad',
'happy', 'applause', 'thumbsUp', 'thumbsDown'];
const EMOJI_STATUSES = [
'away',
'raiseHand',
'neutral',
'confused',
'sad',
'happy',
'applause',
'thumbsUp',
'thumbsDown',
];
export { EMOJI_STATUSES };