1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Can update following status

This commit is contained in:
2020-06-30 14:48:39 +02:00
parent f540716b86
commit b15ffe0856
4 changed files with 38 additions and 2 deletions

View File

@ -120,11 +120,21 @@ pub fn respond_request(r: &mut HttpRequestHandler) -> RequestResult {
/// Remove a friend from the list
pub fn remove_friend(r: &mut HttpRequestHandler) -> RequestResult {
let friend_id = r.post_user_id("friendID")?;
let friend_id = r.post_friend_id("friendID")?;
friends_helper::remove_friendship(r.user_id_ref()?, &friend_id)?;
// TODO : Delete any related notification
r.success("The friend was removed from the list!")
}
/// Update following status
pub fn set_following(r: &mut HttpRequestHandler) -> RequestResult {
let friend_id = r.post_friend_id("friendID")?;
let follow = r.post_bool("follow")?;
friends_helper::set_following(r.user_id_ref()?, &friend_id, follow)?;
r.success("Following status updated!")
}

View File

@ -105,6 +105,8 @@ pub fn get_routes() -> Vec<Route> {
Route::post("/friends/remove", Box::new(friends_controller::remove_friend)),
Route::post("/friends/setFollowing", Box::new(friends_controller::set_following)),
// Conversations controller
Route::post("/conversations/create", Box::new(conversations_controller::create)),