diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index 63d52924..dc720e81 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -146,7 +146,7 @@ const ConvChatWindow = { class: "form-control", placeholder: tr("New message..."), }); - inputText.maxLength = ServerConfig.conf.conversations_policy.max_conversation_message_len; + inputText.maxLength = ServerConfig.conf.conversations_policy.max_message_len; // Notify other users when this user is writing a message ConversationsUtils.listenToInputChangeEvents(inputText, infosBox.conversationID) @@ -164,7 +164,7 @@ const ConvChatWindow = { type: "input", elemType: "file", }); - fileInput.accept = ServerConfig.conf.conversations_policy.allowed_conversation_files_type.join(", "); + fileInput.accept = ServerConfig.conf.conversations_policy.allowed_files_type.join(", "); //Create button group @@ -902,8 +902,8 @@ const ConvChatWindow = { if (message.length == 0) return; - if(message.length < ServerConfig.conf.conversations_policy.min_conversation_message_len - || message.length > ServerConfig.conf.conversations_policy.max_conversation_message_len){ + if(message.length < ServerConfig.conf.conversations_policy.min_message_len + || message.length > ServerConfig.conf.conversations_policy.max_message_len){ notify(tr("Invalid message length!"), "danger", 2); return; } diff --git a/assets/js/components/conversations/utils.js b/assets/js/components/conversations/utils.js index f52b47ec..babbc7f4 100644 --- a/assets/js/components/conversations/utils.js +++ b/assets/js/components/conversations/utils.js @@ -241,14 +241,14 @@ const ConversationsUtils = { const file = fileInput.files[0]; - if (ServerConfig.conf.conversations_policy.allowed_conversation_files_type.indexOf(file.type) < 0) { + if (ServerConfig.conf.conversations_policy.allowed_files_type.indexOf(file.type) < 0) { notify(tr("This file type is not allowed!"), "danger") return; } - if (file.size > ServerConfig.conf.conversations_policy.conversation_files_max_size) { - notify(tr("This file is too big (max file size: %1%)", {"1": fileSizeToHuman(ServerConfig.conf.conversations_policy.conversation_files_max_size)}), "danger"); + if (file.size > ServerConfig.conf.conversations_policy.files_max_size) { + notify(tr("This file is too big (max file size: %1%)", {"1": fileSizeToHuman(ServerConfig.conf.conversations_policy.files_max_size)}), "danger"); return; } @@ -301,7 +301,7 @@ const ConversationsUtils = { return; const t = ComunicDate.time(); - if (t - last_update < ServerConfig.conf.conversations_policy.conversation_writing_event_interval) + if (t - last_update < ServerConfig.conf.conversations_policy.writing_event_interval) return; last_update = t; diff --git a/assets/js/components/conversations/writingNotifier.js b/assets/js/components/conversations/writingNotifier.js index 56071c8c..706d5002 100644 --- a/assets/js/components/conversations/writingNotifier.js +++ b/assets/js/components/conversations/writingNotifier.js @@ -42,7 +42,7 @@ class ConversationWritingNotifier { setTimeout(() => { this.usersFifo.shift(); this.refreshText() - }, ServerConfig.conf.conversations_policy.conversation_writing_event_lifetime * 1000) + }, ServerConfig.conf.conversations_policy.writing_event_lifetime * 1000) } /** diff --git a/assets/js/pages/conversations/conversation.js b/assets/js/pages/conversations/conversation.js index 5e77360c..3b6edf53 100644 --- a/assets/js/pages/conversations/conversation.js +++ b/assets/js/pages/conversations/conversation.js @@ -429,7 +429,7 @@ const ConversationPageConvPart = { //Create image input (for optionnal image) var fileInput = document.createElement("input"); fileInput.type = "file"; - fileInput.accept = ServerConfig.conf.conversations_policy.allowed_conversation_files_type.join(", "); + fileInput.accept = ServerConfig.conf.conversations_policy.allowed_files_type.join(", "); // Send file button var fileButton = createElem2({ @@ -464,7 +464,7 @@ const ConversationPageConvPart = { class: "form-control", placeholder: "New message...", }); - inputText.maxLength = ServerConfig.conf.conversations_policy.max_conversation_message_len; + inputText.maxLength = ServerConfig.conf.conversations_policy.max_message_len; inputText.focus(); // Notify other users when this user is writing a message @@ -536,8 +536,8 @@ const ConversationPageConvPart = { let message = inputText.value; //Check if message is empty - if(message.length > ServerConfig.conf.conversations_policy.max_conversation_message_len - || message.length < ServerConfig.conf.conversations_policy.min_conversation_message_len){ + if(message.length > ServerConfig.conf.conversations_policy.max_message_len + || message.length < ServerConfig.conf.conversations_policy.min_message_len){ notify(tr("Invalid message length!"), "danger", 2); return; } diff --git a/assets/js/typings/ServerConfig.d.ts b/assets/js/typings/ServerConfig.d.ts index 904b9067..576059b7 100644 --- a/assets/js/typings/ServerConfig.d.ts +++ b/assets/js/typings/ServerConfig.d.ts @@ -25,12 +25,12 @@ declare interface DataConservationPolicySettings { } declare interface ConversationPolicy { - min_conversation_message_len: number, - max_conversation_message_len: number, - allowed_conversation_files_type: String[], - conversation_files_max_size: number, - conversation_writing_event_interval: number, - conversation_writing_event_lifetime: number, + min_message_len: number, + max_message_len: number, + allowed_files_type: String[], + files_max_size: number, + writing_event_interval: number, + writing_event_lifetime: number, } declare interface StaticServerConfig {