1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Return the list of available private conversations

This commit is contained in:
2020-06-18 09:40:18 +02:00
parent ab10bc2d36
commit 633974a401
3 changed files with 29 additions and 3 deletions

View File

@ -4,6 +4,7 @@
use crate::api_data::conversation_api::ConversationAPI;
use crate::api_data::res_create_conversation::ResCreateConversation;
use crate::api_data::res_find_private_conversations::ResFindPrivateConversations;
use crate::controllers::routes::RequestResult;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::new_conversation::NewConversation;
@ -136,7 +137,11 @@ pub fn find_private(r: &mut HttpRequestHandler) -> RequestResult {
// Query the database
let list = conversations_helper::find_private(r.user_id()?, other_user)?;
println!("{:#?}", list);
if list.is_empty() {
if !allow_create {
return r.not_found(format!("Not any private conversation was found. The server was not allowed to create a new one..."));
}
}
r.success("implement it")
r.set_response(ResFindPrivateConversations::new(list))
}