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:
@ -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!")
|
||||
}
|
@ -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)),
|
||||
|
Reference in New Issue
Block a user