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

Can create friendship notifications

This commit is contained in:
2021-01-23 15:04:52 +01:00
parent 4d6ff8fef3
commit fd5000aef9
2 changed files with 28 additions and 4 deletions

View File

@ -6,7 +6,8 @@ use crate::api_data::friend_api::FriendAPI;
use crate::api_data::friendship_status_api::FriendshipStatusAPI;
use crate::controllers::routes::RequestResult;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::helpers::{account_helper, friends_helper, user_helper};
use crate::data::notification::NotifEventType;
use crate::helpers::{account_helper, friends_helper, notifications_helper, user_helper};
/// Get the list of friends of the current user
pub fn get_list(r: &mut HttpRequestHandler) -> RequestResult {
@ -82,7 +83,11 @@ pub fn send_request(r: &mut HttpRequestHandler) -> RequestResult {
friends_helper::send_request(&r.user_id()?, &friend_id)?;
// TODO : create a notification
// Create a notification
notifications_helper::create_friends_notification(
r.user_id_ref()?,
&friend_id,
NotifEventType::SENT_FRIEND_REQUEST)?;
r.success("The friendship request was successfully sent!")
}