|
|
|
@ -6,6 +6,7 @@ import MiddlewareRegistry from '../base/redux/MiddlewareRegistry'; |
|
|
|
|
import StateListenerRegistry from '../base/redux/StateListenerRegistry'; |
|
|
|
|
import { playSound } from '../base/sounds/actions'; |
|
|
|
|
import { INCOMING_MSG_SOUND_ID } from '../chat/constants'; |
|
|
|
|
import { arePollsDisabled } from '../conference/functions.any'; |
|
|
|
|
import { showNotification } from '../notifications/actions'; |
|
|
|
|
import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants'; |
|
|
|
|
|
|
|
|
@ -69,7 +70,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { |
|
|
|
|
...data, |
|
|
|
|
senderId: isNewPoll ? user._id : undefined, |
|
|
|
|
voterId: isNewPoll ? undefined : user._id |
|
|
|
|
}, dispatch); |
|
|
|
|
}, dispatch, getState); |
|
|
|
|
}); |
|
|
|
|
conference.on(JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED, |
|
|
|
|
(id: any, data: any) => { |
|
|
|
@ -79,7 +80,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { |
|
|
|
|
...data, |
|
|
|
|
senderId: isNewPoll ? id : undefined, |
|
|
|
|
voterId: isNewPoll ? undefined : id |
|
|
|
|
}, dispatch); |
|
|
|
|
}, dispatch, getState); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
@ -89,6 +90,11 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { |
|
|
|
|
case RECEIVE_POLL: { |
|
|
|
|
|
|
|
|
|
const state = getState(); |
|
|
|
|
|
|
|
|
|
if (arePollsDisabled(state)) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const isChatOpen: boolean = state['features/chat'].isOpen; |
|
|
|
|
const isPollsTabFocused: boolean = state['features/chat'].isPollsTabFocused; |
|
|
|
|
|
|
|
|
@ -109,10 +115,15 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { |
|
|
|
|
* |
|
|
|
|
* @param {Object} data - The json data carried by the polls message. |
|
|
|
|
* @param {Function} dispatch - The dispatch function. |
|
|
|
|
* @param {Function} getState - The getState function. |
|
|
|
|
* |
|
|
|
|
* @returns {void} |
|
|
|
|
*/ |
|
|
|
|
function _handleReceivePollsMessage(data: any, dispatch: IStore['dispatch']) { |
|
|
|
|
function _handleReceivePollsMessage(data: any, dispatch: IStore['dispatch'], getState: IStore['getState']) { |
|
|
|
|
if (arePollsDisabled(getState())) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (data.type) { |
|
|
|
|
case COMMAND_NEW_POLL: { |
|
|
|
|
const { question, answers, pollId, senderId } = data; |
|
|
|
|