mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-09-25 22:29:45 +00:00
Can update conversation message content
This commit is contained in:
@@ -298,4 +298,18 @@ pub fn delete_conversation(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
conversations_helper::remove_user_from_conversation(r.user_id()?, conv_id)?;
|
||||
|
||||
r.success("The conversation has been deleted")
|
||||
}
|
||||
|
||||
/// Update a single conversation message
|
||||
pub fn update_message(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let msg_id = r.post_u64("messageID")?;
|
||||
let new_content = r.post_string_opt("content", 3, true)?;
|
||||
|
||||
if !conversations_helper::is_message_owner(r.user_id()?, msg_id)? {
|
||||
r.forbidden("You are not the owner of this message!".to_string())?;
|
||||
}
|
||||
|
||||
conversations_helper::update_message_content(msg_id, &new_content)?;
|
||||
|
||||
r.success("Conversation message content successfully updated")
|
||||
}
|
Reference in New Issue
Block a user