Add "allowEveryoneToAddMembers" settings when creating a conversation

This commit is contained in:
Pierre HUBERT 2020-04-26 14:41:09 +02:00
parent 9bb9ff6153
commit 4749374702
2 changed files with 12 additions and 6 deletions

View File

@ -84,6 +84,7 @@ const ConversationsInterface = {
name: infos.conversationName, name: infos.conversationName,
follow : infos.follow, follow : infos.follow,
users: infos.users, users: infos.users,
canEveryoneAddMembers: infos.allowEveryoneToAddMembersInput
}; };
//Perform the API request //Perform the API request

View File

@ -4,7 +4,7 @@
* @author Pierre HUBERT * @author Pierre HUBERT
*/ */
ComunicWeb.components.conversations.list = { const ConversationsList = {
/** /**
* Display conversations list window * Display conversations list window
* *
@ -70,7 +70,7 @@ ComunicWeb.components.conversations.list = {
listBox.boxTitle.innerHTML = "New conversation"; listBox.boxTitle.innerHTML = "New conversation";
//Create the form //Create the form
var form = ComunicWeb.components.conversations.utils.createConversationForm(listBox.boxBody); var form = ConversationsUtils.createConversationForm(listBox.boxBody);
//Generate a summary object about all the informations we have got //Generate a summary object about all the informations we have got
var infos = { var infos = {
@ -78,11 +78,12 @@ ComunicWeb.components.conversations.list = {
usersElement: form.usersElement, usersElement: form.usersElement,
conversationNameInput: form.conversationNameInput, conversationNameInput: form.conversationNameInput,
followConversationInput: form.followConversationInput, followConversationInput: form.followConversationInput,
allowEveryoneToAddMembersInput: form.allowEveryoneToAddMembers,
}; };
//Make button lives //Make button lives
form.createButton.onclick = function(){ form.createButton.onclick = () => {
ComunicWeb.components.conversations.list.submitCreateConversationForm(infos); this.submitCreateConversationForm(infos);
}; };
//Success //Success
@ -97,6 +98,7 @@ ComunicWeb.components.conversations.list = {
* * @info {HTMLElement} usersElement Pointer on userElement * * @info {HTMLElement} usersElement Pointer on userElement
* * @info {HTMLElement} conversationNameInput Pointer on the input of the form of the conversation * * @info {HTMLElement} conversationNameInput Pointer on the input of the form of the conversation
* * @info {HTMLElement} followConversationInput Pointer on the "follow conversation" checkbox * * @info {HTMLElement} followConversationInput Pointer on the "follow conversation" checkbox
* * @info {HTMLElement} allowEveryoneToAddMembersInput
* @return {Boolean} True for a success * @return {Boolean} True for a success
*/ */
submitCreateConversationForm: function(infos){ submitCreateConversationForm: function(infos){
@ -121,13 +123,14 @@ ComunicWeb.components.conversations.list = {
users: selectedUsers, users: selectedUsers,
follow: infos.followConversationInput.checked, follow: infos.followConversationInput.checked,
conversationName: (infos.conversationNameInput.value == "" ? false : infos.conversationNameInput.value), conversationName: (infos.conversationNameInput.value == "" ? false : infos.conversationNameInput.value),
allowEveryoneToAddMembersInput: infos.allowEveryoneToAddMembersInput.checked,
}; };
//Change box body style //Change box body style
var splashScreen = ComunicWeb.common.page.showTransparentWaitSplashScreen(infos.listBox.boxBody); var splashScreen = ComunicWeb.common.page.showTransparentWaitSplashScreen(infos.listBox.boxBody);
//Contact the interface to create the conversation //Contact the interface to create the conversation
ComunicWeb.components.conversations.interface.createConversation(conversationInformations, function(response){ ConversationsInterface.createConversation(conversationInformations, function(response){
//First, remove splash screen //First, remove splash screen
splashScreen.remove(); splashScreen.remove();
@ -272,3 +275,5 @@ ComunicWeb.components.conversations.list = {
return true; return true;
} }
} }
ComunicWeb.components.conversations.list = ConversationsList;