diff --git a/webapp/src/components/conference/__snapshots__/conference.test.tsx.snap b/webapp/src/components/conference/__snapshots__/conference.test.tsx.snap index 98a70c7c..5487dea0 100644 --- a/webapp/src/components/conference/__snapshots__/conference.test.tsx.snap +++ b/webapp/src/components/conference/__snapshots__/conference.test.tsx.snap @@ -74,7 +74,7 @@ exports[`Conference should render and initialize the conference interface 1`] = { root_id: '', parent_id: '', original_id: '', - type: 'custom_jitsi', + type: 'custom_jitsi' as PostType, hashtags: '', props: { jwt_meeting_valid_until: 123, @@ -30,7 +30,10 @@ describe('Conference', () => { meeting_topic: 'Test topic', meeting_id: 'test', meeting_personal: false - } + }, + metadata: {} as PostMetadata, + pending_post_id: 'test', + reply_count: 100 }; const actions = { @@ -42,7 +45,10 @@ describe('Conference', () => { post: basePost, jwt: null, actions, - currentUserId: 'test' + currentUser: { + id: 'mockId', + username: 'firstLast' + } }; Conference.prototype.getViewportWidth = () => 10; diff --git a/webapp/src/components/conference/conference.tsx b/webapp/src/components/conference/conference.tsx index ad799a4f..f9c0e185 100644 --- a/webapp/src/components/conference/conference.tsx +++ b/webapp/src/components/conference/conference.tsx @@ -15,7 +15,10 @@ const MATTERMOST_HEADER_HEIGHT = 60; const WINDOW_HEIGHT = 100; type Props = { - currentUserId: string, + currentUser: { + id: string; + username: string; + }, post: Post | null, jwt: string | null, showPrejoinPage: boolean, @@ -106,6 +109,9 @@ export default class Conference extends React.PureComponent { this.setState({loading: false}); this.resizeIframe(); }, + userInfo: { + displayName: this.props.currentUser.username + }, configOverwrite: { // Disable the pre-join page prejoinPageEnabled: this.props.meetingEmbedded && this.props.showPrejoinPage @@ -184,7 +190,7 @@ export default class Conference extends React.PureComponent { this.api.executeCommand('hangup'); setTimeout(() => { this.props.actions.openJitsiMeeting(null, null); - this.props.actions.setUserStatus(this.props.currentUserId, Constants.ONLINE); + this.props.actions.setUserStatus(this.props.currentUser.id, Constants.ONLINE); this.setState({ minimized: true, loading: true, @@ -238,7 +244,7 @@ export default class Conference extends React.PureComponent { meetingLink += `?jwt=${this.props.jwt}`; } meetingLink += `#config.callDisplayName="${post.props.meeting_topic || post.props.default_meeting_topic}"`; - + meetingLink = encodeURI(meetingLink); return (
{!this.props.showPrejoinPage && this.state.minimized && this.state.position === POSITION_TOP && diff --git a/webapp/src/components/conference/index.ts b/webapp/src/components/conference/index.ts index 39882bcd..b08df8d7 100644 --- a/webapp/src/components/conference/index.ts +++ b/webapp/src/components/conference/index.ts @@ -2,7 +2,7 @@ import {connect} from 'react-redux'; import {bindActionCreators, Dispatch} from 'redux'; import {GenericAction} from 'mattermost-redux/types/actions'; -import {getCurrentUserId} from 'mattermost-redux/selectors/entities/common'; +import {getCurrentUser} from 'mattermost-redux/selectors/entities/common'; import {GlobalState, plugin} from 'types'; import {openJitsiMeeting, setUserStatus} from 'actions'; @@ -13,7 +13,7 @@ function mapStateToProps(state: GlobalState) { const config = state[`plugins-${manifest.id}` as plugin].config; return { - currentUserId: getCurrentUserId(state), + currentUser: getCurrentUser(state), post: state[`plugins-${manifest.id}` as plugin].openMeeting, jwt: state[`plugins-${manifest.id}` as plugin].openMeetingJwt, showPrejoinPage: config.show_prejoin_page, diff --git a/webapp/src/components/post_type_jitsi/__snapshots__/post_type_jitsi.test.tsx.snap b/webapp/src/components/post_type_jitsi/__snapshots__/post_type_jitsi.test.tsx.snap index 6313942e..d238223c 100644 --- a/webapp/src/components/post_type_jitsi/__snapshots__/post_type_jitsi.test.tsx.snap +++ b/webapp/src/components/post_type_jitsi/__snapshots__/post_type_jitsi.test.tsx.snap @@ -62,7 +62,7 @@ exports[`PostTypeJitsi should render a post if the post type is not null, and sh values={Object {}} /> { creatorName: 'test', currentUser: { first_name: 'First', - last_name: 'Last' + last_name: 'Last', + username: 'firstLast' }, useMilitaryTime: false, meetingEmbedded: false, diff --git a/webapp/src/components/post_type_jitsi/post_type_jitsi.tsx b/webapp/src/components/post_type_jitsi/post_type_jitsi.tsx index 5a7ac3d3..97a393a7 100644 --- a/webapp/src/components/post_type_jitsi/post_type_jitsi.tsx +++ b/webapp/src/components/post_type_jitsi/post_type_jitsi.tsx @@ -5,7 +5,6 @@ import {Theme} from 'mattermost-redux/types/preferences'; import {ActionResult} from 'mattermost-redux/types/actions'; import Constants from 'mattermost-redux/constants/general'; import {UserProfile} from 'mattermost-redux/types/users'; -import {getFullName} from 'mattermost-redux/utils/user_utils'; import Svgs from 'constants/svgs'; @@ -60,7 +59,7 @@ export class PostTypeJitsi extends React.PureComponent { if (this.props.post) { const props = this.props.post.props; let meetingLink = props.meeting_link + '?jwt=' + (this.state.meetingJwt); - meetingLink += `#config.callDisplayName="${props.meeting_topic || props.default_meeting_topic}"`; + meetingLink += `#config.callDisplayName=${encodeURIComponent(`"${props.meeting_topic || props.default_meeting_topic}"`)}`; window.open(meetingLink, '_blank'); } } @@ -99,11 +98,11 @@ export class PostTypeJitsi extends React.PureComponent { let meetingLink = props.meeting_link; if (props.jwt_meeting) { - meetingLink += '?jwt=' + (props.meeting_jwt); + meetingLink += '?jwt=' + encodeURIComponent(props.meeting_jwt); } - meetingLink += `#config.callDisplayName="${props.meeting_topic || props.default_meeting_topic}"`; - meetingLink += `&userInfo.displayName="${getFullName(this.props.currentUser)}"`; + meetingLink += `#config.callDisplayName=${encodeURIComponent(`"${props.meeting_topic || props.default_meeting_topic}"`)}`; + meetingLink += `&userInfo.displayName=${encodeURIComponent(`"${this.props.currentUser.username}"`)}`; const preText = (