Skip to content

Commit

Permalink
[GH-311] Fix issues: Not able to create meeting in threads view and b…
Browse files Browse the repository at this point in the history
…y clicking "Create New Metting" button in a channel (#316)

* [MI-3700] Fix issues:
- Not able to create a meeting in the threads view.
- Not able to create meeting on clicking "Create New Meeting" in a channel.

* [MM-311] Review fixes

* [MI-3713] Review fix
  • Loading branch information
raghavaggarwal2308 authored Nov 13, 2023
1 parent 6813e92 commit dbbb587
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
4 changes: 1 addition & 3 deletions server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ const (
type startMeetingRequest struct {
ChannelID string `json:"channel_id"`
RootID string `json:"root_id"`
Personal bool `json:"personal"`
Topic string `json:"topic"`
MeetingID int `json:"meeting_id"`
UsePMI string `json:"use_pmi"`
}

Expand Down Expand Up @@ -548,7 +546,7 @@ func (p *Plugin) handleStartMeeting(w http.ResponseWriter, r *http.Request) {
}
}

if err = p.postMeeting(user, meetingID, req.ChannelID, "", topic); err != nil {
if err = p.postMeeting(user, meetingID, req.ChannelID, req.RootID, topic); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
Expand Down
13 changes: 2 additions & 11 deletions webapp/src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,10 @@ import {PostTypes} from 'mattermost-redux/action_types';

import Client from '../client';

export function startMeeting(channelId, rootId, force = false, topic = '') {
export function startMeeting(channelId, rootId = '', force = false, topic = '') {
return async (dispatch, getState) => {
try {
let meetingURL = '';
if (force) {
meetingURL = await Client.forceStartMeeting(
channelId, true, '', 0, topic,
);
} else {
meetingURL = await Client.startMeeting(
channelId, true, '', 0, false, topic,
);
}
const meetingURL = await Client.startMeeting(channelId, rootId, topic, force);
if (meetingURL) {
window.open(meetingURL);
}
Expand Down
12 changes: 2 additions & 10 deletions webapp/src/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,15 @@ export default class Client {
this.url = url + '/plugins/' + id;
}

startMeeting = async (
channelId, personal = true, topic = '', meetingId = 0, force = false,
) => {
startMeeting = async (channelId, rootId, topic = '', force = false) => {
const res = await doPost(`${this.url}/api/v1/meetings${force ? '?force=true' : ''}`, {
channel_id: channelId,
personal,
topic,
meeting_id: meetingId,
root_id: rootId,
});
return res.meeting_url;
}

forceStartMeeting = async (channelId, rootId, personal = true, topic = '', meetingId = 0) => {
const meetingUrl = await this.startMeeting(channelId, rootId, personal, topic, meetingId, true);
return meetingUrl;
}

getChannelIdForThread = async (baseURL, threadId) => {
const threadDetails = await doGet(`${baseURL}/api/v4/posts/${threadId}/thread`);
return threadDetails.posts[threadId].channel_id;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/post_type_zoom/post_type_zoom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class PostTypeZoom extends React.PureComponent {
className='btn btn-lg btn-primary'
style={style.button}
rel='noopener noreferrer'
onClick={() => this.props.actions.startMeeting(this.props.currentChannelId, true, props.meeting_topic)}
onClick={() => this.props.actions.startMeeting(this.props.currentChannelId, '', true, props.meeting_topic)}
>
{'CREATE NEW MEETING'}
</a>
Expand Down

0 comments on commit dbbb587

Please sign in to comment.