mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
* squash: Renames module.
* squash: Loads polls component.
* squash: Attach needed logic when components/hosts load.
* squash: Moves to use component.
* squash: Uses json-message format with types.
* squash: Checks for polls support.
* squash: Fixes comments and moves validate polls to backend.
* squash: Fix debian build.
* fix(polls): Fixes polls in breakout rooms.
* squash: Further simplify types.
Separate type that needs to go into ljm and those used only for the UI part.
Simplify answer/voter type to be unified across operations which simplifies and its logic.
* squash: Change voters structure to be {id, name}.
* squash: Update react/features/conference/functions.any.ts
Co-authored-by: Saúl Ibarra Corretgé <saghul@jitsi.org>
* squash: Drops roomJid from messages. Uses the connection information as breakout does.
---------
Co-authored-by: Saúl Ibarra Corretgé <saghul@jitsi.org>
165 lines
3.3 KiB
TypeScript
165 lines
3.3 KiB
TypeScript
import {
|
|
CHANGE_VOTE,
|
|
CLEAR_POLLS,
|
|
EDIT_POLL,
|
|
RECEIVE_ANSWER,
|
|
RECEIVE_POLL,
|
|
REGISTER_VOTE,
|
|
REMOVE_POLL,
|
|
RESET_NB_UNREAD_POLLS,
|
|
SAVE_POLL
|
|
} from './actionTypes';
|
|
import { IIncomingAnswerData, IPoll, IPollData } from './types';
|
|
|
|
/**
|
|
* Action to signal that existing polls needs to be cleared from state.
|
|
*
|
|
* @returns {{
|
|
* type: CLEAR_POLLS
|
|
* }}
|
|
*/
|
|
export const clearPolls = () => {
|
|
return {
|
|
type: CLEAR_POLLS
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Action to signal that a poll's vote will be changed.
|
|
*
|
|
* @param {string} pollId - The id of the incoming poll.
|
|
* @param {boolean} value - The value of the 'changing' state.
|
|
|
|
* @returns {{
|
|
* type: CHANGE_VOTE,
|
|
* pollId: string,
|
|
* value: boolean
|
|
* }}
|
|
*/
|
|
export const setVoteChanging = (pollId: string, value: boolean) => {
|
|
return {
|
|
type: CHANGE_VOTE,
|
|
pollId,
|
|
value
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Action to signal that a new poll was received.
|
|
*
|
|
* @param {IPoll} poll - The incoming Poll object.
|
|
* @param {boolean} notify - Whether to send or not a notification.
|
|
* @returns {{
|
|
* type: RECEIVE_POLL,
|
|
* pollId: string,
|
|
* poll: IPoll,
|
|
* notify: boolean
|
|
* }}
|
|
*/
|
|
export const receivePoll = (poll: IPoll, notify: boolean) => {
|
|
return {
|
|
type: RECEIVE_POLL,
|
|
poll,
|
|
notify
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Action to signal that a new answer was received.
|
|
*
|
|
* @param {IIncomingAnswerData} answer - The incoming Answer object.
|
|
* @returns {{
|
|
* type: RECEIVE_ANSWER,
|
|
* answer: IIncomingAnswerData
|
|
* }}
|
|
*/
|
|
export const receiveAnswer = (answer: IIncomingAnswerData) => {
|
|
return {
|
|
type: RECEIVE_ANSWER,
|
|
answer
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Action to register a vote on a poll.
|
|
*
|
|
* @param {string} pollId - The id of the poll.
|
|
* @param {?Array<boolean>} answers - The new answers.
|
|
* @returns {{
|
|
* type: REGISTER_VOTE,
|
|
* pollId: string,
|
|
* answers: ?Array<boolean>
|
|
* }}
|
|
*/
|
|
export const registerVote = (pollId: string, answers: Array<boolean> | null) => {
|
|
return {
|
|
type: REGISTER_VOTE,
|
|
pollId,
|
|
answers
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Action to signal the number reset of unread polls.
|
|
*
|
|
* @returns {{
|
|
* type: RESET_NB_UNREAD_POLLS
|
|
* }}
|
|
*/
|
|
export function resetNbUnreadPollsMessages() {
|
|
return {
|
|
type: RESET_NB_UNREAD_POLLS
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Action to signal saving a poll.
|
|
*
|
|
* @param {IPollData} poll - The Poll object that gets to be saved.
|
|
* @returns {{
|
|
* type: SAVE_POLL,
|
|
* poll: IPollData
|
|
* }}
|
|
*/
|
|
export function savePoll(poll: IPollData) {
|
|
return {
|
|
type: SAVE_POLL,
|
|
poll
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Action to signal editing a poll.
|
|
*
|
|
* @param {string} pollId - The id of the poll that gets to be edited.
|
|
* @param {boolean} editing - Whether the poll is in edit mode or not.
|
|
* @returns {{
|
|
* type: EDIT_POLL,
|
|
* pollId: string,
|
|
* editing: boolean
|
|
* }}
|
|
*/
|
|
export function editPoll(pollId: string, editing: boolean) {
|
|
return {
|
|
type: EDIT_POLL,
|
|
pollId,
|
|
editing
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Action to signal that existing polls needs to be removed.
|
|
*
|
|
* @param {IPoll} poll - The incoming Poll object.
|
|
* @returns {{
|
|
* type: REMOVE_POLL,
|
|
* poll: IPoll
|
|
* }}
|
|
*/
|
|
export const removePoll = (poll: IPoll) => {
|
|
return {
|
|
type: REMOVE_POLL,
|
|
poll
|
|
};
|
|
};
|