From c7c651e6fe6d61679f0e15d548c2cb99b18cc8d5 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 24 Jan 2021 18:17:32 +0100 Subject: [PATCH] Send a notification when responding to friensdhip request --- src/controllers/friends_controller.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/controllers/friends_controller.rs b/src/controllers/friends_controller.rs index 8f74b8e..37bafe7 100644 --- a/src/controllers/friends_controller.rs +++ b/src/controllers/friends_controller.rs @@ -119,7 +119,15 @@ pub fn respond_request(r: &mut HttpRequestHandler) -> RequestResult { friends_helper::respond_request(r.user_id_ref()?, &friend_id, accept)?; - // TODO : create a notification + // Create a notification + notifications_helper::create_friends_notification( + r.user_id_ref()?, + &friend_id, + match accept { + true => NotifEventType::ACCEPTED_FRIEND_REQUEST, + false => NotifEventType::REJECTED_FRIEND_REQUEST + }, + )?; r.set_response("Response to the friendship request successfully saved!") }