1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

Add an option to allow a user to report its own content

This commit is contained in:
Pierre HUBERT 2022-08-04 13:38:05 +02:00
parent 4efb63fb32
commit abdc6497f8
2 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use serde::Serialize;
use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy, reports}; use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy, reports};
use crate::constants::accounts_info_policy::{MAX_FIRST_NAME_LENGTH, MAX_LAST_NAME_LENGTH, MAX_LOCATION_LENGTH, MIN_FIRST_NAME_LENGTH, MIN_LAST_NAME_LENGTH}; use crate::constants::accounts_info_policy::{MAX_FIRST_NAME_LENGTH, MAX_LAST_NAME_LENGTH, MAX_LOCATION_LENGTH, MIN_FIRST_NAME_LENGTH, MIN_LAST_NAME_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, MAX_CONVERSATION_NAME_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, MAX_CONVERSATION_NAME_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::constants::reports::CAN_USER_REPORT_ITS_OWN_CONTENT;
use crate::data::api_client::APIClient; use crate::data::api_client::APIClient;
use crate::data::config::{Banner, conf}; use crate::data::config::{Banner, conf};
use crate::data::report::REPORT_CAUSES; use crate::data::report::REPORT_CAUSES;
@ -76,6 +77,7 @@ struct ReportCause {
struct ReportPolicy { struct ReportPolicy {
causes: Vec<ReportCause>, causes: Vec<ReportCause>,
max_comment_length: u32, max_comment_length: u32,
can_user_report_his_own_content: bool,
} }
#[derive(Serialize)] #[derive(Serialize)]
@ -170,6 +172,7 @@ impl ServerConfig {
]), ]),
}).collect(), }).collect(),
max_comment_length: reports::MAX_COMMENT_LENGTH, max_comment_length: reports::MAX_COMMENT_LENGTH,
can_user_report_his_own_content: CAN_USER_REPORT_ITS_OWN_CONTENT,
}), }),
false => None false => None
}, },

View File

@ -273,6 +273,9 @@ pub const FIREBASE_PUSH_MESSAGE_URL: &str = "https://fcm.googleapis.com/v1/proje
pub mod reports { pub mod reports {
/// Maximum report comment length /// Maximum report comment length
pub const MAX_COMMENT_LENGTH: u32 = 500; pub const MAX_COMMENT_LENGTH: u32 = 500;
/// Specify whether a user can reports its own content or not
pub const CAN_USER_REPORT_ITS_OWN_CONTENT: bool = true;
} }
/// Admin-specific constants /// Admin-specific constants