mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-14 14:37:47 +00:00
* Additional setting to order participants in speaker stats #9742 * Setting to order speaker stats optimisations #9742 * Lint fixes #9742 * Replace APP references #9742 * Lint fixes #9742 * Setting to order speaker stats optimisations 2 #9742 * Lint fixes #9742 * Remove unnecessary param #9742 * Add more speaker-stats reducer _updateStats docs #9742
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
// @flow
|
|
|
|
import {
|
|
PARTICIPANT_JOINED,
|
|
PARTICIPANT_KICKED,
|
|
PARTICIPANT_LEFT,
|
|
PARTICIPANT_UPDATED
|
|
} from '../base/participants/actionTypes';
|
|
import { MiddlewareRegistry } from '../base/redux';
|
|
|
|
import { INIT_SEARCH, INIT_UPDATE_STATS } from './actionTypes';
|
|
import { initReorderStats, updateStats } from './actions';
|
|
import { filterBySearchCriteria, getSortedSpeakerStats, getPendingReorder } from './functions';
|
|
|
|
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
|
const result = next(action);
|
|
|
|
switch (action.type) {
|
|
|
|
case INIT_SEARCH: {
|
|
const state = getState();
|
|
const stats = filterBySearchCriteria(state);
|
|
|
|
dispatch(updateStats(stats));
|
|
break;
|
|
}
|
|
|
|
case INIT_UPDATE_STATS:
|
|
if (action.getSpeakerStats) {
|
|
const state = getState();
|
|
const speakerStats = { ...action.getSpeakerStats() };
|
|
const stats = filterBySearchCriteria(state, speakerStats);
|
|
const pendingReorder = getPendingReorder(state);
|
|
|
|
dispatch(updateStats(pendingReorder ? getSortedSpeakerStats(state, stats) : stats));
|
|
}
|
|
break;
|
|
case PARTICIPANT_JOINED:
|
|
case PARTICIPANT_LEFT:
|
|
case PARTICIPANT_KICKED:
|
|
case PARTICIPANT_UPDATED: {
|
|
dispatch(initReorderStats());
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
});
|