mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
Add new canEveryoneAddMembers setting
This commit is contained in:
parent
2bd844e434
commit
95411483c3
@ -535,7 +535,7 @@ const ConvChatWindow = {
|
||||
};
|
||||
|
||||
//Create the conversation form
|
||||
var settingsForm = ComunicWeb.components.conversations.utils.createConversationForm(settingsPane);
|
||||
const settingsForm = ConversationsUtils.createConversationForm(settingsPane);
|
||||
|
||||
//Update form informations
|
||||
settingsForm.createButton.innerHTML = "Update settings";
|
||||
@ -555,22 +555,19 @@ const ConvChatWindow = {
|
||||
|
||||
//We hide conversation users (presents in members pane)
|
||||
settingsForm.usersElement.parentNode.style.display = "none";
|
||||
|
||||
settingsForm.allowEveryoneToAddMembers.parentNode.parentNode.remove();
|
||||
}
|
||||
|
||||
//Update follow conversation checkbox status
|
||||
if(conversation.infos.following == "1"){
|
||||
$(settingsForm.followConversationInput).iCheck("check");
|
||||
}
|
||||
else {
|
||||
$(settingsForm.followConversationInput).iCheck("uncheck");
|
||||
}
|
||||
$(settingsForm.followConversationInput).iCheck(conversation.infos.following == "1" ? "check" : "uncheck");
|
||||
|
||||
//Save settings form in global form
|
||||
conversation.settingsForm = settingsForm;
|
||||
|
||||
//Make update settings button lives
|
||||
settingsForm.createButton.onclick = function(){
|
||||
ComunicWeb.components.conversations.chatWindows.submitUpdateForm(conversation);
|
||||
settingsForm.createButton.onclick = () => {
|
||||
this.submitUpdateForm(conversation);
|
||||
};
|
||||
|
||||
//Success
|
||||
@ -633,13 +630,15 @@ const ConvChatWindow = {
|
||||
return false;
|
||||
}
|
||||
|
||||
newValues.canEveryoneAddMembers = conversation.settingsForm.allowEveryoneToAddMembers.checked;
|
||||
|
||||
}
|
||||
|
||||
//Now, freeze the submit button
|
||||
conversation.settingsForm.createButton.disabled = true;
|
||||
|
||||
//Peform a request through the interface
|
||||
ComunicWeb.components.conversations.interface.updateSettings(newValues, function(result){
|
||||
ConversationsInterface.updateSettings(newValues, function(result){
|
||||
|
||||
//Enable again update button
|
||||
conversation.settingsForm.createButton.disabled = false;
|
||||
|
@ -134,6 +134,9 @@ const ConversationsInterface = {
|
||||
if(infos.following !== undefined)
|
||||
params.following = infos.following;
|
||||
|
||||
if(infos.canEveryoneAddMembers !== undefined)
|
||||
params.canEveryoneAddMembers = infos.canEveryoneAddMembers;
|
||||
|
||||
//Perform API request
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, function(result){
|
||||
//Empty the cache (considered as deprecated)
|
||||
|
@ -79,12 +79,12 @@ const ConversationsUtils = {
|
||||
* Create and display a conversation creation / edition form
|
||||
*
|
||||
* @param {HTMLElement} target The target of the creation form
|
||||
* @return {Object} Informations about the form
|
||||
* @return {ConversationSettingsFormElements} Information about the form
|
||||
*/
|
||||
createConversationForm: function(target){
|
||||
|
||||
//Create form object
|
||||
var form = {};
|
||||
const form = {};
|
||||
|
||||
//Create and display conversation creation form
|
||||
form.rootElem = createElem("div", target);
|
||||
@ -109,13 +109,21 @@ const ConversationsUtils = {
|
||||
placeholder: "Optionnal",
|
||||
type: "text"});
|
||||
|
||||
//Follow disucssion
|
||||
// Follow discussion
|
||||
form.followConversationInput = createFormGroup({
|
||||
target: form.rootElem,
|
||||
label: "Follow conversation",
|
||||
checked: true,
|
||||
type: "checkbox"});
|
||||
|
||||
// Allow all the members of the conversation to add other members
|
||||
form.allowEveryoneToAddMembers = createFormGroup({
|
||||
target: form.rootElem,
|
||||
type: "checkbox",
|
||||
checked: true,
|
||||
label: "Allow everyone to add members"
|
||||
});
|
||||
|
||||
//Create button
|
||||
form.createButton = createElem2({
|
||||
type: "button",
|
||||
|
13
assets/js/typings/Conversations.d.ts
vendored
Normal file
13
assets/js/typings/Conversations.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Conversations typings
|
||||
*
|
||||
* @author Pierre Hubert
|
||||
*/
|
||||
|
||||
declare interface ConversationSettingsFormElements {
|
||||
rootElem: HTMLElement,
|
||||
usersElement: HTMLElement,
|
||||
conversationNameInput: HTMLElement,
|
||||
allowEveryoneToAddMembers: HTMLElement,
|
||||
followConversationInput: HTMLElement,
|
||||
}
|
Loading…
Reference in New Issue
Block a user