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

Add missing check

This commit is contained in:
Pierre HUBERT 2021-04-11 18:43:46 +02:00
parent 81832003ea
commit 93403e0ce2

View File

@ -4,11 +4,11 @@
use crate::api_data::friend_api::FriendAPI; use crate::api_data::friend_api::FriendAPI;
use crate::api_data::friendship_status_api::FriendshipStatusAPI; use crate::api_data::friendship_status_api::FriendshipStatusAPI;
use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::notification::NotifEventType; use crate::data::notification::NotifEventType;
use crate::helpers::{friends_helper, notifications_helper, user_helper}; use crate::helpers::{friends_helper, notifications_helper, user_helper};
use crate::routes::RequestResult;
/// Get the list of friends of the current user /// Get the list of friends of the current user
pub fn get_list(r: &mut HttpRequestHandler) -> RequestResult { pub fn get_list(r: &mut HttpRequestHandler) -> RequestResult {
@ -44,7 +44,9 @@ pub fn get_other_user_list(r: &mut HttpRequestHandler) -> RequestResult {
r.forbidden("The friend list of this user is not public!".to_string())?; r.forbidden("The friend list of this user is not public!".to_string())?;
} }
let friends = friends_helper::GetFriendsQuery::new(&user_id).exec()?; let friends = friends_helper::GetFriendsQuery::new(&user_id)
.set_only_accepted(true)
.exec()?;
r.set_response(friends.iter().map(|f| f.friend_id.id()).collect::<Vec<u64>>()) r.set_response(friends.iter().map(|f| f.friend_id.id()).collect::<Vec<u64>>())
} }