Skip to content

Commit

Permalink
Merge pull request #641 from nextcloud/bugfix/628/allow-to-create-emp…
Browse files Browse the repository at this point in the history
…ty-group-rooms-ui

Add UI to create empty group rooms.
  • Loading branch information
nickvergessen committed Feb 12, 2018
2 parents efaf8c6 + 9814e29 commit 186cc56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions js/app.js
Expand Up @@ -95,10 +95,12 @@
results.push({ id: group.value.shareWith, displayName: group.label + ' ' + t('spreed', '(group)'), type: "group"});
});

//Add custom entry to create a new empty room
//Add custom entry to create a new empty group or public room
if (OCA.SpreedMe.app._searchTerm === '') {
results.unshift({ id: "create-public-room", displayName: t('spreed', 'New public call'), type: "createPublicRoom"});
results.unshift({ id: "create-group-room", displayName: t('spreed', 'New group call'), type: "createGroupRoom"});
} else {
results.push({ id: "create-group-room", displayName: t('spreed', 'New group call'), type: "createGroupRoom"});
results.push({ id: "create-public-room", displayName: t('spreed', 'New public call'), type: "createPublicRoom"});
}

Expand All @@ -113,7 +115,7 @@
callback({id: element.val()});
},
formatResult: function (element) {
if (element.type === "createPublicRoom") {
if ((element.type === "createGroupRoom") || (element.type === "createPublicRoom")) {
return '<span><div class="avatar icon-add"></div>' + escapeHTML(element.displayName) + '</span>';
}

Expand Down Expand Up @@ -141,11 +143,14 @@
OCA.SpreedMe.Calls.createOneToOneVideoCall(e.val);
break;
case "group":
OCA.SpreedMe.Calls.createGroupVideoCall(e.val);
OCA.SpreedMe.Calls.createGroupVideoCall(e.val, "");
break;
case "createPublicRoom":
OCA.SpreedMe.Calls.createPublicVideoCall(OCA.SpreedMe.app._searchTerm);
break;
case "createGroupRoom":
OCA.SpreedMe.Calls.createGroupVideoCall("", OCA.SpreedMe.app._searchTerm);
break;
default:
console.log("Unknown type", e.object.type);
break;
Expand Down
5 changes: 3 additions & 2 deletions js/calls.js
Expand Up @@ -52,14 +52,15 @@
success: _.bind(this._createCallSuccessHandle, this)
});
},
createGroupVideoCall: function(groupId) {
createGroupVideoCall: function(groupId, roomName) {
console.log("Creating group video call", groupId);
$.ajax({
url: OC.linkToOCS('apps/spreed/api/v1', 2) + 'room',
type: 'POST',
data: {
invite: groupId,
roomType: 2
roomType: 2,
roomName: roomName
},
beforeSend: function (request) {
request.setRequestHeader('Accept', 'application/json');
Expand Down

0 comments on commit 186cc56

Please sign in to comment.