misc: remove dead code 🔥🔥🔥 (#2844)

- old toolbox actions
- chat command processor
- room subject handling
This commit is contained in:
Saúl Ibarra Corretgé 2018-04-19 19:24:16 +02:00 committed by virtuacoplenny
parent 172342cac3
commit 2861d8d24e
9 changed files with 5 additions and 258 deletions

View File

@ -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);
});

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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.
*

View File

@ -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.

View File

@ -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,

View File

@ -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',