mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
Update convesations policy
This commit is contained in:
parent
ff499f9892
commit
7681a78dc7
@ -146,7 +146,7 @@ const ConvChatWindow = {
|
|||||||
class: "form-control",
|
class: "form-control",
|
||||||
placeholder: tr("New message..."),
|
placeholder: tr("New message..."),
|
||||||
});
|
});
|
||||||
inputText.maxLength = ServerConfig.conf.max_conversation_message_len;
|
inputText.maxLength = ServerConfig.conf.conversations_policy.max_conversation_message_len;
|
||||||
|
|
||||||
// Notify other users when this user is writing a message
|
// Notify other users when this user is writing a message
|
||||||
ConversationsUtils.listenToInputChangeEvents(inputText, infosBox.conversationID)
|
ConversationsUtils.listenToInputChangeEvents(inputText, infosBox.conversationID)
|
||||||
@ -164,7 +164,7 @@ const ConvChatWindow = {
|
|||||||
type: "input",
|
type: "input",
|
||||||
elemType: "file",
|
elemType: "file",
|
||||||
});
|
});
|
||||||
fileInput.accept = ServerConfig.conf.allowed_conversation_files_type.join(", ");
|
fileInput.accept = ServerConfig.conf.conversations_policy.allowed_conversation_files_type.join(", ");
|
||||||
|
|
||||||
|
|
||||||
//Create button group
|
//Create button group
|
||||||
@ -902,7 +902,8 @@ const ConvChatWindow = {
|
|||||||
if (message.length == 0)
|
if (message.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(message.length < ServerConfig.conf.min_conversation_message_len || message.length > ServerConfig.conf.max_conversation_message_len){
|
if(message.length < ServerConfig.conf.conversations_policy.min_conversation_message_len
|
||||||
|
|| message.length > ServerConfig.conf.conversations_policy.max_conversation_message_len){
|
||||||
notify(tr("Invalid message length!"), "danger", 2);
|
notify(tr("Invalid message length!"), "danger", 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -241,14 +241,14 @@ const ConversationsUtils = {
|
|||||||
|
|
||||||
const file = fileInput.files[0];
|
const file = fileInput.files[0];
|
||||||
|
|
||||||
if (ServerConfig.conf.allowed_conversation_files_type.indexOf(file.type) < 0) {
|
if (ServerConfig.conf.conversations_policy.allowed_conversation_files_type.indexOf(file.type) < 0) {
|
||||||
notify(tr("This file type is not allowed!"), "danger")
|
notify(tr("This file type is not allowed!"), "danger")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (file.size > ServerConfig.conf.conversation_files_max_size) {
|
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.conversation_files_max_size)}), "danger");
|
notify(tr("This file is too big (max file size: %1%)", {"1": fileSizeToHuman(ServerConfig.conf.conversations_policy.conversation_files_max_size)}), "danger");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ const ConversationsUtils = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const t = ComunicDate.time();
|
const t = ComunicDate.time();
|
||||||
if (t - last_update < ServerConfig.conf.conversation_writing_event_interval)
|
if (t - last_update < ServerConfig.conf.conversations_policy.conversation_writing_event_interval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
last_update = t;
|
last_update = t;
|
||||||
|
@ -42,7 +42,7 @@ class ConversationWritingNotifier {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.usersFifo.shift();
|
this.usersFifo.shift();
|
||||||
this.refreshText()
|
this.refreshText()
|
||||||
}, ServerConfig.conf.conversation_writing_event_lifetime * 1000)
|
}, ServerConfig.conf.conversations_policy.conversation_writing_event_lifetime * 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -429,7 +429,7 @@ const ConversationPageConvPart = {
|
|||||||
//Create image input (for optionnal image)
|
//Create image input (for optionnal image)
|
||||||
var fileInput = document.createElement("input");
|
var fileInput = document.createElement("input");
|
||||||
fileInput.type = "file";
|
fileInput.type = "file";
|
||||||
fileInput.accept = ServerConfig.conf.allowed_conversation_files_type.join(", ");
|
fileInput.accept = ServerConfig.conf.conversations_policy.allowed_conversation_files_type.join(", ");
|
||||||
|
|
||||||
// Send file button
|
// Send file button
|
||||||
var fileButton = createElem2({
|
var fileButton = createElem2({
|
||||||
@ -464,7 +464,7 @@ const ConversationPageConvPart = {
|
|||||||
class: "form-control",
|
class: "form-control",
|
||||||
placeholder: "New message...",
|
placeholder: "New message...",
|
||||||
});
|
});
|
||||||
inputText.maxLength = ServerConfig.conf.max_conversation_message_len;
|
inputText.maxLength = ServerConfig.conf.conversations_policy.max_conversation_message_len;
|
||||||
inputText.focus();
|
inputText.focus();
|
||||||
|
|
||||||
// Notify other users when this user is writing a message
|
// Notify other users when this user is writing a message
|
||||||
@ -536,8 +536,8 @@ const ConversationPageConvPart = {
|
|||||||
let message = inputText.value;
|
let message = inputText.value;
|
||||||
|
|
||||||
//Check if message is empty
|
//Check if message is empty
|
||||||
if(message.length > ServerConfig.conf.max_conversation_message_len
|
if(message.length > ServerConfig.conf.conversations_policy.max_conversation_message_len
|
||||||
|| message.length < ServerConfig.conf.min_conversation_message_len){
|
|| message.length < ServerConfig.conf.conversations_policy.min_conversation_message_len){
|
||||||
notify(tr("Invalid message length!"), "danger", 2);
|
notify(tr("Invalid message length!"), "danger", 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
19
assets/js/typings/ServerConfig.d.ts
vendored
19
assets/js/typings/ServerConfig.d.ts
vendored
@ -24,14 +24,7 @@ declare interface DataConservationPolicySettings {
|
|||||||
min_likes_lifetime: number
|
min_likes_lifetime: number
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface StaticServerConfig {
|
declare interface ConversationPolicy {
|
||||||
terms_url: string,
|
|
||||||
privacy_policy_url: string,
|
|
||||||
play_store_url: string,
|
|
||||||
android_direct_download_url: string,
|
|
||||||
password_policy: PasswordPolicy,
|
|
||||||
data_conservation_policy: DataConservationPolicySettings,
|
|
||||||
|
|
||||||
min_conversation_message_len: number,
|
min_conversation_message_len: number,
|
||||||
max_conversation_message_len: number,
|
max_conversation_message_len: number,
|
||||||
allowed_conversation_files_type: String[],
|
allowed_conversation_files_type: String[],
|
||||||
@ -39,3 +32,13 @@ declare interface StaticServerConfig {
|
|||||||
conversation_writing_event_interval: number,
|
conversation_writing_event_interval: number,
|
||||||
conversation_writing_event_lifetime: number,
|
conversation_writing_event_lifetime: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare interface StaticServerConfig {
|
||||||
|
terms_url: string,
|
||||||
|
privacy_policy_url: string,
|
||||||
|
play_store_url: string,
|
||||||
|
android_direct_download_url: string,
|
||||||
|
password_policy: PasswordPolicy,
|
||||||
|
data_conservation_policy: DataConservationPolicySettings,
|
||||||
|
conversations_policy: ConversationPolicy,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user