From 2861d8d24e7d9b451b1aaff4f40475db6c1dbb45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 19 Apr 2018 19:24:16 +0200 Subject: [PATCH] =?UTF-8?q?misc:=20remove=20dead=20code=20=F0=9F=94=A5?= =?UTF-8?q?=F0=9F=94=A5=F0=9F=94=A5=20(#2844)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - old toolbox actions - chat command processor - room subject handling --- conference.js | 7 -- modules/UI/UI.js | 6 -- modules/UI/side_pannels/chat/Chat.js | 30 +------- modules/UI/side_pannels/chat/Commands.js | 94 ------------------------ react/features/toolbox/actionTypes.js | 32 -------- react/features/toolbox/actions.native.js | 32 -------- react/features/toolbox/actions.web.js | 3 - react/features/toolbox/reducer.js | 58 +-------------- service/UI/UIEvents.js | 1 - 9 files changed, 5 insertions(+), 258 deletions(-) delete mode 100644 modules/UI/side_pannels/chat/Commands.js diff --git a/conference.js b/conference.js index a1a70ef61..85d7d3071 100644 --- a/conference.js +++ b/conference.js @@ -2124,13 +2124,6 @@ export default { room.toggleRecording(options); }); - APP.UI.addListener(UIEvents.SUBJECT_CHANGED, topic => { - room.setSubject(topic); - }); - room.on(JitsiConferenceEvents.SUBJECT_CHANGED, subject => { - APP.UI.setSubject(subject); - }); - APP.UI.addListener(UIEvents.AUTH_CLICKED, () => { AuthHandler.authenticate(room); }); diff --git a/modules/UI/UI.js b/modules/UI/UI.js index dff014417..14582665a 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -444,12 +444,6 @@ UI.addRemoteStream = track => VideoLayout.onRemoteStreamAdded(track); */ UI.removeRemoteStream = track => VideoLayout.onRemoteStreamRemoved(track); -/** - * Update chat subject. - * @param {string} subject new chat subject - */ -UI.setSubject = subject => Chat.setSubject(subject); - /** * Setup and show Etherpad. * @param {string} name etherpad id diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js index 2481dec09..fc74b64f9 100644 --- a/modules/UI/side_pannels/chat/Chat.js +++ b/modules/UI/side_pannels/chat/Chat.js @@ -1,7 +1,6 @@ /* global APP, $ */ -import { processReplacements, linkify } from './Replacement'; -import CommandsProcessor from './Commands'; +import { processReplacements } from './Replacement'; import VideoLayout from '../../videolayout/VideoLayout'; import UIUtil from '../../util/UIUtil'; @@ -12,8 +11,7 @@ import { smileys } from './smileys'; import { addMessage, markAllRead } from '../../../../react/features/chat'; import { dockToolbox, - getToolboxHeight, - setSubject + getToolboxHeight } from '../../../../react/features/toolbox'; let unreadMessages = 0; @@ -235,15 +233,10 @@ const Chat = { usermsg.val('').trigger('autosize.resize'); this.focus();// eslint-disable-line no-invalid-this - const command = new CommandsProcessor(value, eventEmitter); - if (command.isCommand()) { - command.processCommand(); - } else { - const message = UIUtil.escapeHtml(value); + const message = UIUtil.escapeHtml(value); - eventEmitter.emit(UIEvents.MESSAGE_CREATED, message); - } + eventEmitter.emit(UIEvents.MESSAGE_CREATED, message); } }); @@ -351,21 +344,6 @@ const Chat = { { scrollTop: $('#chatconversation')[0].scrollHeight }, 1000); }, - /** - * Sets the subject to the UI - * @param subject the subject - */ - setSubject(subject) { - if (subject) { - // eslint-disable-next-line no-param-reassign - subject = subject.trim(); - } - - const html = linkify(UIUtil.escapeHtml(subject)); - - APP.store.dispatch(setSubject(html)); - }, - /** * Sets the chat conversation mode. * Conversation mode is the normal chat mode, non conversation mode is diff --git a/modules/UI/side_pannels/chat/Commands.js b/modules/UI/side_pannels/chat/Commands.js deleted file mode 100644 index 7602abf2e..000000000 --- a/modules/UI/side_pannels/chat/Commands.js +++ /dev/null @@ -1,94 +0,0 @@ -import UIUtil from '../../util/UIUtil'; -import UIEvents from '../../../../service/UI/UIEvents'; - -/** - * List with supported commands. The keys are the names of the commands and - * the value is the function that processes the message. - * @type {{String: function}} - */ -const commands = { - 'topic': processTopic -}; - -/** - * Extracts the command from the message. - * @param message the received message - * @returns {string} the command - */ -function getCommand(message) { - if (message) { - for (const command in commands) { - if (message.indexOf(`/${command}`) === 0) { - return command; - } - } - } - - return ''; -} - -/** - * Processes the data for topic command. - * @param commandArguments the arguments of the topic command. - */ -function processTopic(commandArguments, emitter) { - const topic = UIUtil.escapeHtml(commandArguments); - - emitter.emit(UIEvents.SUBJECT_CHANGED, topic); -} - -/** - * Constructs a new CommandProccessor instance from a message that - * handles commands received via chat messages. - * @param message the message - * @constructor - */ -function CommandsProcessor(message, emitter) { - const command = getCommand(message); - - this.emitter = emitter; - - /** - * Returns the name of the command. - * @returns {String} the command - */ - this.getCommand = function() { - return command; - }; - - - const messageArgument = message.substr(command.length + 2); - - /** - * Returns the arguments of the command. - * @returns {string} - */ - this.getArgument = function() { - return messageArgument; - }; -} - -/** - * Checks whether this instance is valid command or not. - * @returns {boolean} - */ -CommandsProcessor.prototype.isCommand = function() { - if (this.getCommand()) { - return true; - } - - return false; -}; - -/** - * Processes the command. - */ -CommandsProcessor.prototype.processCommand = function() { - if (!this.isCommand()) { - return; - } - - commands[this.getCommand()](this.getArgument(), this.emitter); -}; - -export default CommandsProcessor; diff --git a/react/features/toolbox/actionTypes.js b/react/features/toolbox/actionTypes.js index 542a86796..2caffea65 100644 --- a/react/features/toolbox/actionTypes.js +++ b/react/features/toolbox/actionTypes.js @@ -18,18 +18,6 @@ export const CLEAR_TOOLBOX_TIMEOUT = Symbol('CLEAR_TOOLBOX_TIMEOUT'); */ export const FULL_SCREEN_CHANGED = Symbol('FULL_SCREEN_CHANGED'); -/** - * The type of the action which sets the default toolbar buttons of the Toolbox. - * - * { - * type: SET_DEFAULT_TOOLBOX_BUTTONS, - * primaryToolbarButtons: Map, - * secondaryToolbarButtons: Map - * } - */ -export const SET_DEFAULT_TOOLBOX_BUTTONS - = Symbol('SET_DEFAULT_TOOLBOX_BUTTONS'); - /** * The type of (redux) action which requests full screen mode be entered or * exited. @@ -41,26 +29,6 @@ export const SET_DEFAULT_TOOLBOX_BUTTONS */ export const SET_FULL_SCREEN = Symbol('SET_FULL_SCREEN'); -/** - * The type of the action which sets the conference subject. - * - * { - * type: SET_SUBJECT, - * subject: string - * } - */ -export const SET_SUBJECT = Symbol('SET_SUBJECT'); - -/** - * The type of the action which sets the subject slide in. - * - * { - * type: SET_SUBJECT_SLIDE_IN, - * subjectSlideIn: boolean - * } - */ -export const SET_SUBJECT_SLIDE_IN = Symbol('SET_SUBJECT_SLIDE_IN'); - /** * The type of the action which sets the indicator which determiens whether a * fToolbar in the Toolbox is hovered. diff --git a/react/features/toolbox/actions.native.js b/react/features/toolbox/actions.native.js index a7b1b0b07..e669a99cb 100644 --- a/react/features/toolbox/actions.native.js +++ b/react/features/toolbox/actions.native.js @@ -2,8 +2,6 @@ import { CLEAR_TOOLBOX_TIMEOUT, - SET_SUBJECT, - SET_SUBJECT_SLIDE_IN, SET_TOOLBAR_HOVERED, SET_TOOLBOX_ALWAYS_VISIBLE, SET_TOOLBOX_ENABLED, @@ -26,36 +24,6 @@ export function clearToolboxTimeout(): Object { }; } -/** - * Signals that value of conference subject should be changed. - * - * @param {string} subject - Conference subject string. - * @returns {Object} - */ -export function setSubject(subject: string): Object { - return { - type: SET_SUBJECT, - subject - }; -} - -/** - * Signals that toolbox subject slide in value should be changed. - * - * @param {boolean} subjectSlideIn - True if the subject is shown; otherwise, - * false. - * @returns {{ - * type: SET_SUBJECT_SLIDE_IN, - * subjectSlideIn: boolean - * }} - */ -export function setSubjectSlideIn(subjectSlideIn: boolean): Object { - return { - type: SET_SUBJECT_SLIDE_IN, - subjectSlideIn - }; -} - /** * Signals that toolbar is hovered value should be changed. * diff --git a/react/features/toolbox/actions.web.js b/react/features/toolbox/actions.web.js index ae6f9ebae..78fd7c2d9 100644 --- a/react/features/toolbox/actions.web.js +++ b/react/features/toolbox/actions.web.js @@ -5,7 +5,6 @@ import SideContainerToggler import { clearToolboxTimeout, - setSubjectSlideIn, setToolboxTimeout, setToolboxTimeoutMS, setToolboxVisible @@ -98,7 +97,6 @@ export function hideToolbox(force: boolean = false): Function { timeoutMS)); } else { dispatch(setToolboxVisible(false)); - dispatch(setSubjectSlideIn(false)); } }; } @@ -137,7 +135,6 @@ export function showToolbox(timeout: number = 0): Object { if (enabled && !visible) { dispatch(setToolboxVisible(true)); - dispatch(setSubjectSlideIn(true)); // If the Toolbox is always visible, there's no need for a timeout // to toggle its visibility. diff --git a/react/features/toolbox/reducer.js b/react/features/toolbox/reducer.js index 2e60fa859..36d7af5d6 100644 --- a/react/features/toolbox/reducer.js +++ b/react/features/toolbox/reducer.js @@ -5,9 +5,6 @@ import { ReducerRegistry } from '../base/redux'; import { CLEAR_TOOLBOX_TIMEOUT, FULL_SCREEN_CHANGED, - SET_DEFAULT_TOOLBOX_BUTTONS, - SET_SUBJECT, - SET_SUBJECT_SLIDE_IN, SET_TOOLBAR_HOVERED, SET_TOOLBOX_ALWAYS_VISIBLE, SET_TOOLBOX_ENABLED, @@ -24,11 +21,8 @@ declare var interfaceConfig: Object; * @private * @returns {{ * alwaysVisible: boolean, + * enabled: boolean, * hovered: boolean, - * primaryToolbarButtons: Map, - * secondaryToolbarButtons: Map, - * subject: string, - * subjectSlideIn: boolean, * timeoutID: number, * timeoutMS: number, * visible: boolean @@ -68,34 +62,6 @@ function _getInitialState() { */ hovered: false, - /** - * A Map of the default buttons of the PrimaryToolbar. - * - * @type {Map} - */ - primaryToolbarButtons: new Map(), - - /** - * A Map of the default buttons of the SecondaryToolbar. - * - * @type {Map} - */ - secondaryToolbarButtons: new Map(), - - /** - * The text of the conference subject. - * - * @type {string} - */ - subject: '', - - /** - * The indicator which determines whether the subject is sliding in. - * - * @type {boolean} - */ - subjectSlideIn: false, - /** * A number, non-zero value which identifies the timer created by a call * to setTimeout() with timeoutMS. @@ -137,28 +103,6 @@ ReducerRegistry.register( fullScreen: action.fullScreen }; - case SET_DEFAULT_TOOLBOX_BUTTONS: { - const { primaryToolbarButtons, secondaryToolbarButtons } = action; - - return { - ...state, - primaryToolbarButtons, - secondaryToolbarButtons - }; - } - - case SET_SUBJECT: - return { - ...state, - subject: action.subject - }; - - case SET_SUBJECT_SLIDE_IN: - return { - ...state, - subjectSlideIn: action.subjectSlideIn - }; - case SET_TOOLBAR_HOVERED: return { ...state, diff --git a/service/UI/UIEvents.js b/service/UI/UIEvents.js index d2052242a..007bb42b3 100644 --- a/service/UI/UIEvents.js +++ b/service/UI/UIEvents.js @@ -70,7 +70,6 @@ export default { HANGUP: 'UI.hangup', LOGOUT: 'UI.logout', RECORDING_TOGGLED: 'UI.recording_toggled', - SUBJECT_CHANGED: 'UI.subject_changed', VIDEO_DEVICE_CHANGED: 'UI.video_device_changed', AUDIO_DEVICE_CHANGED: 'UI.audio_device_changed', AUDIO_OUTPUT_DEVICE_CHANGED: 'UI.audio_output_device_changed',