From 4749374702ca2f5e7ab5d9c00dad46ff46990cba Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 26 Apr 2020 14:41:09 +0200 Subject: [PATCH] Add "allowEveryoneToAddMembers" settings when creating a conversation --- assets/js/components/conversations/interface.js | 1 + assets/js/components/conversations/list.js | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/assets/js/components/conversations/interface.js b/assets/js/components/conversations/interface.js index ffb92496..0774a263 100644 --- a/assets/js/components/conversations/interface.js +++ b/assets/js/components/conversations/interface.js @@ -84,6 +84,7 @@ const ConversationsInterface = { name: infos.conversationName, follow : infos.follow, users: infos.users, + canEveryoneAddMembers: infos.allowEveryoneToAddMembersInput }; //Perform the API request diff --git a/assets/js/components/conversations/list.js b/assets/js/components/conversations/list.js index 5baefe43..fa88e571 100644 --- a/assets/js/components/conversations/list.js +++ b/assets/js/components/conversations/list.js @@ -4,7 +4,7 @@ * @author Pierre HUBERT */ -ComunicWeb.components.conversations.list = { +const ConversationsList = { /** * Display conversations list window * @@ -70,7 +70,7 @@ ComunicWeb.components.conversations.list = { listBox.boxTitle.innerHTML = "New conversation"; //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 var infos = { @@ -78,11 +78,12 @@ ComunicWeb.components.conversations.list = { usersElement: form.usersElement, conversationNameInput: form.conversationNameInput, followConversationInput: form.followConversationInput, + allowEveryoneToAddMembersInput: form.allowEveryoneToAddMembers, }; //Make button lives - form.createButton.onclick = function(){ - ComunicWeb.components.conversations.list.submitCreateConversationForm(infos); + form.createButton.onclick = () => { + this.submitCreateConversationForm(infos); }; //Success @@ -97,6 +98,7 @@ ComunicWeb.components.conversations.list = { * * @info {HTMLElement} usersElement Pointer on userElement * * @info {HTMLElement} conversationNameInput Pointer on the input of the form of the conversation * * @info {HTMLElement} followConversationInput Pointer on the "follow conversation" checkbox + * * @info {HTMLElement} allowEveryoneToAddMembersInput * @return {Boolean} True for a success */ submitCreateConversationForm: function(infos){ @@ -121,13 +123,14 @@ ComunicWeb.components.conversations.list = { users: selectedUsers, follow: infos.followConversationInput.checked, conversationName: (infos.conversationNameInput.value == "" ? false : infos.conversationNameInput.value), + allowEveryoneToAddMembersInput: infos.allowEveryoneToAddMembersInput.checked, }; //Change box body style var splashScreen = ComunicWeb.common.page.showTransparentWaitSplashScreen(infos.listBox.boxBody); //Contact the interface to create the conversation - ComunicWeb.components.conversations.interface.createConversation(conversationInformations, function(response){ + ConversationsInterface.createConversation(conversationInformations, function(response){ //First, remove splash screen splashScreen.remove(); @@ -271,4 +274,6 @@ ComunicWeb.components.conversations.list = { //Success return true; } -} \ No newline at end of file +} + +ComunicWeb.components.conversations.list = ConversationsList; \ No newline at end of file