Files
jitsi-meet/react/features/conference/actions.web.ts
Calinteodor 238def34cf feat(conference): dismiss calendar notification (#13050)
* feat(conference): created action that dismisses calendar notification
2023-03-16 12:17:57 +02:00

48 lines
1.5 KiB
TypeScript

import { IStore } from '../app/types';
import { getParticipantDisplayName } from '../base/participants/functions';
import { showNotification } from '../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';
import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
/**
* Notify that we've been kicked out of the conference.
*
* @param {JitsiParticipant} participant - The {@link JitsiParticipant}
* instance which initiated the kick event.
* @param {?Function} _ - Used only in native code.
* @returns {Function}
*/
export function notifyKickedOut(participant: any, _?: Function) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
if (!participant || participant?.isReplaced()) {
return;
}
const args = {
participantDisplayName:
getParticipantDisplayName(getState, participant.getId())
};
dispatch(showNotification({
appearance: NOTIFICATION_TYPE.ERROR,
hideErrorSupportLink: true,
descriptionKey: 'dialog.kickMessage',
descriptionArguments: args,
titleKey: 'dialog.kickTitle',
titleArguments: args
}, NOTIFICATION_TIMEOUT_TYPE.STICKY));
};
}
/**
* Dismisses calendar notification about next or ongoing event.
*
* @returns {Object}
*/
export function dismissCalendarNotification() {
return {
type: DISMISS_CALENDAR_NOTIFICATION
};
}