snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
46
react/features/polls-history/middleware.ts
Normal file
46
react/features/polls-history/middleware.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
|
||||
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
||||
import { REMOVE_POLL, SAVE_POLL } from '../polls/actionTypes';
|
||||
import { savePoll } from '../polls/actions';
|
||||
|
||||
import { removePollFromHistory, savePollInHistory } from './actions';
|
||||
|
||||
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||
const result = next(action);
|
||||
const { room: meetingId } = getState()['features/base/conference'];
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
case CONFERENCE_JOINED: {
|
||||
const state = getState();
|
||||
const pollsHistory = meetingId && state['features/polls-history'].polls?.[meetingId];
|
||||
|
||||
if (!pollsHistory) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (const key in pollsHistory) {
|
||||
if (pollsHistory.hasOwnProperty(key) && pollsHistory[key].saved) {
|
||||
dispatch(savePoll(pollsHistory[key]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case REMOVE_POLL: {
|
||||
const { poll, pollId } = action;
|
||||
|
||||
dispatch(removePollFromHistory(meetingId, pollId, poll));
|
||||
break;
|
||||
}
|
||||
|
||||
case SAVE_POLL: {
|
||||
const { poll, pollId } = action;
|
||||
|
||||
dispatch(savePollInHistory(meetingId, pollId, poll));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
Reference in New Issue
Block a user