diff --git a/src/controllers/groups_controller.rs b/src/controllers/groups_controller.rs index 7e988aa..45a131d 100644 --- a/src/controllers/groups_controller.rs +++ b/src/controllers/groups_controller.rs @@ -241,13 +241,18 @@ pub fn send_request(r: &mut HttpRequestHandler) -> RequestResult { groups_helper::insert_member(&GroupMember { id: 0, user_id: r.user_id()?, - group_id, + group_id: group_id.clone(), time_create: time(), level, following: true, })?; - // TODO : Send a notification, if required + // Send a notification, if required + if matches!(group.registration_level, GroupRegistrationLevel::MODERATED_REGISTRATION) { + notifications_helper::create_group_membership_notification(r.user_id_ref()?, None, + &group_id, NotifEventType::SENT_GROUP_MEMBERSHIP_REQUEST)?; + } + r.success("The membership has been successfully saved!") }