Fix join call confirmation

This commit is contained in:
jim3692 2023-03-22 19:09:00 +02:00
parent a9e950ba2f
commit f0f81cc499

View file

@ -10,6 +10,8 @@ import { openNavigation } from '../../../client/action/navigation';
import { getUsername } from '../../../util/matrixUtil'; import { getUsername } from '../../../util/matrixUtil';
import Button from '../../atoms/button/Button'; import Button from '../../atoms/button/Button';
const TOPIC_JITSI_CALL = 'd38dd491fefa1cfffc27f9c57f2bdb4a'
function JitsiRoom(props) { function JitsiRoom(props) {
const { jitsiCallId, setJitsiCallId } = props; const { jitsiCallId, setJitsiCallId } = props;
@ -26,26 +28,14 @@ function JitsiRoom(props) {
useEffect(() => { useEffect(() => {
const handleRoomSelected = (rId, pRoomId, eId) => { const handleRoomSelected = (rId, pRoomId, eId) => {
roomInfo.roomTimeline?.removeInternalListeners(); roomInfo.roomTimeline?.removeInternalListeners();
if (mx.getRoom(rId)) { const roomTimeline = new RoomTimeline(rId);
const roomTimeline = new RoomTimeline(rId); const topic = roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic
if (
roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic === if (mx.getRoom(rId) && topic === TOPIC_JITSI_CALL && confirm('Do you want to join this call?')) {
'd38dd491fefa1cfffc27f9c57f2bdb4a' && setRoomInfo({
confirm('aaa') roomTimeline,
) { eventId: eId ?? null,
setRoomInfo({ });
roomTimeline,
eventId: eId ?? null,
});
} else if (
roomTimeline.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic !==
'd38dd491fefa1cfffc27f9c57f2bdb4a'
) {
setRoomInfo({
roomTimeline,
eventId: eId ?? null,
});
}
} else { } else {
// TODO: add ability to join room if roomId is invalid // TODO: add ability to join room if roomId is invalid
setRoomInfo({ setRoomInfo({