From abdc6497f89b5fd6863a0637c9c25afa0a1fbcca Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Thu, 4 Aug 2022 13:38:05 +0200 Subject: [PATCH] Add an option to allow a user to report its own content --- src/api_data/server_config.rs | 3 +++ src/constants.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/api_data/server_config.rs b/src/api_data/server_config.rs index 7dc783b..169f50f 100644 --- a/src/api_data/server_config.rs +++ b/src/api_data/server_config.rs @@ -8,6 +8,7 @@ use serde::Serialize; 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::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::config::{Banner, conf}; use crate::data::report::REPORT_CAUSES; @@ -76,6 +77,7 @@ struct ReportCause { struct ReportPolicy { causes: Vec, max_comment_length: u32, + can_user_report_his_own_content: bool, } #[derive(Serialize)] @@ -170,6 +172,7 @@ impl ServerConfig { ]), }).collect(), max_comment_length: reports::MAX_COMMENT_LENGTH, + can_user_report_his_own_content: CAN_USER_REPORT_ITS_OWN_CONTENT, }), false => None }, diff --git a/src/constants.rs b/src/constants.rs index ed1d2d1..7aa7f73 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -273,6 +273,9 @@ pub const FIREBASE_PUSH_MESSAGE_URL: &str = "https://fcm.googleapis.com/v1/proje pub mod reports { /// Maximum report comment length 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