1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-27 05:58:51 +00:00

Add conversation logo size in exposed configuration

This commit is contained in:
Pierre HUBERT 2021-03-13 11:28:20 +01:00
parent 6b06da1a63
commit 4776207ce8
3 changed files with 11 additions and 3 deletions

View File

@ -4,7 +4,7 @@
use serde::Serialize;
use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy};
use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, CONVERSATION_WRITING_EVENT_INTERVAL, CONVERSATION_WRITING_EVENT_LIFETIME, MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT, MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, CONVERSATION_WRITING_EVENT_INTERVAL, CONVERSATION_WRITING_EVENT_LIFETIME, MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_LOGO_HEIGHT, MAX_CONV_LOGO_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT, MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::data::config::conf;
#[derive(Serialize)]
@ -41,6 +41,8 @@ struct ConversationsPolicy {
max_message_image_height: u32,
max_thumbnail_width: u32,
max_thumbnail_height: u32,
max_logo_width: u32,
max_logo_height: u32,
}
#[derive(Serialize)]
@ -95,6 +97,8 @@ impl ServerConfig {
max_message_image_height: MAX_CONV_IMAGE_MESSAGE_WIDTH,
max_thumbnail_width: MAX_CONV_MESSAGE_THUMBNAIL_WIDTH,
max_thumbnail_height: MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT,
max_logo_width: MAX_CONV_LOGO_WIDTH,
max_logo_height: MAX_CONV_LOGO_HEIGHT,
},
}
}

View File

@ -208,4 +208,8 @@ pub mod conversations {
/// Thumbnail size
pub const MAX_CONV_MESSAGE_THUMBNAIL_WIDTH: u32 = 300;
pub const MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT: u32 = 300;
/// Conversation logo size
pub const MAX_CONV_LOGO_WIDTH: u32 = 200;
pub const MAX_CONV_LOGO_HEIGHT: u32 = 200;
}

View File

@ -12,7 +12,7 @@ use crate::api_data::res_count_unread_conversations::ResultCountUnreadConversati
use crate::api_data::res_create_conversation::ResCreateConversation;
use crate::api_data::res_find_private_conversations::ResFindPrivateConversations;
use crate::api_data::user_is_writing_message_in_conversation::UserIsWritingMessageInConversation;
use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, MAX_CONV_IMAGE_MESSAGE_HEIGHT, MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT, MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, MAX_CONV_IMAGE_MESSAGE_HEIGHT, MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_LOGO_HEIGHT, MAX_CONV_LOGO_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT, MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::controllers::user_ws_controller;
use crate::data::base_request_handler::{BaseRequestHandler, RequestValue};
use crate::data::conversation::NewConversationSettings;
@ -108,7 +108,7 @@ pub fn change_image(r: &mut HttpRequestHandler) -> RequestResult {
let conv_membership = r.post_conv_admin("convID")?;
let conv = conversations_helper::get_single(conv_membership.conv_id)?;
let new_image = r.save_post_image("file", "conv-image", 200, 200)?;
let new_image = r.save_post_image("file", "conv-image", MAX_CONV_LOGO_WIDTH, MAX_CONV_LOGO_HEIGHT)?;
conversations_helper::remove_conversation_image(&conv)?;