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

Can remove conversation image

This commit is contained in:
Pierre HUBERT 2021-03-07 15:27:34 +01:00
parent 385a800b7a
commit 466cf1903f
2 changed files with 11 additions and 0 deletions

View File

@ -121,6 +121,16 @@ pub fn change_image(r: &mut HttpRequestHandler) -> RequestResult {
r.ok()
}
/// Delete conversation image
pub fn delete_image(r: &mut HttpRequestHandler) -> RequestResult {
let conv_membership = r.post_conv_admin("convID")?;
let conv = conversations_helper::get_single(conv_membership.conv_id)?;
conversations_helper::remove_conversation_image(&conv)?;
r.ok()
}
/// Add a new member to a conversation
pub fn add_member(r: &mut HttpRequestHandler) -> RequestResult {
let conv_membership = r.post_conv("convID")?;

View File

@ -195,6 +195,7 @@ pub fn get_routes() -> Vec<Route> {
Route::post("/conversations/get_single", Box::new(conversations_controller::get_single)),
Route::post("/conversations/updateSettings", Box::new(conversations_controller::update_settings)),
Route::post("/conversations/change_image", Box::new(conversations_controller::change_image)),
Route::post("/conversations/delete_image", Box::new(conversations_controller::delete_image)),
Route::post("/conversations/addMember", Box::new(conversations_controller::add_member)),
Route::post("/conversations/setAdmin", Box::new(conversations_controller::set_admin)),
Route::post("/conversations/removeMember", Box::new(conversations_controller::remove_member)),