mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Can create custom emoji
This commit is contained in:
@ -23,7 +23,7 @@ use crate::data::user::UserID;
|
||||
use crate::helpers::{account_helper, api_helper, comments_helper, conversations_helper, friends_helper, groups_helper, movies_helper, posts_helper, user_helper, virtual_directory_helper};
|
||||
use crate::helpers::virtual_directory_helper::VirtualDirType;
|
||||
use crate::utils::pdf_utils::is_valid_pdf;
|
||||
use crate::utils::string_utils::{check_string_before_insert, check_url, remove_html_nodes};
|
||||
use crate::utils::string_utils::{check_emoji_code, check_string_before_insert, check_url, remove_html_nodes};
|
||||
use crate::utils::user_data_utils::{generate_new_user_data_file_name, prepare_file_creation, user_data_path};
|
||||
use crate::utils::virtual_directories_utils::check_virtual_directory;
|
||||
|
||||
@ -671,4 +671,15 @@ impl HttpRequestHandler {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get an emoji shortcut included in a POST request
|
||||
pub fn post_emoji_shortcut(&mut self, field: &str) -> ResultBoxError<String> {
|
||||
let emoji_shortcut = self.post_string(field)?;
|
||||
|
||||
if !check_emoji_code(&emoji_shortcut) {
|
||||
self.bad_request("Invalid emoji shortcut code!".to_string())?;
|
||||
}
|
||||
|
||||
Ok(emoji_shortcut)
|
||||
}
|
||||
}
|
@ -32,4 +32,5 @@ pub mod user_like;
|
||||
pub mod survey_response;
|
||||
pub mod general_settings;
|
||||
pub mod lang_settings;
|
||||
pub mod security_settings;
|
||||
pub mod security_settings;
|
||||
pub mod new_custom_emoji;
|
11
src/data/new_custom_emoji.rs
Normal file
11
src/data/new_custom_emoji.rs
Normal file
@ -0,0 +1,11 @@
|
||||
//! # New custom emoji
|
||||
//!
|
||||
//! @author Pierre Hubert
|
||||
|
||||
use crate::data::user::UserID;
|
||||
|
||||
pub struct NewCustomEmoji {
|
||||
pub user_id: UserID,
|
||||
pub shortcut: String,
|
||||
pub path: String,
|
||||
}
|
Reference in New Issue
Block a user