ref(mobile/external-api): skip event if conference exists

The change to mobile/external-api is required to not emit
CONFERENCE_FAILED for CONNECTION_FAILED if the conference has been
started, because base/conference state will still hold conference
instances which are to be ended by other means and result in the
appropriate event (which will adjust the base/conference state).
This commit is contained in:
paweldomas 2018-06-07 12:13:06 +02:00
parent 85fbaac9b2
commit b2f76f3ed6
1 changed files with 12 additions and 4 deletions

View File

@ -189,9 +189,9 @@ function _sendConferenceEvent(
/**
* Sends {@link CONFERENCE_FAILED} event when the {@link CONNECTION_FAILED}
* occurs. Otherwise the external API will not emit such event, because at this
* point conference has not been created yet and the base/conference feature
* will not emit it.
* occurs. It should be done only if the connection fails before the conference
* instance is created. Otherwise the eventual failure event is supposed to be
* emitted by the base/conference feature.
*
* @param {Store} store - The redux store.
* @param {Action} action - The redux action.
@ -199,8 +199,16 @@ function _sendConferenceEvent(
*/
function _sendConferenceFailedOnConnectionError(store, action) {
const { locationURL } = store.getState()['features/base/connection'];
const { connection } = action;
locationURL && _sendEvent(
locationURL
&& forEachConference(
store,
// If there's any conference in the base/conference state then the
// base/conference feature is supposed to emit a failure.
conference => conference.getConnection() !== connection)
&& _sendEvent(
store,
_getSymbolDescription(CONFERENCE_FAILED),
/* data */ {