mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Can send an invitation
This commit is contained in:
@ -331,6 +331,18 @@ pub fn get_list_members(g: &GroupID) -> ResultBoxError<Vec<GroupMember>> {
|
||||
.exec(db_to_group_member)
|
||||
}
|
||||
|
||||
/// Send an invitation to a user
|
||||
pub fn send_invitation(group_id: &GroupID, user_id: &UserID) -> ResultBoxError {
|
||||
insert_member(&GroupMember {
|
||||
id: 0,
|
||||
user_id: user_id.clone(),
|
||||
group_id: group_id.clone(),
|
||||
time_create: time(),
|
||||
level: GroupMembershipLevel::INVITED,
|
||||
following: true,
|
||||
})
|
||||
}
|
||||
|
||||
/// Turn a database entry into a group struct
|
||||
fn db_to_group(row: &database::RowResult) -> ResultBoxError<Group> {
|
||||
let group_id = row.get_group_id("id")?;
|
||||
|
Reference in New Issue
Block a user