1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-29 16:56:28 +00:00

Create notification when sending a group membership request

This commit is contained in:
Pierre HUBERT 2021-01-24 18:37:07 +01:00
parent 5f70c32b96
commit 3ceb2ae13d

View File

@ -241,13 +241,18 @@ pub fn send_request(r: &mut HttpRequestHandler) -> RequestResult {
groups_helper::insert_member(&GroupMember { groups_helper::insert_member(&GroupMember {
id: 0, id: 0,
user_id: r.user_id()?, user_id: r.user_id()?,
group_id, group_id: group_id.clone(),
time_create: time(), time_create: time(),
level, level,
following: true, 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!") r.success("The membership has been successfully saved!")
} }