Skip to content

Commit

Permalink
Remove the conference listing logic that conflates conferences
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac2600Hz committed Nov 29, 2022
1 parent 5ac5464 commit 22a2a41
Showing 1 changed file with 33 additions and 38 deletions.
71 changes: 33 additions & 38 deletions submodules/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2144,22 +2144,6 @@ define(function(require) {
};

if (monster.ui.valid(featureForm)) {
data.conference = monster.ui.getFormData('conferencing_form');

if (data.conference.video) {
data.conference = _.merge(data.conference, {
video: true,
profile_name: 'video',
caller_controls: 'video-participant',
moderator_controls: 'video-moderator'
});
} else {
delete data.conference.video;
delete data.conference.profile_name;
delete data.conference.caller_controls;
delete data.conference.moderator_controls;
}

if (switchFeature.prop('checked')) {
self.usersUpdateConferencing(data, function(data) {
args.userId = data.user.id;
Expand Down Expand Up @@ -5196,33 +5180,44 @@ define(function(require) {
monster.parallel({
conference: function(callback) {
var baseConference = {
name: monster.util.getUserFullName(data.user) + self.appFlags.users.smartPBXConferenceString,
owner_id: data.user.id,
play_name_on_join: true,
member: {
join_muted: false
name: monster.util.getUserFullName(data.user) + self.appFlags.users.smartPBXConferenceString,
owner_id: data.user.id,
play_name_on_join: true,
member: {
join_muted: false
},
conference_numbers: []
},
conference_numbers: []
};
formData = monster.ui.getFormData('conferencing_form');

monster.util.dataFlags.add({ source: 'smartpbx' }, baseConference);
if (formData.video) {
formData = _.merge(formData, {
video: true,
profile_name: 'video',
caller_controls: 'video-participant',
moderator_controls: 'video-moderator'
});
} else {
delete formData.video;
delete formData.profile_name;
delete formData.caller_controls;
delete formData.moderator_controls;
}

baseConference = $.extend(true, {}, baseConference, data.conference);
monster.util.dataFlags.add({ source: 'smartpbx' }, baseConference);

self.usersListConferences(data.user.id, function(conferences) {
var conferenceToSave = baseConference;
if (conferences.length > 0) {
conferenceToSave = $.extend(true, {}, conferences[0], baseConference);
baseConference = $.extend(true, {}, baseConference, formData);

self.usersUpdateConference(conferenceToSave, function(conference) {
callback && callback(null, conference);
});
} else {
self.usersCreateConference(conferenceToSave, function(conference) {
callback && callback(null, conference);
});
}
});
if (_.isEmpty(data.conference)) {
self.usersCreateConference(baseConference, function(conference) {
callback && callback(null, conference);
});
} else {
baseConference = $.extend(true, {}, data.conference, baseConference);
self.usersUpdateConference(baseConference, function(conference) {
callback && callback(null, conference);
});
}
},
user: function(callback) {
if (data.user.smartpbx && data.user.smartpbx.conferencing && data.user.smartpbx.conferencing.enabled === true) {
Expand Down

0 comments on commit 22a2a41

Please sign in to comment.