Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(office): fixes user invitation to external meeting opening jitsi instead #331

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

### Changed

- fixed behavior when inviting user to external meeting, now matrix will not open a new jitsi room
## [2.0.1] 2020-05-05
### Added
- New `ctrl+click` to open a embeded Jitsi Meet in a new Tab.
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/morpheus/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { withRouter } from "react-router-dom";
import { connect } from "react-redux";
import { useSnackbar } from "notistack";
import PropTypes from "prop-types";

import { enterRoom } from "./containers/OfficePage";
import Loading from "../components/Loading";
import PageLayout from "../components/PageLayout";
import MenuUsers from "../components/MenuUsers";
Expand Down Expand Up @@ -153,7 +153,8 @@ const MorpheusApp = ({
}}
onConfirm={() => {
emitEnterInRoom(invitation.room.id);
history.push(`/morpheus/room/${invitation.room.id}`);
onSetCurrentRoom(invitation.room);
enterRoom(invitation.room, history);
}}
/>
<MessageDialog />
Expand Down
56 changes: 31 additions & 25 deletions frontend/src/morpheus/containers/OfficePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,36 @@ import { emitEnterInRoom, emitStartMeeting, emitLeftMeeting} from "../socket";
import { setCurrentRoom } from "../store/actions";
import { CurrentRoomPropType } from "../store/models";

const externalMeetRoomMonitoring = (externalMeetRoom) => {
const interval = window.setInterval(() => {
if (!externalMeetRoom.closed) return;

emitLeftMeeting();
window.clearInterval(interval);
}, 1000);
};

const startMeeting = (redirectUrl, history, openInNewTab = false) => {
if (openInNewTab) {
window.open(redirectUrl, "_blank");
} else {
history.push(redirectUrl);
}
};

export const enterRoom = (room, history, openInNewTab = false) => {
emitEnterInRoom(room.id);

if(room.externalMeetUrl) {
emitStartMeeting();
const externalMeetRoom = window.open(room.externalMeetUrl);

externalMeetRoomMonitoring(externalMeetRoom);
} else {
startMeeting(`/morpheus/room/${room.id}`, history, openInNewTab);
}
};

const useStyles = makeStyles(theme => ({
root: {
padding: theme.spacing(3)
Expand Down Expand Up @@ -54,33 +84,9 @@ const OfficePage = ({
history.replace(`/morpheus/office/${room.id}`);
}}
onEnterMeeting={(event) => {
emitEnterInRoom(room.id);
onSetCurrentRoom(room);

if(room.externalMeetUrl){
emitStartMeeting();
const externalMeetRoom = window.open(room.externalMeetUrl);

const externalMeetRoomMonitoring = () => {
window.setTimeout(() => {
if (externalMeetRoom.closed) {
emitLeftMeeting();
}else{
externalMeetRoomMonitoring();
}
}, 1000);
}

externalMeetRoomMonitoring();

}else{
const redirectUrl = `/morpheus/room/${room.id}`;
if (event.ctrlKey) {
window.open(redirectUrl, "_blank");
} else {
history.push(redirectUrl);
}
}
enterRoom(room, event, event.ctrlKey);
}}
/>
))}
Expand Down